@easbot/utils 0.2.11 → 0.2.14

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.cts CHANGED
@@ -68,6 +68,14 @@ declare namespace TruncateContent {
68
68
  function formatHint(result: Result): string;
69
69
  }
70
70
 
71
+ declare namespace SessionTitle {
72
+ const parentTitlePrefix = "New session - ";
73
+ const childTitlePrefix = "Child session - ";
74
+ function createDefault(isChild?: boolean): string;
75
+ function isDefault(title: string): boolean;
76
+ function getForked(title: string): string;
77
+ }
78
+
71
79
  interface ShellItem {
72
80
  path: string;
73
81
  name: string;
@@ -131,10 +139,13 @@ declare namespace Shell {
131
139
  signal?: AbortSignal;
132
140
  windowsHide?: boolean;
133
141
  shell?: boolean;
142
+ stdin?: 'null' | 'pipe';
143
+ stdout?: 'pipe' | 'ignore';
144
+ stderr?: 'pipe' | 'ignore';
134
145
  }
135
- interface SpawnOptions extends RunOptions {
136
- stdout?: 'pipe' | 'inherit' | 'null';
137
- stderr?: 'pipe' | 'inherit' | 'null';
146
+ interface SpawnOptions extends Omit<RunOptions, 'stdin' | 'stdout' | 'stderr'> {
147
+ stdout?: 'pipe' | 'inherit' | 'null' | 'ignore';
148
+ stderr?: 'pipe' | 'inherit' | 'null' | 'ignore';
138
149
  stdin?: 'pipe' | 'inherit' | 'null';
139
150
  }
140
151
  function run(shell: string | undefined, command: string, options?: RunOptions): Promise<{
@@ -155,12 +166,20 @@ declare namespace Shell {
155
166
  quiet?: boolean;
156
167
  nothrow?: boolean;
157
168
  env?: Record<string, string | undefined>;
169
+ stdin?: 'null' | 'pipe';
170
+ stdout?: 'pipe' | 'ignore';
171
+ stderr?: 'pipe' | 'ignore';
172
+ windowsHide?: boolean;
173
+ shell?: boolean;
158
174
  }
159
175
  function $(strings: TemplateStringsArray, ...values: unknown[]): {
160
176
  quiet: () => any;
161
177
  nothrow: () => any;
162
178
  cwd: (dir: string) => any;
163
179
  env: (env: Record<string, string | undefined>) => any;
180
+ stdin: (stdin: "null" | "pipe") => any;
181
+ stdout: (stdout: "pipe" | "ignore") => any;
182
+ stderr: (stderr: "pipe" | "ignore") => any;
164
183
  text: () => Promise<string>;
165
184
  lines: () => Promise<string[]>;
166
185
  then: (onfulfilled: (result: {
@@ -360,6 +379,7 @@ declare abstract class NamedError extends Error {
360
379
  };
361
380
  }
362
381
 
382
+ declare const MIME_TYPES: Record<string, string>;
363
383
  declare namespace Filesystem {
364
384
  function mkdir(p: string, options?: {
365
385
  recursive?: boolean;
@@ -376,10 +396,14 @@ declare namespace Filesystem {
376
396
  function writeJson(p: string, data: unknown, mode?: number): Promise<void>;
377
397
  function writeStream(p: string, stream: ReadableStream<Uint8Array> | Readable, mode?: number): Promise<void>;
378
398
  function mimeType(p: string): string;
399
+ function dirname(p: string): string;
400
+ function basename(p: string, ext?: string): string;
401
+ function extname(p: string): string;
379
402
  function toUnixPath(p: string): string;
380
403
  function normalize(p: string): string;
381
- const normalizePath: typeof normalize;
382
404
  function resolve(p: string): string;
405
+ function isAbsolute(p: string): boolean;
406
+ function join(base: string, ...paths: string[]): string;
383
407
  function windowsPath(p: string): string;
384
408
  function overlaps(a: string, b: string): boolean;
385
409
  function contains(parent: string, child: string): boolean;
@@ -880,8 +904,8 @@ interface NodeWhichOptions {
880
904
  interface NodeSpawnOptions {
881
905
  cwd?: string;
882
906
  env?: Record<string, string | undefined>;
883
- stdout?: 'pipe' | 'inherit' | 'null';
884
- stderr?: 'pipe' | 'inherit' | 'null';
907
+ stdout?: 'pipe' | 'inherit' | 'null' | 'ignore';
908
+ stderr?: 'pipe' | 'inherit' | 'null' | 'ignore';
885
909
  stdin?: 'pipe' | 'inherit' | 'null';
886
910
  signal?: AbortSignal;
887
911
  timeout?: number | false;
@@ -892,8 +916,8 @@ interface NodeSpawnObjectArgs {
892
916
  cmd: string[];
893
917
  cwd?: string;
894
918
  env?: Record<string, string | undefined>;
895
- stdout?: 'pipe' | 'inherit' | 'null';
896
- stderr?: 'pipe' | 'inherit' | 'null';
919
+ stdout?: 'pipe' | 'inherit' | 'null' | 'ignore';
920
+ stderr?: 'pipe' | 'inherit' | 'null' | 'ignore';
897
921
  stdin?: 'pipe' | 'inherit' | 'null';
898
922
  signal?: AbortSignal;
899
923
  timeout?: number | false;
@@ -948,6 +972,9 @@ declare namespace PKG {
948
972
  timeout?: number;
949
973
  windowsHide?: boolean;
950
974
  shell?: boolean;
975
+ stdin?: 'null' | 'pipe';
976
+ stdout?: 'pipe' | 'ignore';
977
+ stderr?: 'pipe' | 'ignore';
951
978
  }): Promise<{
952
979
  code: number;
953
980
  stdout: string;
@@ -1215,4 +1242,4 @@ declare function initLog(options: {
1215
1242
  level?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
1216
1243
  }): Promise<void>;
1217
1244
 
1218
- export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, type EasServer, Encode, EventLoop, type FenceSpan$1 as FenceSpan, Filesystem, Fn, type FormatOptions, type GitResult, Glob, Identifier, Ignore, type InlineCodeState$1 as InlineCodeState, Keybind, Lazy, Locale, Lock, Markdown, type MarkdownConfig, type MarkdownIR, type MarkdownLinkSpan, type MarkdownParseOptions, type MarkdownStyle, type MarkdownStyleSpan, type MarkdownTableMode, type MiddlewareDefinition, NamedError, type NodeSpawnObjectArgs, type NodeSpawnOptions, type NodeSpawnResult, type NodeWhichOptions, PKG, PackageRegistry, type ParseCommandResult, type ParsedFrontmatter, type ParsedVersion, PkgShell, type RPCMethod, type RenderLink, type RenderOptions, type RouteDefinition, type SSEHandler, Semver, type ServerOptions, Shell, Slug, type StreamHandler, type StyleMarker, Token, TruncateContent, type WebSocketHandler, type WebSocketRouteDefinition, Wildcard, abortAfter, abortAfterAny, buildCodeSpanIndex, chunkMarkdownIR, chunkText, chunkTextByBreakResolver, convertMarkdownTables, createInlineCodeState, createPkgShell, createRESTServer, createRPCServer, createServer, createStreamingServer, createWebSocketServer, defer, detectPlatform, escapeCommandArg, escapeCommandArgSafe, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getTimezoneOffset, git, iife, initLog, isSafeFenceBreak, joinCommandArgs, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, needsShellExecution, now, nowLocalISO, parseCommand, parseCommandWithOptions, parseFenceSpans, parseFrontmatterBlock, parseLocalISO, parseModelId, proxied, readableStreamToText, renderMarkdown, renderMarkdownWithMarkers, retry, scanParenAwareBreakpoints, serializeFrontmatter, shell, signal, startServer, truncateMiddle, updateSchema, whichSync, withTimeout, work };
1245
+ export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, type EasServer, Encode, EventLoop, type FenceSpan$1 as FenceSpan, Filesystem, Fn, type FormatOptions, type GitResult, Glob, Identifier, Ignore, type InlineCodeState$1 as InlineCodeState, Keybind, Lazy, Locale, Lock, MIME_TYPES, Markdown, type MarkdownConfig, type MarkdownIR, type MarkdownLinkSpan, type MarkdownParseOptions, type MarkdownStyle, type MarkdownStyleSpan, type MarkdownTableMode, type MiddlewareDefinition, NamedError, type NodeSpawnObjectArgs, type NodeSpawnOptions, type NodeSpawnResult, type NodeWhichOptions, PKG, PackageRegistry, type ParseCommandResult, type ParsedFrontmatter, type ParsedVersion, PkgShell, type RPCMethod, type RenderLink, type RenderOptions, type RouteDefinition, type SSEHandler, Semver, type ServerOptions, SessionTitle, Shell, Slug, type StreamHandler, type StyleMarker, Token, TruncateContent, type WebSocketHandler, type WebSocketRouteDefinition, Wildcard, abortAfter, abortAfterAny, buildCodeSpanIndex, chunkMarkdownIR, chunkText, chunkTextByBreakResolver, convertMarkdownTables, createInlineCodeState, createPkgShell, createRESTServer, createRPCServer, createServer, createStreamingServer, createWebSocketServer, defer, detectPlatform, escapeCommandArg, escapeCommandArgSafe, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getTimezoneOffset, git, iife, initLog, isSafeFenceBreak, joinCommandArgs, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, needsShellExecution, now, nowLocalISO, parseCommand, parseCommandWithOptions, parseFenceSpans, parseFrontmatterBlock, parseLocalISO, parseModelId, proxied, readableStreamToText, renderMarkdown, renderMarkdownWithMarkers, retry, scanParenAwareBreakpoints, serializeFrontmatter, shell, signal, startServer, truncateMiddle, updateSchema, whichSync, withTimeout, work };
package/dist/index.d.ts CHANGED
@@ -68,6 +68,14 @@ declare namespace TruncateContent {
68
68
  function formatHint(result: Result): string;
69
69
  }
70
70
 
71
+ declare namespace SessionTitle {
72
+ const parentTitlePrefix = "New session - ";
73
+ const childTitlePrefix = "Child session - ";
74
+ function createDefault(isChild?: boolean): string;
75
+ function isDefault(title: string): boolean;
76
+ function getForked(title: string): string;
77
+ }
78
+
71
79
  interface ShellItem {
72
80
  path: string;
73
81
  name: string;
@@ -131,10 +139,13 @@ declare namespace Shell {
131
139
  signal?: AbortSignal;
132
140
  windowsHide?: boolean;
133
141
  shell?: boolean;
142
+ stdin?: 'null' | 'pipe';
143
+ stdout?: 'pipe' | 'ignore';
144
+ stderr?: 'pipe' | 'ignore';
134
145
  }
135
- interface SpawnOptions extends RunOptions {
136
- stdout?: 'pipe' | 'inherit' | 'null';
137
- stderr?: 'pipe' | 'inherit' | 'null';
146
+ interface SpawnOptions extends Omit<RunOptions, 'stdin' | 'stdout' | 'stderr'> {
147
+ stdout?: 'pipe' | 'inherit' | 'null' | 'ignore';
148
+ stderr?: 'pipe' | 'inherit' | 'null' | 'ignore';
138
149
  stdin?: 'pipe' | 'inherit' | 'null';
139
150
  }
140
151
  function run(shell: string | undefined, command: string, options?: RunOptions): Promise<{
@@ -155,12 +166,20 @@ declare namespace Shell {
155
166
  quiet?: boolean;
156
167
  nothrow?: boolean;
157
168
  env?: Record<string, string | undefined>;
169
+ stdin?: 'null' | 'pipe';
170
+ stdout?: 'pipe' | 'ignore';
171
+ stderr?: 'pipe' | 'ignore';
172
+ windowsHide?: boolean;
173
+ shell?: boolean;
158
174
  }
159
175
  function $(strings: TemplateStringsArray, ...values: unknown[]): {
160
176
  quiet: () => any;
161
177
  nothrow: () => any;
162
178
  cwd: (dir: string) => any;
163
179
  env: (env: Record<string, string | undefined>) => any;
180
+ stdin: (stdin: "null" | "pipe") => any;
181
+ stdout: (stdout: "pipe" | "ignore") => any;
182
+ stderr: (stderr: "pipe" | "ignore") => any;
164
183
  text: () => Promise<string>;
165
184
  lines: () => Promise<string[]>;
166
185
  then: (onfulfilled: (result: {
@@ -360,6 +379,7 @@ declare abstract class NamedError extends Error {
360
379
  };
361
380
  }
362
381
 
382
+ declare const MIME_TYPES: Record<string, string>;
363
383
  declare namespace Filesystem {
364
384
  function mkdir(p: string, options?: {
365
385
  recursive?: boolean;
@@ -376,10 +396,14 @@ declare namespace Filesystem {
376
396
  function writeJson(p: string, data: unknown, mode?: number): Promise<void>;
377
397
  function writeStream(p: string, stream: ReadableStream<Uint8Array> | Readable, mode?: number): Promise<void>;
378
398
  function mimeType(p: string): string;
399
+ function dirname(p: string): string;
400
+ function basename(p: string, ext?: string): string;
401
+ function extname(p: string): string;
379
402
  function toUnixPath(p: string): string;
380
403
  function normalize(p: string): string;
381
- const normalizePath: typeof normalize;
382
404
  function resolve(p: string): string;
405
+ function isAbsolute(p: string): boolean;
406
+ function join(base: string, ...paths: string[]): string;
383
407
  function windowsPath(p: string): string;
384
408
  function overlaps(a: string, b: string): boolean;
385
409
  function contains(parent: string, child: string): boolean;
@@ -880,8 +904,8 @@ interface NodeWhichOptions {
880
904
  interface NodeSpawnOptions {
881
905
  cwd?: string;
882
906
  env?: Record<string, string | undefined>;
883
- stdout?: 'pipe' | 'inherit' | 'null';
884
- stderr?: 'pipe' | 'inherit' | 'null';
907
+ stdout?: 'pipe' | 'inherit' | 'null' | 'ignore';
908
+ stderr?: 'pipe' | 'inherit' | 'null' | 'ignore';
885
909
  stdin?: 'pipe' | 'inherit' | 'null';
886
910
  signal?: AbortSignal;
887
911
  timeout?: number | false;
@@ -892,8 +916,8 @@ interface NodeSpawnObjectArgs {
892
916
  cmd: string[];
893
917
  cwd?: string;
894
918
  env?: Record<string, string | undefined>;
895
- stdout?: 'pipe' | 'inherit' | 'null';
896
- stderr?: 'pipe' | 'inherit' | 'null';
919
+ stdout?: 'pipe' | 'inherit' | 'null' | 'ignore';
920
+ stderr?: 'pipe' | 'inherit' | 'null' | 'ignore';
897
921
  stdin?: 'pipe' | 'inherit' | 'null';
898
922
  signal?: AbortSignal;
899
923
  timeout?: number | false;
@@ -948,6 +972,9 @@ declare namespace PKG {
948
972
  timeout?: number;
949
973
  windowsHide?: boolean;
950
974
  shell?: boolean;
975
+ stdin?: 'null' | 'pipe';
976
+ stdout?: 'pipe' | 'ignore';
977
+ stderr?: 'pipe' | 'ignore';
951
978
  }): Promise<{
952
979
  code: number;
953
980
  stdout: string;
@@ -1215,4 +1242,4 @@ declare function initLog(options: {
1215
1242
  level?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
1216
1243
  }): Promise<void>;
1217
1244
 
1218
- export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, type EasServer, Encode, EventLoop, type FenceSpan$1 as FenceSpan, Filesystem, Fn, type FormatOptions, type GitResult, Glob, Identifier, Ignore, type InlineCodeState$1 as InlineCodeState, Keybind, Lazy, Locale, Lock, Markdown, type MarkdownConfig, type MarkdownIR, type MarkdownLinkSpan, type MarkdownParseOptions, type MarkdownStyle, type MarkdownStyleSpan, type MarkdownTableMode, type MiddlewareDefinition, NamedError, type NodeSpawnObjectArgs, type NodeSpawnOptions, type NodeSpawnResult, type NodeWhichOptions, PKG, PackageRegistry, type ParseCommandResult, type ParsedFrontmatter, type ParsedVersion, PkgShell, type RPCMethod, type RenderLink, type RenderOptions, type RouteDefinition, type SSEHandler, Semver, type ServerOptions, Shell, Slug, type StreamHandler, type StyleMarker, Token, TruncateContent, type WebSocketHandler, type WebSocketRouteDefinition, Wildcard, abortAfter, abortAfterAny, buildCodeSpanIndex, chunkMarkdownIR, chunkText, chunkTextByBreakResolver, convertMarkdownTables, createInlineCodeState, createPkgShell, createRESTServer, createRPCServer, createServer, createStreamingServer, createWebSocketServer, defer, detectPlatform, escapeCommandArg, escapeCommandArgSafe, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getTimezoneOffset, git, iife, initLog, isSafeFenceBreak, joinCommandArgs, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, needsShellExecution, now, nowLocalISO, parseCommand, parseCommandWithOptions, parseFenceSpans, parseFrontmatterBlock, parseLocalISO, parseModelId, proxied, readableStreamToText, renderMarkdown, renderMarkdownWithMarkers, retry, scanParenAwareBreakpoints, serializeFrontmatter, shell, signal, startServer, truncateMiddle, updateSchema, whichSync, withTimeout, work };
1245
+ export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, type EasServer, Encode, EventLoop, type FenceSpan$1 as FenceSpan, Filesystem, Fn, type FormatOptions, type GitResult, Glob, Identifier, Ignore, type InlineCodeState$1 as InlineCodeState, Keybind, Lazy, Locale, Lock, MIME_TYPES, Markdown, type MarkdownConfig, type MarkdownIR, type MarkdownLinkSpan, type MarkdownParseOptions, type MarkdownStyle, type MarkdownStyleSpan, type MarkdownTableMode, type MiddlewareDefinition, NamedError, type NodeSpawnObjectArgs, type NodeSpawnOptions, type NodeSpawnResult, type NodeWhichOptions, PKG, PackageRegistry, type ParseCommandResult, type ParsedFrontmatter, type ParsedVersion, PkgShell, type RPCMethod, type RenderLink, type RenderOptions, type RouteDefinition, type SSEHandler, Semver, type ServerOptions, SessionTitle, Shell, Slug, type StreamHandler, type StyleMarker, Token, TruncateContent, type WebSocketHandler, type WebSocketRouteDefinition, Wildcard, abortAfter, abortAfterAny, buildCodeSpanIndex, chunkMarkdownIR, chunkText, chunkTextByBreakResolver, convertMarkdownTables, createInlineCodeState, createPkgShell, createRESTServer, createRPCServer, createServer, createStreamingServer, createWebSocketServer, defer, detectPlatform, escapeCommandArg, escapeCommandArgSafe, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getTimezoneOffset, git, iife, initLog, isSafeFenceBreak, joinCommandArgs, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, needsShellExecution, now, nowLocalISO, parseCommand, parseCommandWithOptions, parseFenceSpans, parseFrontmatterBlock, parseLocalISO, parseModelId, proxied, readableStreamToText, renderMarkdown, renderMarkdownWithMarkers, retry, scanParenAwareBreakpoints, serializeFrontmatter, shell, signal, startServer, truncateMiddle, updateSchema, whichSync, withTimeout, work };