@pickaxeproject/react 6.18.1 → 6.19.0-beta.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 (63) hide show
  1. package/dist/cjs/common/actionApproval.js +1 -0
  2. package/dist/cjs/common/formInputOrder.js +1 -0
  3. package/dist/cjs/common/formQuestionValidation.js +1 -0
  4. package/dist/cjs/components/Pickaxe/Chat/Input.js +1 -1
  5. package/dist/cjs/components/Pickaxe/Form/Questions/Submit.js +1 -1
  6. package/dist/cjs/components/Pickaxe/Form/Questions/index.js +1 -1
  7. package/dist/cjs/components/Pickaxe/Provider.js +1 -1
  8. package/dist/cjs/components/Pickaxe/ResponseProvider.js +1 -1
  9. package/dist/cjs/components/Pickaxe/common/EndUserModelPicker.js +1 -0
  10. package/dist/cjs/components/Pickaxe/common/PickaxeMessageParts/ActionApprovalPart.js +1 -0
  11. package/dist/cjs/components/Pickaxe/common/PickaxeMessageParts/index.js +1 -1
  12. package/dist/cjs/hooks/pickaxe/useActionApprovals.js +1 -0
  13. package/dist/cjs/hooks/pickaxe/useEndUserModel.js +1 -0
  14. package/dist/cjs/index.js +1 -1
  15. package/dist/cjs/src/common/actionApproval.d.ts +16 -0
  16. package/dist/cjs/src/common/formInputOrder.d.ts +4 -0
  17. package/dist/cjs/src/common/formQuestionValidation.d.ts +2 -0
  18. package/dist/cjs/src/components/Pickaxe/Form/Questions/Submit.d.ts +5 -1
  19. package/dist/cjs/src/components/Pickaxe/Provider.d.ts +2 -0
  20. package/dist/cjs/src/components/Pickaxe/ResponseProvider.d.ts +3 -0
  21. package/dist/cjs/src/components/Pickaxe/common/EndUserModelPicker.d.ts +3 -0
  22. package/dist/cjs/src/components/Pickaxe/common/PickaxeMessageParts/ActionApprovalPart.d.ts +6 -0
  23. package/dist/cjs/src/components/Pickaxe/common/PickaxeMessageParts/index.d.ts +4 -1
  24. package/dist/cjs/src/hooks/pickaxe/useActionApprovals.d.ts +10 -0
  25. package/dist/cjs/src/hooks/pickaxe/useEndUserModel.d.ts +10 -0
  26. package/dist/cjs/src/hooks/pickaxe/usePickaxeContext.d.ts +2 -0
  27. package/dist/cjs/src/hooks/pickaxe/useResponseContext.d.ts +10 -0
  28. package/dist/cjs/src/index.d.ts +2 -0
  29. package/dist/cjs/src/types/form.d.ts +2 -0
  30. package/dist/cjs/src/types/history.d.ts +7 -2
  31. package/dist/cjs/src/types/pickaxe.d.ts +18 -0
  32. package/dist/esm/common/actionApproval.js +1 -0
  33. package/dist/esm/common/formInputOrder.js +1 -0
  34. package/dist/esm/common/formQuestionValidation.js +1 -0
  35. package/dist/esm/components/Pickaxe/Chat/Input.js +1 -1
  36. package/dist/esm/components/Pickaxe/Form/Questions/Submit.js +1 -1
  37. package/dist/esm/components/Pickaxe/Form/Questions/index.js +1 -1
  38. package/dist/esm/components/Pickaxe/Provider.js +1 -1
  39. package/dist/esm/components/Pickaxe/ResponseProvider.js +1 -1
  40. package/dist/esm/components/Pickaxe/common/EndUserModelPicker.js +1 -0
  41. package/dist/esm/components/Pickaxe/common/PickaxeMessageParts/ActionApprovalPart.js +1 -0
  42. package/dist/esm/components/Pickaxe/common/PickaxeMessageParts/index.js +1 -1
  43. package/dist/esm/hooks/pickaxe/useActionApprovals.js +1 -0
  44. package/dist/esm/hooks/pickaxe/useEndUserModel.js +1 -0
  45. package/dist/esm/index.js +1 -1
  46. package/dist/esm/src/common/actionApproval.d.ts +16 -0
  47. package/dist/esm/src/common/formInputOrder.d.ts +4 -0
  48. package/dist/esm/src/common/formQuestionValidation.d.ts +2 -0
  49. package/dist/esm/src/components/Pickaxe/Form/Questions/Submit.d.ts +5 -1
  50. package/dist/esm/src/components/Pickaxe/Provider.d.ts +2 -0
  51. package/dist/esm/src/components/Pickaxe/ResponseProvider.d.ts +3 -0
  52. package/dist/esm/src/components/Pickaxe/common/EndUserModelPicker.d.ts +3 -0
  53. package/dist/esm/src/components/Pickaxe/common/PickaxeMessageParts/ActionApprovalPart.d.ts +6 -0
  54. package/dist/esm/src/components/Pickaxe/common/PickaxeMessageParts/index.d.ts +4 -1
  55. package/dist/esm/src/hooks/pickaxe/useActionApprovals.d.ts +10 -0
  56. package/dist/esm/src/hooks/pickaxe/useEndUserModel.d.ts +10 -0
  57. package/dist/esm/src/hooks/pickaxe/usePickaxeContext.d.ts +2 -0
  58. package/dist/esm/src/hooks/pickaxe/useResponseContext.d.ts +10 -0
  59. package/dist/esm/src/index.d.ts +2 -0
  60. package/dist/esm/src/types/form.d.ts +2 -0
  61. package/dist/esm/src/types/history.d.ts +7 -2
  62. package/dist/esm/src/types/pickaxe.d.ts +18 -0
  63. package/package.json +207 -206
@@ -0,0 +1,16 @@
1
+ import type { PickaxeHistoryMessagePart } from "../types/history";
2
+ export type ActionApprovalStatus = "pending" | "approved" | "declined" | "expired" | "cancelled";
3
+ export type ActionApprovalData = {
4
+ id: string;
5
+ name: string;
6
+ kind: "action" | "mcp";
7
+ pickaxeId: string;
8
+ status: ActionApprovalStatus;
9
+ expiresAt: number;
10
+ arguments?: string;
11
+ };
12
+ export declare function parseActionApproval(content: string): ActionApprovalData | null;
13
+ /** Replace an existing approval in place so decisions never duplicate cards. */
14
+ export declare function upsertActionApprovalPart(parts: PickaxeHistoryMessagePart[], data: ActionApprovalData): void;
15
+ /** Approval updates can arrive while a text/reasoning part is still streaming. */
16
+ export declare function updateStreamTextPart(parts: PickaxeHistoryMessagePart[], type: "text" | "reasoning", content: string): void;
@@ -0,0 +1,4 @@
1
+ /** Missing or invalid ranks retain legacy prompt order, after explicitly ranked fields. */
2
+ export declare function sortFormInputs<T extends {
3
+ order?: number;
4
+ }>(inputs: readonly T[]): T[];
@@ -0,0 +1,2 @@
1
+ import type { MemoryStoredQuestionField } from "../types/form";
2
+ export declare function getFormQuestionError(field: MemoryStoredQuestionField): "response-too-long" | "required-fields-missing" | null;
@@ -1,8 +1,12 @@
1
+ import type { ReactNode } from "react";
1
2
  import type { MemoryStoredQuestionField } from "../../../../types/form";
2
3
  interface SubmitProps {
4
+ navigation?: ReactNode;
5
+ paged?: boolean;
6
+ onInvalidQuestion?: (id: string) => void;
3
7
  questions: MemoryStoredQuestionField[];
4
8
  update: (questions: MemoryStoredQuestionField) => void;
5
9
  resetQuestions: () => void;
6
10
  }
7
- declare const Submit: ({ questions, resetQuestions }: SubmitProps) => import("react/jsx-runtime").JSX.Element;
11
+ declare const Submit: ({ navigation, paged, questions, resetQuestions, onInvalidQuestion, }: SubmitProps) => import("react/jsx-runtime").JSX.Element;
8
12
  export default Submit;
@@ -88,6 +88,8 @@ type PickaxeContextType = {
88
88
  portalId?: string;
89
89
  accessGroup?: AccessGroup | null;
90
90
  pickaxe: LimitedPickaxe | null;
91
+ selectedModel: string;
92
+ setSelectedModel: SetState<string>;
91
93
  styles: PickaxeProviderStyles;
92
94
  colors: PickaxeProviderColors;
93
95
  misc: PickaxeMisc;
@@ -1,3 +1,4 @@
1
+ import { useActionApprovals } from "../../hooks/pickaxe/useActionApprovals";
1
2
  import type { SetState } from "../../types/common";
2
3
  import type { MemoryStoredChatMessage, MemoryStoredFormResponse } from "../../types/response";
3
4
  import { type ReactNode } from "react";
@@ -27,6 +28,8 @@ type ResponseContextType = {
27
28
  setStatus: SetState<ResponseStatus>;
28
29
  setLimitData: SetState<PickaxeLimitData | null>;
29
30
  setError: SetState<string>;
31
+ actionApproval: ReturnType<typeof useActionApprovals>;
32
+ setActionApprovalToken: (token: string | null) => void;
30
33
  setIsGuestLimitReached: SetState<boolean>;
31
34
  setIsSwitchedToChat: SetState<boolean>;
32
35
  };
@@ -0,0 +1,3 @@
1
+ export default function EndUserModelPicker({ compact, }: {
2
+ compact?: boolean;
3
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ import type { useActionApprovals } from "../../../../hooks/pickaxe/useActionApprovals";
2
+ export declare function ActionApprovalPart({ content, isStreaming, approval, }: {
3
+ content: string;
4
+ isStreaming?: boolean;
5
+ approval?: ReturnType<typeof useActionApprovals>;
6
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -1,10 +1,13 @@
1
+ import type { useActionApprovals } from "../../../../hooks/pickaxe/useActionApprovals";
1
2
  import type { PickaxeHistoryMessagePart } from "../../../../types/history";
2
3
  import { type SuppressedRichPreviewUrls } from "../PickaxeMarkdown/Components/A/FilePreview";
3
4
  interface PickaxeMessagePartsProps {
4
5
  className?: string;
5
6
  parts: PickaxeHistoryMessagePart[];
6
7
  isStreaming?: boolean;
8
+ /** Supply the host response controller when rendering outside ResponseProvider. */
9
+ actionApproval?: ReturnType<typeof useActionApprovals>;
7
10
  }
8
11
  export declare const getSuppressedRichPreviewUrls: (parts: PickaxeHistoryMessagePart[]) => SuppressedRichPreviewUrls;
9
- declare const PickaxeMessageParts: ({ className, parts, isStreaming, }: PickaxeMessagePartsProps) => import("react/jsx-runtime").JSX.Element;
12
+ declare const PickaxeMessageParts: ({ className, parts, isStreaming, actionApproval: suppliedActionApproval, }: PickaxeMessagePartsProps) => import("react/jsx-runtime").JSX.Element;
10
13
  export default PickaxeMessageParts;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ /** The decision capability stays in memory, never in saved response parts. */
3
+ export declare function useActionApprovals(active: boolean): {
4
+ setToken: import("react").Dispatch<import("react").SetStateAction<string | null>>;
5
+ enabled: boolean;
6
+ busyId: string | null;
7
+ errors: Record<string, string>;
8
+ decisions: Record<string, "approved" | "declined">;
9
+ decide: (id: string, decision: "approved" | "declined") => Promise<void>;
10
+ };
@@ -0,0 +1,10 @@
1
+ export declare function useEndUserModel(): {
2
+ options: {
3
+ id: string;
4
+ label: string;
5
+ }[];
6
+ enabled: boolean;
7
+ value: string;
8
+ setValue: import("../../types/common").SetState<string>;
9
+ defaultModel: import("../../types/pickaxe").PickaxeModel | undefined;
10
+ };
@@ -16,6 +16,8 @@ export declare const usePickaxeContext: () => {
16
16
  portalId?: string | undefined;
17
17
  accessGroup?: import("../../components/Pickaxe/Provider").AccessGroup | null | undefined;
18
18
  pickaxe: import("../../types/pickaxe").LimitedPickaxe | null;
19
+ selectedModel: string;
20
+ setSelectedModel: import("../../types/common").SetState<string>;
19
21
  styles: import("../../components/Pickaxe/Provider").PickaxeProviderStyles;
20
22
  colors: import("../../components/Pickaxe/Provider").PickaxeProviderColors;
21
23
  misc: import("../../components/Pickaxe/Provider").PickaxeMisc;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const useResponseContext: () => {
2
3
  messages: import("../../types/response").MemoryStoredChatMessage[];
3
4
  response: import("../../types/response").MemoryStoredFormResponse | null;
@@ -13,6 +14,15 @@ export declare const useResponseContext: () => {
13
14
  setStatus: import("../../types/common").SetState<import("../../components/Pickaxe/ResponseProvider").ResponseStatus>;
14
15
  setLimitData: import("../../types/common").SetState<import("../../components/Pickaxe/ResponseProvider").PickaxeLimitData | null>;
15
16
  setError: import("../../types/common").SetState<string>;
17
+ actionApproval: {
18
+ setToken: import("react").Dispatch<import("react").SetStateAction<string | null>>;
19
+ enabled: boolean;
20
+ busyId: string | null;
21
+ errors: Record<string, string>;
22
+ decisions: Record<string, "approved" | "declined">;
23
+ decide: (id: string, decision: "approved" | "declined") => Promise<void>;
24
+ };
25
+ setActionApprovalToken: (token: string | null) => void;
16
26
  setIsGuestLimitReached: import("../../types/common").SetState<boolean>;
17
27
  setIsSwitchedToChat: import("../../types/common").SetState<boolean>;
18
28
  };
@@ -22,3 +22,5 @@ export { default as PickaxeArtifactRenderer } from "./components/Pickaxe/Addons/
22
22
  export * from "./components/Pickaxe/Addons/Artifact/Provider";
23
23
  export * from "./components/Pickaxe/Addons/Artifact/hooks/useArtifactContext";
24
24
  export * from "./components/Pickaxe/Addons/Artifact/hooks/useArtifact";
25
+ export { ActionApprovalPart } from "./components/Pickaxe/common/PickaxeMessageParts/ActionApprovalPart";
26
+ export type { ActionApprovalData, ActionApprovalStatus, } from "./common/actionApproval";
@@ -1,5 +1,7 @@
1
1
  export type PickaxeQuestionType = "Short Answer" | "short" | "Long Answer" | "long" | "Multiple Choice" | "multiple" | "Checkbox" | "Knowledge Upload";
2
2
  export type PickaxeQuestion = {
3
+ /** Optional form display order; prompt placement stays independent. */
4
+ order?: number;
3
5
  id: string;
4
6
  answerlength: string;
5
7
  example: string;
@@ -1,3 +1,4 @@
1
+ import type { ActionApprovalData } from "../common/actionApproval";
1
2
  export type PickaxeHistoryOriginType = "TEST" | "BUILDER" | "PICKAXE" | "STUDIO" | "EMBED" | "EMAIL" | "WHATSAPP" | "MAKE" | "SLACK" | "API";
2
3
  export type PickaxeHistoryPickaxeType = "CHAT" | "FORM";
3
4
  export type PickaxeHistorySenderType = "PICKAXE_USER" | "STUDIO_USER" | "DEPLOYMENT_USER";
@@ -36,7 +37,7 @@ export type PickaxeHistoryMessage = {
36
37
  createdAt: string;
37
38
  area?: PickaxeHistoryMessageArea;
38
39
  };
39
- export type PickaxeHistoryMessagePartsType = "text" | "reasoning" | "data-action-tool-caption" | "data-reasoning-caption" | "data-tool-assets";
40
+ export type PickaxeHistoryMessagePartsType = "text" | "reasoning" | "data-action-tool-caption" | "data-reasoning-caption" | "data-tool-assets" | "data-action-approval";
40
41
  export type PickaxeHistoryMessagePart = {
41
42
  type: PickaxeHistoryMessagePartsType;
42
43
  content: string;
@@ -66,6 +67,10 @@ export type PickaxeHistoryStreamDataReasoningCaption = {
66
67
  caption: string;
67
68
  };
68
69
  };
69
- export type PickaxeHistoryStreamData = PickaxeHistoryStreamDataActionToolCaption | PickaxeHistoryStreamDataReasoningCaption;
70
+ export type PickaxeHistoryStreamDataActionApproval = {
71
+ type: "data-action-approval";
72
+ data: ActionApprovalData;
73
+ };
74
+ export type PickaxeHistoryStreamData = PickaxeHistoryStreamDataActionApproval | PickaxeHistoryStreamDataActionToolCaption | PickaxeHistoryStreamDataReasoningCaption;
70
75
  export type PickaxeHistoryStream = PickaxeHistoryStreamPartStartEnd | PickaxeHistoryStreamPartDelta | PickaxeHistoryStreamData;
71
76
  export {};
@@ -2,6 +2,8 @@ import type { PickaxeQuestion } from "./form";
2
2
  export type PickaxeImageOrText = "text" | "image";
3
3
  export type PickaxePrivacySetting = "public" | "unlisted" | "private" | "deleted";
4
4
  export type PickaxeCloneable = "true" | "false";
5
+ export type PickaxeFormLayout = "single" | "paged";
6
+ export type PickaxeEndUserModelSelectionMode = "all" | "select";
5
7
  export type PickaxeDocumentUploadType = "ownerupload" | "enduserupload" | "enduserupload-user";
6
8
  export type PickaxeModel = "gpt-3.5-turbo" | "gpt-4-1106-preview" | "mistral-small" | "gpt-5.1" | "gpt-5" | "gpt-5-mini" | "gpt-5-nano" | "gpt-5-chat-latest" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano" | "gpt-4o-mini" | "gpt-4o" | "gpt-4" | "o3-mini" | "o1" | "o3" | "o4-mini" | "gemini-3-pro" | "gemini-2.5-flash" | "gemini-2.5-flash-preview-05-20" | "gemini-2.5-pro" | "gemini-2.5-pro-preview-05-06" | "gemini-2.0-flash" | "gemini-2.0-flash-lite" | "gemini-1.5-pro" | "gemini-1.5-flash" | "deepseek-chat" | "mistral-large-latest" | "claude-sonnet-4-5-20250929" | "claude-haiku-4-5-20251001" | "claude-opus-4-1-20250805" | "claude-opus-4-20250514" | "claude-opus-4-5-20251101" | "claude-sonnet-4-20250514" | "claude-3-7-sonnet-20250219" | "claude-3-opus-20240229" | "grok-4-fast-reasoning-latest" | "grok-4-fast-non-reasoning-latest" | "grok-4-1-fast-reasoning" | "grok-4-1-fast-non-reasoning" | "grok-4-latest" | "grok-3-latest" | "llama-3-uncensored" | "sonar" | "sonar-pro" | "sonar-reasoning" | "sonar-reasoning-pro" | "sonar-deep-research";
7
9
  export type Pickaxe = {
@@ -36,6 +38,14 @@ export type Pickaxe = {
36
38
  maxlength: number;
37
39
  membuffer: number;
38
40
  model: PickaxeModel;
41
+ formLayout?: PickaxeFormLayout;
42
+ allowEndUserModelSelection?: boolean;
43
+ endUserModelSelectionMode?: PickaxeEndUserModelSelectionMode;
44
+ allowedEndUserModels?: string[];
45
+ availableEndUserModels?: {
46
+ id: string;
47
+ label: string;
48
+ }[];
39
49
  owner: string;
40
50
  placeholdertext: string;
41
51
  prespenalty: number;
@@ -80,6 +90,14 @@ export type LimitedPickaxe = {
80
90
  formtitle: string;
81
91
  intromessage?: string;
82
92
  model: PickaxeModel;
93
+ formLayout?: PickaxeFormLayout;
94
+ allowEndUserModelSelection?: boolean;
95
+ endUserModelSelectionMode?: PickaxeEndUserModelSelectionMode;
96
+ allowedEndUserModels?: string[];
97
+ availableEndUserModels?: {
98
+ id: string;
99
+ label: string;
100
+ }[];
83
101
  placeholdertext: string;
84
102
  icebreakers: string[];
85
103
  submittext?: string;