@dexto/core 1.6.0 → 1.6.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 (79) hide show
  1. package/dist/agent/DextoAgent.cjs +25 -5
  2. package/dist/agent/DextoAgent.d.ts +12 -1
  3. package/dist/agent/DextoAgent.d.ts.map +1 -1
  4. package/dist/agent/DextoAgent.js +25 -5
  5. package/dist/agent/schemas.d.ts +18 -18
  6. package/dist/approval/manager.cjs +87 -27
  7. package/dist/approval/manager.d.ts +10 -1
  8. package/dist/approval/manager.d.ts.map +1 -1
  9. package/dist/approval/manager.js +87 -27
  10. package/dist/approval/schemas.cjs +22 -8
  11. package/dist/approval/schemas.d.ts +276 -102
  12. package/dist/approval/schemas.d.ts.map +1 -1
  13. package/dist/approval/schemas.js +22 -8
  14. package/dist/context/manager.cjs +2 -2
  15. package/dist/context/manager.d.ts +2 -1
  16. package/dist/context/manager.d.ts.map +1 -1
  17. package/dist/context/manager.js +2 -2
  18. package/dist/context/types.d.ts +3 -2
  19. package/dist/context/types.d.ts.map +1 -1
  20. package/dist/events/index.d.ts +17 -12
  21. package/dist/events/index.d.ts.map +1 -1
  22. package/dist/hooks/index.d.ts +1 -1
  23. package/dist/hooks/index.d.ts.map +1 -1
  24. package/dist/hooks/types.d.ts +1 -22
  25. package/dist/hooks/types.d.ts.map +1 -1
  26. package/dist/llm/executor/stream-processor.cjs +3 -3
  27. package/dist/llm/executor/stream-processor.d.ts +3 -2
  28. package/dist/llm/executor/stream-processor.d.ts.map +1 -1
  29. package/dist/llm/executor/stream-processor.js +3 -3
  30. package/dist/llm/executor/turn-executor.cjs +3 -3
  31. package/dist/llm/executor/turn-executor.d.ts +1 -1
  32. package/dist/llm/executor/turn-executor.d.ts.map +1 -1
  33. package/dist/llm/executor/turn-executor.js +3 -3
  34. package/dist/llm/providers/local/schemas.d.ts +2 -2
  35. package/dist/llm/schemas.d.ts +4 -4
  36. package/dist/llm/services/vercel.cjs +1 -1
  37. package/dist/llm/services/vercel.js +1 -1
  38. package/dist/logger/default-logger-factory.d.ts +12 -12
  39. package/dist/logger/v2/dexto-logger.cjs +35 -0
  40. package/dist/logger/v2/dexto-logger.d.ts +19 -0
  41. package/dist/logger/v2/dexto-logger.d.ts.map +1 -1
  42. package/dist/logger/v2/dexto-logger.js +35 -0
  43. package/dist/logger/v2/schemas.d.ts +6 -6
  44. package/dist/logger/v2/test-utils.cjs +2 -0
  45. package/dist/logger/v2/test-utils.d.ts.map +1 -1
  46. package/dist/logger/v2/test-utils.js +2 -0
  47. package/dist/logger/v2/types.d.ts +14 -1
  48. package/dist/logger/v2/types.d.ts.map +1 -1
  49. package/dist/mcp/schemas.d.ts +15 -15
  50. package/dist/memory/schemas.d.ts +4 -4
  51. package/dist/prompts/schemas.d.ts +7 -7
  52. package/dist/systemPrompt/in-built-prompts.cjs +5 -5
  53. package/dist/systemPrompt/in-built-prompts.d.ts +1 -1
  54. package/dist/systemPrompt/in-built-prompts.d.ts.map +1 -1
  55. package/dist/systemPrompt/in-built-prompts.js +5 -5
  56. package/dist/systemPrompt/schemas.d.ts +5 -5
  57. package/dist/systemPrompt/types.d.ts +11 -0
  58. package/dist/systemPrompt/types.d.ts.map +1 -1
  59. package/dist/tools/display-types.d.ts +10 -0
  60. package/dist/tools/display-types.d.ts.map +1 -1
  61. package/dist/tools/index.cjs +3 -1
  62. package/dist/tools/index.d.ts +1 -0
  63. package/dist/tools/index.d.ts.map +1 -1
  64. package/dist/tools/index.js +1 -0
  65. package/dist/tools/presentation.cjs +49 -0
  66. package/dist/tools/presentation.d.ts +11 -0
  67. package/dist/tools/presentation.d.ts.map +1 -0
  68. package/dist/tools/presentation.js +24 -0
  69. package/dist/tools/tool-manager.cjs +322 -155
  70. package/dist/tools/tool-manager.d.ts +23 -25
  71. package/dist/tools/tool-manager.d.ts.map +1 -1
  72. package/dist/tools/tool-manager.js +322 -155
  73. package/dist/tools/types.d.ts +134 -55
  74. package/dist/tools/types.d.ts.map +1 -1
  75. package/dist/utils/path.cjs +10 -1
  76. package/dist/utils/path.d.ts +5 -2
  77. package/dist/utils/path.d.ts.map +1 -1
  78. package/dist/utils/path.js +10 -1
  79. package/package.json +2 -2
@@ -86,24 +86,113 @@ export interface ToolExecutionContext extends ToolExecutionContextBase {
86
86
  export interface ToolExecutionResult {
87
87
  /** The actual result data from tool execution */
88
88
  result: unknown;
89
- /** Optional display name for the tool (UI convenience) */
90
- toolDisplayName?: string;
89
+ /** Optional UI-agnostic presentation snapshot for this call/result */
90
+ presentationSnapshot?: ToolPresentationSnapshotV1;
91
91
  /** Whether this tool required user approval before execution */
92
92
  requireApproval?: boolean;
93
93
  /** The approval status (only present if requireApproval is true) */
94
94
  approvalStatus?: 'approved' | 'rejected';
95
95
  }
96
+ /**
97
+ * UI-agnostic, runtime-computed presentation snapshot for tool calls/approvals/results.
98
+ *
99
+ * This is intended to decouple UIs (CLI/WebUI) from tool-specific heuristics (toolName parsing,
100
+ * hardcoded argument omission, etc.). It must remain:
101
+ * - JSON-serializable (plain objects/arrays/strings/numbers/booleans/null)
102
+ * - Optional everywhere (UIs MUST fall back to generic defaults when absent)
103
+ * - Forward-compatible (UIs MUST ignore unknown fields)
104
+ *
105
+ * SECURITY: Do not include secrets (tokens, full file contents, credentials). Prefer previews via
106
+ * {@link ToolDisplayData} for large content and rely on UIs to render those previews.
107
+ */
108
+ export type ToolPresentationSnapshotV1 = {
109
+ version: 1;
110
+ /** Optional source information (prevents UIs from parsing tool ids like `mcp--server--tool`). */
111
+ source?: {
112
+ type: 'local' | 'mcp';
113
+ mcpServerName?: string;
114
+ };
115
+ /** Optional one-line identity of the call (used for headers/timelines). */
116
+ header?: {
117
+ title?: string;
118
+ /**
119
+ * Pre-formatted one-line call detail shown in parentheses.
120
+ * Example: `Read(/path/to/file.ts)` where argsText is `/path/to/file.ts`.
121
+ */
122
+ argsText?: string;
123
+ };
124
+ /** Compact semantic tags. Use sparingly to avoid UI noise. */
125
+ chips?: Array<{
126
+ kind: 'neutral' | 'info' | 'warning' | 'danger' | 'success';
127
+ text: string;
128
+ }>;
129
+ /** Human-facing argument presentation. Prefer `display` over leaking raw values. */
130
+ args?: {
131
+ summary?: Array<{
132
+ label: string;
133
+ display: string;
134
+ kind?: 'path' | 'command' | 'url' | 'text' | 'json';
135
+ sensitive?: boolean;
136
+ }>;
137
+ groups?: Array<{
138
+ id: string;
139
+ label: string;
140
+ collapsedByDefault?: boolean;
141
+ items: Array<{
142
+ label: string;
143
+ display: string;
144
+ kind?: 'path' | 'command' | 'url' | 'text' | 'json';
145
+ sensitive?: boolean;
146
+ }>;
147
+ }>;
148
+ };
149
+ /** Optional capabilities that UIs may use to enable modes without toolName branching. */
150
+ capabilities?: string[];
151
+ /** Optional approval UX hints. If absent, UIs use their existing generic approval flows. */
152
+ approval?: {
153
+ actions?: Array<{
154
+ id: string;
155
+ label: string;
156
+ kind?: 'primary' | 'secondary' | 'danger';
157
+ responseData?: Record<string, unknown>;
158
+ uiEffects?: UiEffect[];
159
+ } | {
160
+ id: string;
161
+ label: string;
162
+ kind?: 'danger';
163
+ denyWithFeedback?: {
164
+ placeholder?: string;
165
+ messageTemplate?: string;
166
+ };
167
+ }>;
168
+ };
169
+ /** Optional post-result presentation and UI effects. */
170
+ result?: {
171
+ summaryText?: string;
172
+ uiEffects?: UiEffect[];
173
+ };
174
+ };
175
+ /**
176
+ * Optional, UI-local side effects driven by tool approvals/results.
177
+ *
178
+ * UIs MAY ignore these. They are intended to replace toolName-based UI logic (plan mode, accept
179
+ * edits mode, etc.) with declarative data.
180
+ */
181
+ export type UiEffect = {
182
+ type: 'setFlag';
183
+ flag: 'autoApproveEdits' | 'planModeActive' | 'planModeInitialized';
184
+ value: boolean;
185
+ } | {
186
+ type: 'toast';
187
+ kind: 'info' | 'warning' | 'success' | 'error';
188
+ message: string;
189
+ };
96
190
  /**
97
191
  * Tool interface - for tools implemented within Dexto
98
192
  */
99
193
  export interface Tool<TSchema extends ZodTypeAny = ZodTypeAny> {
100
194
  /** Unique identifier for the tool */
101
195
  id: string;
102
- /**
103
- * Short, user-facing name for this tool (UI convenience).
104
- * Defaults to a title-cased version of {@link id} when omitted.
105
- */
106
- displayName?: string | undefined;
107
196
  /** Human-readable description of what the tool does */
108
197
  description: string;
109
198
  /** Zod schema defining the input parameters */
@@ -111,11 +200,13 @@ export interface Tool<TSchema extends ZodTypeAny = ZodTypeAny> {
111
200
  /** The actual function that executes the tool - input is validated by Zod before execution */
112
201
  execute(input: z.output<TSchema>, context: ToolExecutionContext): Promise<unknown> | unknown;
113
202
  /**
114
- * Optional preview generator for approval UI.
115
- * Called before requesting user approval to generate display data (e.g., diff preview).
116
- * Returns null if no preview is available.
203
+ * Optional grouped approval-related behavior.
117
204
  */
118
- generatePreview?(input: z.output<TSchema>, context: ToolExecutionContext): Promise<ToolDisplayData | null>;
205
+ approval?: ToolApproval<TSchema> | undefined;
206
+ /**
207
+ * Optional grouped UI/presentation-related behavior.
208
+ */
209
+ presentation?: ToolPresentation<TSchema> | undefined;
119
210
  /**
120
211
  * Optional aliases for this tool id.
121
212
  *
@@ -124,64 +215,52 @@ export interface Tool<TSchema extends ZodTypeAny = ZodTypeAny> {
124
215
  * by {@link ToolManager} when applying session auto-approve lists.
125
216
  */
126
217
  aliases?: string[] | undefined;
218
+ }
219
+ export interface ToolApproval<TSchema extends ZodTypeAny = ZodTypeAny> {
220
+ override?(input: z.output<TSchema>, context: ToolExecutionContext): Promise<ApprovalRequestDetails | null> | ApprovalRequestDetails | null;
221
+ onGranted?(response: ApprovalResponse, context: ToolExecutionContext, approvalRequest: ApprovalRequestDetails): Promise<void> | void;
222
+ patternKey?(input: z.output<TSchema>): string | null;
223
+ suggestPatterns?(input: z.output<TSchema>): string[];
224
+ }
225
+ export interface ToolPresentation<TSchema extends ZodTypeAny = ZodTypeAny> {
127
226
  /**
128
- * Optional pattern key generator for approval memory.
129
- *
130
- * If provided, ToolManager will:
131
- * - Skip confirmation when the pattern key is covered by previously approved patterns.
132
- * - Offer suggested patterns (if {@link suggestApprovalPatterns} is provided) in the approval UI.
227
+ * Optional rich preview used in approval prompts.
133
228
  *
134
- * Return null to disable pattern approvals for the given input (e.g. dangerous commands).
229
+ * CLI example:
230
+ * - `edit_file` / `write_file`: shows a diff preview
231
+ * - `bash_exec`: shows a shell command preview
232
+ * - `plan_review`: shows the plan as a file preview
135
233
  */
136
- getApprovalPatternKey?(input: z.output<TSchema>): string | null;
234
+ preview?(input: z.output<TSchema>, context: ToolExecutionContext): Promise<ToolDisplayData | null> | ToolDisplayData | null;
137
235
  /**
138
- * Optional pattern suggestions for the approval UI.
236
+ * Describe the one-line tool call header for timelines and approval prompts.
139
237
  *
140
- * Returned patterns are shown as quick "remember pattern" options.
238
+ * CLI example:
239
+ * - Tool message header line: `Read(src/app.ts)`
240
+ * - Here: header.title = "Read", header.argsText = "src/app.ts"
141
241
  */
142
- suggestApprovalPatterns?(input: z.output<TSchema>): string[];
242
+ describeHeader?(input: z.output<TSchema>, context: ToolExecutionContext): Promise<ToolPresentationSnapshotV1['header'] | null> | ToolPresentationSnapshotV1['header'] | null;
143
243
  /**
144
- * Optional custom approval override.
145
- * If present and returns non-null, this approval request is used instead of
146
- * the default tool confirmation. Allows tools to request specialized approval
147
- * flows (e.g., directory access approval for file tools).
244
+ * Describe structured argument presentation for this tool call.
148
245
  *
149
- * @param input The validated input arguments for the tool
150
- * @returns ApprovalRequestDetails for custom approval, or null to use default tool confirmation
246
+ * Not currently rendered by the Ink CLI, but intended for future "expanded transcript"
247
+ * views (e.g. Ctrl+O to inspect call details) and WebUI.
151
248
  *
152
- * @example
153
- * ```typescript
154
- * // File tool requesting directory access approval for external paths
155
- * getApprovalOverride: async (input) => {
156
- * const filePath = (input as {file_path: string}).file_path;
157
- * if (!await isPathWithinAllowed(filePath)) {
158
- * return {
159
- * type: ApprovalType.DIRECTORY_ACCESS,
160
- * metadata: { path: filePath, operation: 'read', ... }
161
- * };
162
- * }
163
- * return null; // Use default tool confirmation
164
- * }
165
- * ```
249
+ * Example (expanded details):
250
+ * - label: "method", display: "POST"
251
+ * - label: "timeout", display: "30s"
166
252
  */
167
- getApprovalOverride?(input: z.output<TSchema>, context: ToolExecutionContext): Promise<ApprovalRequestDetails | null> | ApprovalRequestDetails | null;
253
+ describeArgs?(input: z.output<TSchema>, context: ToolExecutionContext): Promise<ToolPresentationSnapshotV1['args'] | null> | ToolPresentationSnapshotV1['args'] | null;
168
254
  /**
169
- * Optional callback invoked when custom approval is granted.
170
- * Allows tools to handle approval responses (e.g., remember approved directories).
171
- * Only called when getApprovalOverride returned non-null and approval was granted.
255
+ * Describe a short post-execution summary.
172
256
  *
173
- * @param response The approval response from ApprovalManager
257
+ * CLI example:
258
+ * - Tool result preview line (when supported): "Wrote 3 files" or "Request failed: 401"
174
259
  *
175
- * @example
176
- * ```typescript
177
- * onApprovalGranted: (response) => {
178
- * if (response.data?.rememberDirectory) {
179
- * directoryApproval.addApproved(parentDir, 'session');
180
- * }
181
- * }
182
- * ```
260
+ * Note: This does not change the tool's actual returned data; it only affects optional
261
+ * presentation metadata.
183
262
  */
184
- onApprovalGranted?(response: ApprovalResponse, context: ToolExecutionContext, approvalRequest: ApprovalRequestDetails): void;
263
+ describeResult?(result: unknown, input: z.output<TSchema>, context: ToolExecutionContext): Promise<ToolPresentationSnapshotV1['result'] | null> | ToolPresentationSnapshotV1['result'] | null;
185
264
  }
186
265
  /**
187
266
  * Standard tool set interface - used by AI/LLM services
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO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,GAClC,IAAI,CAAC;IAEX;;;;;;;;OAQG;IACH,cAAc,CAAC,CACX,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EACxB,OAAO,EAAE,oBAAoB,GAE3B,OAAO,CAAC,0BAA0B,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,GACpD,0BAA0B,CAAC,QAAQ,CAAC,GACpC,IAAI,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,WAAW,CAAC;QACxB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,CAAC;CACL;AAMD;;GAEG;AACH,MAAM,WAAW,UAAU;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/E"}
@@ -79,6 +79,15 @@ function getDextoPath(type, filename, startPath) {
79
79
  return filename ? path.join(basePath, filename) : basePath;
80
80
  }
81
81
  function getDextoGlobalPath(type, filename) {
82
+ const isDevMode = process.env.DEXTO_DEV_MODE === "true";
83
+ if (isDevMode && (0, import_execution_context.getExecutionContext)() === "dexto-source") {
84
+ const sourceRoot = (0, import_execution_context.findDextoSourceRoot)();
85
+ if (!sourceRoot) {
86
+ throw new Error("Not in dexto source context");
87
+ }
88
+ const devBasePath = path.join(sourceRoot, ".dexto", type);
89
+ return filename ? path.join(devBasePath, filename) : devBasePath;
90
+ }
82
91
  const basePath = path.join((0, import_os.homedir)(), ".dexto", type);
83
92
  return filename ? path.join(basePath, filename) : basePath;
84
93
  }
@@ -108,7 +117,7 @@ function findPackageRoot(startPath = process.cwd()) {
108
117
  });
109
118
  }
110
119
  async function ensureDextoGlobalDirectory() {
111
- const dextoDir = path.join((0, import_os.homedir)(), ".dexto");
120
+ const dextoDir = getDextoGlobalPath("");
112
121
  try {
113
122
  await import_fs2.promises.mkdir(dextoDir, { recursive: true });
114
123
  } catch (error) {
@@ -13,8 +13,11 @@ import type { Logger } from '../logger/v2/types.js';
13
13
  */
14
14
  export declare function getDextoPath(type: string, filename?: string, startPath?: string): string;
15
15
  /**
16
- * Global path resolver that ALWAYS returns paths in the user's home directory
17
- * Used for agent registry and other global-only resources that should not be project-relative
16
+ * Global path resolver for user-global resources that should not be project-relative.
17
+ *
18
+ * Dev mode support:
19
+ * - dexto-source + DEXTO_DEV_MODE=true: Use repo-local `.dexto` (isolated testing)
20
+ * - otherwise: Use global `~/.dexto` (user experience)
18
21
  * @param type Path type (agents, cache, etc.)
19
22
  * @param filename Optional filename to append
20
23
  * @returns Absolute path to the global location (~/.dexto/...)
@@ -1 +1 @@
1
- {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/utils/path.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAuCxF;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAI1E;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,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AC,EAAE,MAAM,GAAG,MAAM,CAkC1F"}
@@ -45,6 +45,15 @@ function getDextoPath(type, filename, startPath) {
45
45
  return filename ? path.join(basePath, filename) : basePath;
46
46
  }
47
47
  function getDextoGlobalPath(type, filename) {
48
+ const isDevMode = process.env.DEXTO_DEV_MODE === "true";
49
+ if (isDevMode && getExecutionContext() === "dexto-source") {
50
+ const sourceRoot = findDextoSourceRoot();
51
+ if (!sourceRoot) {
52
+ throw new Error("Not in dexto source context");
53
+ }
54
+ const devBasePath = path.join(sourceRoot, ".dexto", type);
55
+ return filename ? path.join(devBasePath, filename) : devBasePath;
56
+ }
48
57
  const basePath = path.join(homedir(), ".dexto", type);
49
58
  return filename ? path.join(basePath, filename) : basePath;
50
59
  }
@@ -74,7 +83,7 @@ function findPackageRoot(startPath = process.cwd()) {
74
83
  });
75
84
  }
76
85
  async function ensureDextoGlobalDirectory() {
77
- const dextoDir = path.join(homedir(), ".dexto");
86
+ const dextoDir = getDextoGlobalPath("");
78
87
  try {
79
88
  await fs.mkdir(dextoDir, { recursive: true });
80
89
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dexto/core",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -123,7 +123,7 @@
123
123
  },
124
124
  "sideEffects": false,
125
125
  "scripts": {
126
- "build": "cross-env NODE_OPTIONS='--max-old-space-size=4096' tsup && cross-env NODE_OPTIONS='--max-old-space-size=4096' tsc -b tsconfig.json --force --emitDeclarationOnly",
126
+ "build": "cross-env NODE_OPTIONS='--max-old-space-size=4096' tsup && node ../../scripts/clean-tsbuildinfo.mjs && cross-env NODE_OPTIONS='--max-old-space-size=4096' tsc -b tsconfig.json --emitDeclarationOnly",
127
127
  "dev": "tsup --watch",
128
128
  "typecheck": "tsc -p tsconfig.typecheck.json --noEmit",
129
129
  "lint": "eslint . --ext .ts"