@raindrop-ai/wizard 0.0.1

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 (135) hide show
  1. package/LICENSE +47 -0
  2. package/dist/bin.d.ts +2 -0
  3. package/dist/bin.js +117 -0
  4. package/dist/bin.js.map +1 -0
  5. package/dist/src/docs/browser.md +105 -0
  6. package/dist/src/docs/python.md +618 -0
  7. package/dist/src/docs/typescript.md +584 -0
  8. package/dist/src/docs/vercel-ai-sdk.md +304 -0
  9. package/dist/src/lib/agent-interface.d.ts +46 -0
  10. package/dist/src/lib/agent-interface.js +292 -0
  11. package/dist/src/lib/agent-interface.js.map +1 -0
  12. package/dist/src/lib/agent-prompts.d.ts +10 -0
  13. package/dist/src/lib/agent-prompts.js +49 -0
  14. package/dist/src/lib/agent-prompts.js.map +1 -0
  15. package/dist/src/lib/config.d.ts +39 -0
  16. package/dist/src/lib/config.js +549 -0
  17. package/dist/src/lib/config.js.map +1 -0
  18. package/dist/src/lib/constants.d.ts +27 -0
  19. package/dist/src/lib/constants.js +165 -0
  20. package/dist/src/lib/constants.js.map +1 -0
  21. package/dist/src/lib/handlers.d.ts +68 -0
  22. package/dist/src/lib/handlers.js +420 -0
  23. package/dist/src/lib/handlers.js.map +1 -0
  24. package/dist/src/lib/integration-testing.d.ts +44 -0
  25. package/dist/src/lib/integration-testing.js +123 -0
  26. package/dist/src/lib/integration-testing.js.map +1 -0
  27. package/dist/src/lib/mcp.d.ts +14 -0
  28. package/dist/src/lib/mcp.js +134 -0
  29. package/dist/src/lib/mcp.js.map +1 -0
  30. package/dist/src/lib/sdk-messages.d.ts +17 -0
  31. package/dist/src/lib/sdk-messages.js +278 -0
  32. package/dist/src/lib/sdk-messages.js.map +1 -0
  33. package/dist/src/lib/wizard.d.ts +6 -0
  34. package/dist/src/lib/wizard.js +131 -0
  35. package/dist/src/lib/wizard.js.map +1 -0
  36. package/dist/src/run.d.ts +8 -0
  37. package/dist/src/run.js +53 -0
  38. package/dist/src/run.js.map +1 -0
  39. package/dist/src/ui/App.d.ts +15 -0
  40. package/dist/src/ui/App.js +27 -0
  41. package/dist/src/ui/App.js.map +1 -0
  42. package/dist/src/ui/cancellation.d.ts +14 -0
  43. package/dist/src/ui/cancellation.js +17 -0
  44. package/dist/src/ui/cancellation.js.map +1 -0
  45. package/dist/src/ui/components/ClarifyingQuestionsPrompt.d.ts +17 -0
  46. package/dist/src/ui/components/ClarifyingQuestionsPrompt.js +359 -0
  47. package/dist/src/ui/components/ClarifyingQuestionsPrompt.js.map +1 -0
  48. package/dist/src/ui/components/ContinuePrompt.d.ts +14 -0
  49. package/dist/src/ui/components/ContinuePrompt.js +23 -0
  50. package/dist/src/ui/components/ContinuePrompt.js.map +1 -0
  51. package/dist/src/ui/components/DiffDisplay.d.ts +18 -0
  52. package/dist/src/ui/components/DiffDisplay.js +110 -0
  53. package/dist/src/ui/components/DiffDisplay.js.map +1 -0
  54. package/dist/src/ui/components/FeedbackSelectPrompt.d.ts +20 -0
  55. package/dist/src/ui/components/FeedbackSelectPrompt.js +132 -0
  56. package/dist/src/ui/components/FeedbackSelectPrompt.js.map +1 -0
  57. package/dist/src/ui/components/HistoryItemDisplay.d.ts +14 -0
  58. package/dist/src/ui/components/HistoryItemDisplay.js +140 -0
  59. package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -0
  60. package/dist/src/ui/components/Logo.d.ts +10 -0
  61. package/dist/src/ui/components/Logo.js +47 -0
  62. package/dist/src/ui/components/Logo.js.map +1 -0
  63. package/dist/src/ui/components/OrgInfoBox.d.ts +11 -0
  64. package/dist/src/ui/components/OrgInfoBox.js +16 -0
  65. package/dist/src/ui/components/OrgInfoBox.js.map +1 -0
  66. package/dist/src/ui/components/PendingPrompt.d.ts +18 -0
  67. package/dist/src/ui/components/PendingPrompt.js +57 -0
  68. package/dist/src/ui/components/PendingPrompt.js.map +1 -0
  69. package/dist/src/ui/components/PersistentTextInput.d.ts +21 -0
  70. package/dist/src/ui/components/PersistentTextInput.js +117 -0
  71. package/dist/src/ui/components/PersistentTextInput.js.map +1 -0
  72. package/dist/src/ui/components/PlanApprovalPrompt.d.ts +19 -0
  73. package/dist/src/ui/components/PlanApprovalPrompt.js +62 -0
  74. package/dist/src/ui/components/PlanApprovalPrompt.js.map +1 -0
  75. package/dist/src/ui/components/PromptContainer.d.ts +14 -0
  76. package/dist/src/ui/components/PromptContainer.js +18 -0
  77. package/dist/src/ui/components/PromptContainer.js.map +1 -0
  78. package/dist/src/ui/components/SelectPrompt.d.ts +14 -0
  79. package/dist/src/ui/components/SelectPrompt.js +62 -0
  80. package/dist/src/ui/components/SelectPrompt.js.map +1 -0
  81. package/dist/src/ui/components/SpinnerDisplay.d.ts +13 -0
  82. package/dist/src/ui/components/SpinnerDisplay.js +11 -0
  83. package/dist/src/ui/components/SpinnerDisplay.js.map +1 -0
  84. package/dist/src/ui/components/ToolApprovalPrompt.d.ts +14 -0
  85. package/dist/src/ui/components/ToolApprovalPrompt.js +142 -0
  86. package/dist/src/ui/components/ToolApprovalPrompt.js.map +1 -0
  87. package/dist/src/ui/components/ToolCallDisplay.d.ts +14 -0
  88. package/dist/src/ui/components/ToolCallDisplay.js +83 -0
  89. package/dist/src/ui/components/ToolCallDisplay.js.map +1 -0
  90. package/dist/src/ui/components/WriteKeyDisplay.d.ts +15 -0
  91. package/dist/src/ui/components/WriteKeyDisplay.js +13 -0
  92. package/dist/src/ui/components/WriteKeyDisplay.js.map +1 -0
  93. package/dist/src/ui/contexts/WizardContext.d.ts +210 -0
  94. package/dist/src/ui/contexts/WizardContext.js +362 -0
  95. package/dist/src/ui/contexts/WizardContext.js.map +1 -0
  96. package/dist/src/ui/hooks/useCancellation.d.ts +15 -0
  97. package/dist/src/ui/hooks/useCancellation.js +25 -0
  98. package/dist/src/ui/hooks/useCancellation.js.map +1 -0
  99. package/dist/src/ui/render.d.ts +34 -0
  100. package/dist/src/ui/render.js +94 -0
  101. package/dist/src/ui/render.js.map +1 -0
  102. package/dist/src/ui/types.d.ts +184 -0
  103. package/dist/src/ui/types.js +6 -0
  104. package/dist/src/ui/types.js.map +1 -0
  105. package/dist/src/utils/clack-utils.d.ts +13 -0
  106. package/dist/src/utils/clack-utils.js +131 -0
  107. package/dist/src/utils/clack-utils.js.map +1 -0
  108. package/dist/src/utils/debug.d.ts +13 -0
  109. package/dist/src/utils/debug.js +47 -0
  110. package/dist/src/utils/debug.js.map +1 -0
  111. package/dist/src/utils/environment.d.ts +5 -0
  112. package/dist/src/utils/environment.js +131 -0
  113. package/dist/src/utils/environment.js.map +1 -0
  114. package/dist/src/utils/logging.d.ts +9 -0
  115. package/dist/src/utils/logging.js +38 -0
  116. package/dist/src/utils/logging.js.map +1 -0
  117. package/dist/src/utils/oauth.d.ts +12 -0
  118. package/dist/src/utils/oauth.js +497 -0
  119. package/dist/src/utils/oauth.js.map +1 -0
  120. package/dist/src/utils/package-json-types.d.ts +44 -0
  121. package/dist/src/utils/package-json-types.js +6 -0
  122. package/dist/src/utils/package-json-types.js.map +1 -0
  123. package/dist/src/utils/package-json.d.ts +19 -0
  124. package/dist/src/utils/package-json.js +22 -0
  125. package/dist/src/utils/package-json.js.map +1 -0
  126. package/dist/src/utils/session.d.ts +2 -0
  127. package/dist/src/utils/session.js +87 -0
  128. package/dist/src/utils/session.js.map +1 -0
  129. package/dist/src/utils/types.d.ts +61 -0
  130. package/dist/src/utils/types.js +2 -0
  131. package/dist/src/utils/types.js.map +1 -0
  132. package/dist/src/utils/ui.d.ts +120 -0
  133. package/dist/src/utils/ui.js +164 -0
  134. package/dist/src/utils/ui.js.map +1 -0
  135. package/package.json +140 -0
@@ -0,0 +1,83 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text } from 'ink';
3
+ import { DiffDisplay } from './DiffDisplay.js';
4
+ /**
5
+ * Get status indicator based on tool call status
6
+ */
7
+ function getStatusIndicator(status) {
8
+ switch (status) {
9
+ case 'pending':
10
+ return { symbol: '○', color: 'gray' };
11
+ case 'executing':
12
+ return { symbol: '◐', color: 'yellow' };
13
+ case 'success':
14
+ return { symbol: '●', color: 'green' };
15
+ case 'error':
16
+ return { symbol: '●', color: 'red' };
17
+ case 'denied':
18
+ return { symbol: '○', color: 'red' };
19
+ case 'interrupted':
20
+ return { symbol: '●', color: 'red' };
21
+ default:
22
+ return { symbol: '○', color: 'gray' };
23
+ }
24
+ }
25
+ /**
26
+ * Get relative path by extracting filename or last path segments
27
+ */
28
+ function getRelativePath(fullPath) {
29
+ if (typeof fullPath !== 'string')
30
+ return '...';
31
+ // Get the last 2-3 path segments for context
32
+ const parts = fullPath.split('/').filter(Boolean);
33
+ if (parts.length <= 2)
34
+ return fullPath;
35
+ return parts.slice(-2).join('/');
36
+ }
37
+ /**
38
+ * Format tool display name and parameters separately
39
+ */
40
+ function formatToolDisplay(toolName, input) {
41
+ switch (toolName) {
42
+ case 'Glob': {
43
+ const pattern = input?.glob_pattern ?? input?.pattern ?? '*';
44
+ return { name: 'Search', params: `(pattern: "${pattern}")` };
45
+ }
46
+ case 'Grep': {
47
+ const pattern = input?.pattern ?? input?.regex ?? '...';
48
+ return { name: 'Search', params: `(pattern: "${pattern}")` };
49
+ }
50
+ case 'Read': {
51
+ const filePath = getRelativePath(input?.file_path ?? input?.path);
52
+ return { name: 'Read', params: `(${filePath})` };
53
+ }
54
+ case 'Edit': {
55
+ const filePath = getRelativePath(input?.file_path ?? input?.path);
56
+ return { name: 'Update', params: `(${filePath})` };
57
+ }
58
+ case 'Write': {
59
+ const filePath = getRelativePath(input?.file_path ?? input?.path);
60
+ return { name: 'Write', params: `(${filePath})` };
61
+ }
62
+ default:
63
+ return { name: toolName, params: null };
64
+ }
65
+ }
66
+ /**
67
+ * Display a tool call in the history
68
+ */
69
+ export function ToolCallDisplay({ toolCall, }) {
70
+ const { toolName, status, result, error, input, diffContent } = toolCall;
71
+ const { symbol, color } = getStatusIndicator(status);
72
+ const { name, params } = formatToolDisplay(toolName, input);
73
+ // For Bash, show the command instead of description
74
+ const subtitle = toolName === 'Bash'
75
+ ? (typeof input?.command === 'string' ? input.command : null)
76
+ : null;
77
+ // Check if this is an Edit or Write tool that should show diff
78
+ // Don't show diff for Edit/Write since user already saw it in the approval prompt
79
+ const shouldShowDiff = false;
80
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { color: color, children: symbol }), _jsx(Text, { children: " " }), _jsx(Text, { bold: true, children: name }), params && _jsx(Text, { children: params })] }), subtitle && (_jsx(Box, { marginLeft: 2, children: _jsx(Text, { dimColor: true, children: subtitle }) })), status === 'success' && result && (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u2514\u2500 " }), _jsx(Text, { color: "green", children: result })] })), shouldShowDiff && diffContent && (_jsx(Box, { marginLeft: 2, marginTop: 1, children: _jsx(DiffDisplay, { diffContent: diffContent, maxHeight: 15 }) })), status === 'error' && error && (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u2514\u2500 " }), _jsx(Text, { color: "red", children: error })] })), status === 'denied' && (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u2514\u2500 " }), _jsx(Text, { color: "yellow", children: "Denied by user" })] })), status === 'interrupted' && (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u2514\u2500 " }), _jsx(Text, { color: "red", children: "Interrupted" })] }))] }));
81
+ }
82
+ export default ToolCallDisplay;
83
+ //# sourceMappingURL=ToolCallDisplay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolCallDisplay.js","sourceRoot":"","sources":["../../../../src/ui/components/ToolCallDisplay.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAM/C;;GAEG;AACH,SAAS,kBAAkB,CAAC,MAAsB;IAIhD,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AAW,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,GAAI,GACpD,CACP,EAEA,MAAM,KAAK,OAAO,IAAI,KAAK,IAAI,CAC9B,MAAC,GAAG,IAAC,UAAU,EAAE,CAAC,aAChB,KAAC,IAAI,IAAC,QAAQ,oCAAW,EACzB,KAAC,IAAI,IAAC,KAAK,EAAC,KAAK,YAAE,KAAK,GAAQ,IAC5B,CACP,EAEA,MAAM,KAAK,QAAQ,IAAI,CACtB,MAAC,GAAG,IAAC,UAAU,EAAE,CAAC,aAChB,KAAC,IAAI,IAAC,QAAQ,oCAAW,EACzB,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,+BAAsB,IACtC,CACP,EAEA,MAAM,KAAK,aAAa,IAAI,CAC3B,MAAC,GAAG,IAAC,UAAU,EAAE,CAAC,aAChB,KAAC,IAAI,IAAC,QAAQ,oCAAW,EACzB,KAAC,IAAI,IAAC,KAAK,EAAC,KAAK,4BAAmB,IAChC,CACP,IACG,CACP,CAAC;AACJ,CAAC;AAED,eAAe,eAAe,CAAC","sourcesContent":["/**\n * Tool call display component for history items.\n * Shows tool execution status, name, and optional details.\n */\n\nimport React from 'react';\nimport { Box, Text } from 'ink';\nimport type { ToolCallInfo, ToolCallStatus } from '../types.js';\nimport { DiffDisplay } from './DiffDisplay.js';\n\ninterface ToolCallDisplayProps {\n toolCall: ToolCallInfo;\n}\n\n/**\n * Get status indicator based on tool call status\n */\nfunction getStatusIndicator(status: ToolCallStatus): {\n symbol: string;\n color: string;\n} {\n switch (status) {\n case 'pending':\n return { symbol: '○', color: 'gray' };\n case 'executing':\n return { symbol: '◐', color: 'yellow' };\n case 'success':\n return { symbol: '●', color: 'green' };\n case 'error':\n return { symbol: '●', color: 'red' };\n case 'denied':\n return { symbol: '○', color: 'red' };\n case 'interrupted':\n return { symbol: '●', color: 'red' };\n default:\n return { symbol: '○', color: 'gray' };\n }\n}\n\n/**\n * Get relative path by extracting filename or last path segments\n */\nfunction getRelativePath(fullPath: unknown): string {\n if (typeof fullPath !== 'string') return '...';\n // Get the last 2-3 path segments for context\n const parts = fullPath.split('/').filter(Boolean);\n if (parts.length <= 2) return fullPath;\n return parts.slice(-2).join('/');\n}\n\n/**\n * Format tool display name and parameters separately\n */\nfunction formatToolDisplay(\n toolName: string,\n input?: Record<string, unknown>,\n): { name: string; params: string | null } {\n switch (toolName) {\n case 'Glob': {\n const pattern = input?.glob_pattern ?? input?.pattern ?? '*';\n return { name: 'Search', params: `(pattern: \"${pattern}\")` };\n }\n case 'Grep': {\n const pattern = input?.pattern ?? input?.regex ?? '...';\n return { name: 'Search', params: `(pattern: \"${pattern}\")` };\n }\n case 'Read': {\n const filePath = getRelativePath(input?.file_path ?? input?.path);\n return { name: 'Read', params: `(${filePath})` };\n }\n case 'Edit': {\n const filePath = getRelativePath(input?.file_path ?? input?.path);\n return { name: 'Update', params: `(${filePath})` };\n }\n case 'Write': {\n const filePath = getRelativePath(input?.file_path ?? input?.path);\n return { name: 'Write', params: `(${filePath})` };\n }\n default:\n return { name: toolName, params: null };\n }\n}\n\n/**\n * Display a tool call in the history\n */\nexport function ToolCallDisplay({\n toolCall,\n}: ToolCallDisplayProps): React.ReactElement {\n const { toolName, status, result, error, input, diffContent } = toolCall;\n const { symbol, color } = getStatusIndicator(status);\n const { name, params } = formatToolDisplay(toolName, input);\n\n // For Bash, show the command instead of description\n const subtitle = toolName === 'Bash' \n ? (typeof input?.command === 'string' ? input.command : null)\n : null;\n\n // Check if this is an Edit or Write tool that should show diff\n // Don't show diff for Edit/Write since user already saw it in the approval prompt\n const shouldShowDiff = false;\n\n return (\n <Box flexDirection=\"column\">\n {/* Main line with status and tool name */}\n <Box>\n <Text color={color}>{symbol}</Text>\n <Text> </Text>\n <Text bold>{name}</Text>\n {params && <Text>{params}</Text>}\n </Box>\n\n {/* For Bash, show the command */}\n {subtitle && (\n <Box marginLeft={2}>\n <Text dimColor>{subtitle}</Text>\n </Box>\n )}\n\n {/* Result summary (e.g., \"Added 1 line, removed 1 line\") */}\n {status === 'success' && result && (\n <Box marginLeft={2}>\n <Text dimColor>└─ </Text>\n <Text color=\"green\">{result}</Text>\n </Box>\n )}\n\n {/* Diff content for Edit/Write tools */}\n {shouldShowDiff && diffContent && (\n <Box marginLeft={2} marginTop={1}>\n <DiffDisplay diffContent={diffContent} maxHeight={15} />\n </Box>\n )}\n\n {status === 'error' && error && (\n <Box marginLeft={2}>\n <Text dimColor>└─ </Text>\n <Text color=\"red\">{error}</Text>\n </Box>\n )}\n\n {status === 'denied' && (\n <Box marginLeft={2}>\n <Text dimColor>└─ </Text>\n <Text color=\"yellow\">Denied by user</Text>\n </Box>\n )}\n\n {status === 'interrupted' && (\n <Box marginLeft={2}>\n <Text dimColor>└─ </Text>\n <Text color=\"red\">Interrupted</Text>\n </Box>\n )}\n </Box>\n );\n}\n\nexport default ToolCallDisplay;\n"]}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Write key display component for history items.
3
+ * Shows the key masked for security (non-interactive reference).
4
+ */
5
+ import React from 'react';
6
+ interface WriteKeyDisplayProps {
7
+ writeKey: string;
8
+ label?: string;
9
+ }
10
+ /**
11
+ * Static write key display for history.
12
+ * Shows the key masked with dots for security.
13
+ */
14
+ export declare function WriteKeyDisplay({ writeKey, label, }: WriteKeyDisplayProps): React.ReactElement;
15
+ export default WriteKeyDisplay;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text } from 'ink';
3
+ /**
4
+ * Static write key display for history.
5
+ * Shows the key masked with dots for security.
6
+ */
7
+ export function WriteKeyDisplay({ writeKey, label, }) {
8
+ // Mask the key with dots
9
+ const maskedKey = '•'.repeat(Math.min(writeKey.length, 32));
10
+ return (_jsxs(Box, { children: [_jsx(Text, { color: "white", children: "\u25CF " }), _jsx(Text, { color: "cyan", children: "RAINDROP_WRITE_KEY: " }), _jsx(Text, { color: "gray", children: maskedKey }), label && _jsxs(Text, { dimColor: true, children: [" (", label, ")"] })] }));
11
+ }
12
+ export default WriteKeyDisplay;
13
+ //# sourceMappingURL=WriteKeyDisplay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WriteKeyDisplay.js","sourceRoot":"","sources":["../../../../src/ui/components/WriteKeyDisplay.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAOhC;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,QAAQ,EACR,KAAK,GACgB;IACrB,yBAAyB;IACzB,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;IAE5D,OAAO,CACL,MAAC,GAAG,eACF,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,wBAAU,EAC7B,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,qCAA4B,EAC9C,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,YAAE,SAAS,GAAQ,EACpC,KAAK,IAAI,MAAC,IAAI,IAAC,QAAQ,yBAAI,KAAK,SAAS,IACtC,CACP,CAAC;AACJ,CAAC;AAED,eAAe,eAAe,CAAC","sourcesContent":["/**\n * Write key display component for history items.\n * Shows the key masked for security (non-interactive reference).\n */\n\nimport React from 'react';\nimport { Box, Text } from 'ink';\n\ninterface WriteKeyDisplayProps {\n writeKey: string;\n label?: string;\n}\n\n/**\n * Static write key display for history.\n * Shows the key masked with dots for security.\n */\nexport function WriteKeyDisplay({\n writeKey,\n label,\n}: WriteKeyDisplayProps): React.ReactElement {\n // Mask the key with dots\n const maskedKey = '•'.repeat(Math.min(writeKey.length, 32));\n\n return (\n <Box>\n <Text color=\"white\">● </Text>\n <Text color=\"cyan\">RAINDROP_WRITE_KEY: </Text>\n <Text color=\"gray\">{maskedKey}</Text>\n {label && <Text dimColor> ({label})</Text>}\n </Box>\n );\n}\n\nexport default WriteKeyDisplay;\n"]}
@@ -0,0 +1,210 @@
1
+ /**
2
+ * Central state management for the unified Ink wizard app.
3
+ * Uses React Context to share state between all UI components.
4
+ */
5
+ import React, { type ReactNode } from 'react';
6
+ import type { SelectOptions, TextOptions, SpinnerInstance, ToolApprovalProps, ToolApprovalResult, ClarifyingQuestionsProps, ClarifyingQuestionsResult, PlanApprovalProps, PlanApprovalResult, PersistentInputProps, ToolCallInfo, AgentQueryHandle, FeedbackSelectOptions, FeedbackSelectResult, ContinuePromptOptions } from '../types.js';
7
+ /**
8
+ * Types of items that can appear in the history (Static section)
9
+ */
10
+ export type HistoryItemType = 'logo' | 'outro' | 'note' | 'cancel' | 'response' | 'warning' | 'error' | 'success' | 'step' | 'phase' | 'select-result' | 'text-result' | 'spinner-result' | 'tool-call' | 'agent-message' | 'user-message' | 'clarifying-questions-result' | 'declined-questions' | 'received-event' | 'plan-review' | 'plan-approved' | 'plan-rejected' | 'write-key' | 'org-info';
11
+ /**
12
+ * Data for received-event history items
13
+ */
14
+ export interface ReceivedEventData {
15
+ id: string;
16
+ eventName: string;
17
+ timestamp?: string;
18
+ model?: string;
19
+ userId?: string;
20
+ input?: string;
21
+ output?: string;
22
+ }
23
+ /**
24
+ * A completed item that goes into the Static history
25
+ */
26
+ export interface HistoryItem {
27
+ id: number;
28
+ type: HistoryItemType;
29
+ text: string;
30
+ /** Optional secondary content (e.g., selected option label) */
31
+ label?: string;
32
+ /** Optional hint/description */
33
+ hint?: string;
34
+ /** Title for note items */
35
+ title?: string;
36
+ /** For tool-call items, the tool call info */
37
+ toolCall?: ToolCallInfo;
38
+ /** For clarifying-questions-result items, the Q&A pairs */
39
+ questionsAndAnswers?: Array<{
40
+ question: string;
41
+ answer: string;
42
+ }>;
43
+ /** For received-event items, the event data */
44
+ receivedEvent?: ReceivedEventData;
45
+ /** For plan-approved and plan-rejected items, the plan content */
46
+ planContent?: string;
47
+ /** For write-key items, the write key and install directory */
48
+ writeKey?: string;
49
+ installDir?: string;
50
+ /** For write-key items, whether the component should be interactive */
51
+ isActive?: boolean;
52
+ /** For org-info items, the organization name */
53
+ orgName?: string;
54
+ }
55
+ /**
56
+ * Input type for adding history items (without id)
57
+ */
58
+ export type HistoryItemInput = Omit<HistoryItem, 'id'>;
59
+ /**
60
+ * Types of pending prompts that can be active
61
+ */
62
+ export type PendingItemType = 'select' | 'text' | 'spinner' | 'tool-approval' | 'clarifying-questions' | 'plan-approval' | 'persistent-input' | 'feedback-select' | 'continue';
63
+ /**
64
+ * Spinner-specific props
65
+ */
66
+ export interface SpinnerProps {
67
+ message: string;
68
+ }
69
+ /**
70
+ * All possible pending item props
71
+ */
72
+ export type PendingItemProps = SelectOptions<unknown> | TextOptions | SpinnerProps | ToolApprovalProps | ClarifyingQuestionsProps | PlanApprovalProps | PersistentInputProps | FeedbackSelectOptions<unknown> | ContinuePromptOptions;
73
+ /**
74
+ * A pending item represents an active prompt or spinner
75
+ */
76
+ export interface PendingItem {
77
+ type: PendingItemType;
78
+ props: PendingItemProps;
79
+ resolve: (value: unknown) => void;
80
+ reject?: (error: Error) => void;
81
+ }
82
+ /**
83
+ * Agent execution state
84
+ */
85
+ export interface AgentState {
86
+ /** Whether an agent is currently running */
87
+ isRunning: boolean;
88
+ /** Session ID for resuming */
89
+ sessionId?: string;
90
+ /** Handle to control the running agent */
91
+ queryHandle?: AgentQueryHandle;
92
+ /** Callbacks to restore persistent input after approval prompts */
93
+ persistentInputCallbacks?: {
94
+ onSubmit: (message: string) => void;
95
+ onInterrupt: () => void;
96
+ };
97
+ }
98
+ /**
99
+ * Wizard state that's exposed via context
100
+ */
101
+ export interface WizardState {
102
+ /** Completed history items (rendered in Static) */
103
+ history: HistoryItem[];
104
+ /** Currently active prompt (rendered as pending) */
105
+ pendingItem: PendingItem | null;
106
+ /** Whether the app is ready to exit */
107
+ shouldExit: boolean;
108
+ /** Agent execution state */
109
+ agentState: AgentState;
110
+ /** Active spinner message (separate from pendingItem so both can be visible) */
111
+ activeSpinner: string | null;
112
+ }
113
+ /**
114
+ * Actions to modify wizard state
115
+ */
116
+ export interface WizardActions {
117
+ /** Add an item to history (like gemini-cli's addItem) */
118
+ addItem: (item: HistoryItemInput) => void;
119
+ /** Deactivate all write-key items in history */
120
+ deactivateWriteKeys: () => void;
121
+ /** Display a select prompt and return the selected value */
122
+ select: <T>(options: SelectOptions<T>) => Promise<T | symbol>;
123
+ /** Display a text input prompt and return the entered value */
124
+ text: (options: TextOptions) => Promise<string | symbol>;
125
+ /** Display a continue button prompt and wait for user to press Enter */
126
+ continue: (options: ContinuePromptOptions) => Promise<boolean | symbol>;
127
+ /** Display a spinner and return control methods */
128
+ spinner: () => SpinnerInstance;
129
+ /** Resolve the current pending item with a value */
130
+ resolvePending: (value: unknown) => void;
131
+ /** Mark the app as ready to exit */
132
+ exit: () => void;
133
+ /**
134
+ * Show tool approval prompt (replaces persistent-input, restores after)
135
+ * Used by canUseTool handler for tools that need user approval
136
+ */
137
+ toolApproval: (props: ToolApprovalProps) => Promise<ToolApprovalResult>;
138
+ /**
139
+ * Show clarifying questions prompt (replaces persistent-input, restores after)
140
+ * Used by canUseTool handler for AskUserQuestion tool
141
+ */
142
+ clarifyingQuestions: (props: ClarifyingQuestionsProps) => Promise<ClarifyingQuestionsResult>;
143
+ /**
144
+ * Show plan approval prompt (replaces persistent-input, restores after)
145
+ * Used by canUseTool handler for ExitPlanMode tool
146
+ */
147
+ planApproval: (props: PlanApprovalProps) => Promise<PlanApprovalResult>;
148
+ /**
149
+ * Show feedback select prompt (select with inline text input option)
150
+ * Used for "yes/no with feedback" patterns
151
+ */
152
+ feedbackSelect: <T>(options: FeedbackSelectOptions<T>) => Promise<FeedbackSelectResult<T>>;
153
+ /**
154
+ * Start persistent input mode during agent execution
155
+ * Sets pendingItem to persistent-input type
156
+ */
157
+ startPersistentInput: (config: {
158
+ onSubmit: (message: string) => void;
159
+ onInterrupt: () => void;
160
+ onCtrlC?: () => void;
161
+ message?: string;
162
+ placeholder?: string;
163
+ }) => void;
164
+ /**
165
+ * Stop persistent input mode
166
+ * Clears pendingItem if it's persistent-input type
167
+ */
168
+ stopPersistentInput: () => void;
169
+ /**
170
+ * Update persistent input value
171
+ * Allows PersistentTextInput to preserve its state across unmount/remount
172
+ */
173
+ updatePersistentInputValue: (value: string) => void;
174
+ /**
175
+ * Update agent state
176
+ */
177
+ setAgentState: (state: Partial<AgentState>) => void;
178
+ }
179
+ /**
180
+ * Combined context type
181
+ */
182
+ export interface WizardContextType {
183
+ state: WizardState;
184
+ actions: WizardActions;
185
+ }
186
+ declare const WizardContext: React.Context<WizardContextType | null>;
187
+ /**
188
+ * Hook to access wizard state and actions
189
+ */
190
+ export declare function useWizard(): WizardContextType;
191
+ /**
192
+ * Hook to access just the wizard state
193
+ */
194
+ export declare function useWizardState(): WizardState;
195
+ /**
196
+ * Hook to access just the wizard actions
197
+ */
198
+ export declare function useWizardActions(): WizardActions;
199
+ /**
200
+ * Props for the WizardProvider
201
+ */
202
+ interface WizardProviderProps {
203
+ children: ReactNode;
204
+ onExit?: () => void;
205
+ }
206
+ /**
207
+ * Provider component that manages all wizard state
208
+ */
209
+ export declare function WizardProvider({ children, onExit, }: WizardProviderProps): React.ReactElement;
210
+ export { WizardContext };