@easbot/utils 0.1.13 → 0.1.15
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/README.en.md +55 -0
- package/README.md +12 -76
- package/dist/chunks/{chunk-JRBFY3PQ.mjs → chunk-6MVBFBWB.mjs} +5 -5
- package/dist/chunks/chunk-NLA2YMCP.cjs +8 -0
- package/dist/chunks/{chunk-PQC2BFS2.cjs → chunk-QBAJWPDZ.cjs} +1 -1
- package/dist/chunks/log-AZVZ5SH5.cjs +1 -0
- package/dist/chunks/log-OSKSGVSM.mjs +1 -0
- package/dist/chunks/{main-BW4T3DHC.cjs → main-3BSIJH3A.cjs} +4 -4
- package/dist/index.cjs +37 -33
- package/dist/index.d.cts +54 -14
- package/dist/index.d.ts +54 -14
- package/dist/index.mjs +34 -30
- package/package.json +31 -19
- package/dist/chunks/chunk-PQ3EETPA.cjs +0 -8
- package/dist/chunks/log-S3VOL35O.mjs +0 -1
- package/dist/chunks/log-YI7B3XJ6.cjs +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import z, { z as z$1 } from 'zod';
|
|
2
2
|
export { z } from 'zod';
|
|
3
|
-
import
|
|
4
|
-
import { statSync } from 'fs';
|
|
3
|
+
import { statSync } from 'node:fs';
|
|
5
4
|
import * as stream from 'stream';
|
|
6
5
|
import { Readable } from 'stream';
|
|
7
6
|
import * as _hono_node_ws from '@hono/node-ws';
|
|
8
7
|
export { createNodeWebSocket } from '@hono/node-ws';
|
|
8
|
+
import * as fs from 'fs';
|
|
9
9
|
import { Context as Context$1, Next, Hono } from 'hono';
|
|
10
10
|
export { Hono, Next } from 'hono';
|
|
11
11
|
import { ServerType } from '@hono/node-server';
|
|
12
12
|
import { cors } from 'hono/cors';
|
|
13
13
|
export { cors } from 'hono/cors';
|
|
14
|
+
import { GlobOptions } from 'glob';
|
|
14
15
|
import { ChildProcess } from 'node:child_process';
|
|
15
|
-
import { EasbotShell, ShellExpression, EasbotShellPromise } from '@easbot/types';
|
|
16
16
|
export { HTTPException } from 'hono/http-exception';
|
|
17
|
+
import { ShellExpression, EasbotShellPromise, EasbotShell } from '@easbot/types';
|
|
17
18
|
export { SSEStreamingApi } from 'hono/streaming';
|
|
18
19
|
export { WebSocket as WSContext } from 'ws';
|
|
19
20
|
export { compress } from 'hono/compress';
|
|
@@ -255,6 +256,9 @@ declare abstract class NamedError extends Error {
|
|
|
255
256
|
}
|
|
256
257
|
|
|
257
258
|
declare namespace Filesystem {
|
|
259
|
+
function mkdir(p: string, options?: {
|
|
260
|
+
recursive?: boolean;
|
|
261
|
+
}): Promise<void>;
|
|
258
262
|
function exists(p: string): Promise<boolean>;
|
|
259
263
|
function isDir(p: string): Promise<boolean>;
|
|
260
264
|
function stat(p: string): ReturnType<typeof statSync> | undefined;
|
|
@@ -296,12 +300,6 @@ declare namespace Fn {
|
|
|
296
300
|
|
|
297
301
|
declare function loadEnv(): void;
|
|
298
302
|
|
|
299
|
-
declare namespace Identifier {
|
|
300
|
-
function ascending(): string;
|
|
301
|
-
function descending(): string;
|
|
302
|
-
function create(descending: boolean, timestamp?: number): string;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
303
|
interface GitResult {
|
|
306
304
|
exitCode: number;
|
|
307
305
|
text(): string | Promise<string>;
|
|
@@ -501,7 +499,9 @@ declare function scanParenAwareBreakpoints(text: string, start: number, end: num
|
|
|
501
499
|
lastNewline: number;
|
|
502
500
|
lastWhitespace: number;
|
|
503
501
|
};
|
|
504
|
-
declare function chunkText(text: string, limit: number
|
|
502
|
+
declare function chunkText(text: string, limit: number, options?: {
|
|
503
|
+
minLength?: number;
|
|
504
|
+
}): string[];
|
|
505
505
|
declare function chunkTextByBreakResolver(text: string, limit: number, resolveBreakIndex: (window: string) => number): string[];
|
|
506
506
|
|
|
507
507
|
type InlineCodeState = {
|
|
@@ -538,7 +538,9 @@ declare namespace Markdown {
|
|
|
538
538
|
frontmatter: ParsedFrontmatter;
|
|
539
539
|
content: string;
|
|
540
540
|
};
|
|
541
|
-
function chunk(text: string, limit: number
|
|
541
|
+
function chunk(text: string, limit: number, options?: {
|
|
542
|
+
minLength?: number;
|
|
543
|
+
}): string[];
|
|
542
544
|
function buildCodeIndex(text: string, inlineState?: InlineCodeState$1): CodeSpanIndex$1;
|
|
543
545
|
function convertTables(markdown: string, tableMode: MarkdownTableMode): string;
|
|
544
546
|
}
|
|
@@ -713,7 +715,7 @@ declare class PkgShell {
|
|
|
713
715
|
throws(shouldThrow: boolean): EasbotShell;
|
|
714
716
|
}
|
|
715
717
|
declare function createPkgShell(options?: ShellOptions): EasbotShell;
|
|
716
|
-
declare const
|
|
718
|
+
declare const shell: EasbotShell;
|
|
717
719
|
|
|
718
720
|
interface NodeWhichOptions {
|
|
719
721
|
PATH?: string;
|
|
@@ -1111,6 +1113,39 @@ declare const $: typeof PKG.$;
|
|
|
1111
1113
|
declare const readableStreamToText: typeof PKG.readableStreamToText;
|
|
1112
1114
|
declare const whichSync: typeof PKG.whichSync;
|
|
1113
1115
|
|
|
1116
|
+
declare namespace PackageRegistry {
|
|
1117
|
+
function info(pkg: string, field: string, cwd?: string): Promise<string | null>;
|
|
1118
|
+
function isOutdated(pkg: string, cachedVersion: string, cwd?: string): Promise<boolean>;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
declare namespace Identifier {
|
|
1122
|
+
const prefixes: {
|
|
1123
|
+
readonly event: "evt";
|
|
1124
|
+
readonly session: "ses";
|
|
1125
|
+
readonly message: "msg";
|
|
1126
|
+
readonly permission: "per";
|
|
1127
|
+
readonly question: "que";
|
|
1128
|
+
readonly user: "usr";
|
|
1129
|
+
readonly part: "prt";
|
|
1130
|
+
readonly pty: "pty";
|
|
1131
|
+
readonly tool: "tool";
|
|
1132
|
+
readonly workspace: "wrk";
|
|
1133
|
+
readonly command: "cmd";
|
|
1134
|
+
readonly task: "task";
|
|
1135
|
+
readonly heartbeat: "hb";
|
|
1136
|
+
readonly subagent: "sub";
|
|
1137
|
+
readonly hook: "hok";
|
|
1138
|
+
readonly compaction: "cmp";
|
|
1139
|
+
readonly context: "ctx";
|
|
1140
|
+
};
|
|
1141
|
+
export function schema(prefix: keyof typeof prefixes): z.ZodString;
|
|
1142
|
+
export function ascending(prefix: keyof typeof prefixes, given?: string): string;
|
|
1143
|
+
export function descending(prefix: keyof typeof prefixes, given?: string): string;
|
|
1144
|
+
export function create(prefix: keyof typeof prefixes, descending: boolean, timestamp?: number): string;
|
|
1145
|
+
export function timestamp(id: string): number;
|
|
1146
|
+
export { };
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1114
1149
|
declare function abortAfter(ms: number): {
|
|
1115
1150
|
controller: AbortController;
|
|
1116
1151
|
signal: AbortSignal;
|
|
@@ -1159,16 +1194,21 @@ declare namespace EventLoop {
|
|
|
1159
1194
|
declare function formatDuration(secs: number): string;
|
|
1160
1195
|
|
|
1161
1196
|
declare namespace Glob {
|
|
1162
|
-
interface Options {
|
|
1197
|
+
interface Options extends GlobOptions {
|
|
1163
1198
|
cwd?: string;
|
|
1164
1199
|
absolute?: boolean;
|
|
1165
1200
|
include?: 'file' | 'all';
|
|
1166
1201
|
dot?: boolean;
|
|
1167
1202
|
symlink?: boolean;
|
|
1203
|
+
ignore?: string[];
|
|
1168
1204
|
}
|
|
1169
1205
|
function scan(pattern: string, options?: Options): Promise<string[]>;
|
|
1170
1206
|
function scanSync(pattern: string, options?: Options): string[];
|
|
1171
1207
|
function match(pattern: string, filepath: string): boolean;
|
|
1208
|
+
function parseGitignore(gitignorePath: string): Promise<string[]>;
|
|
1209
|
+
function parseGitignoreContent(content: string): string[];
|
|
1210
|
+
function isIgnored(filepath: string, patterns: string[]): boolean;
|
|
1211
|
+
const DEFAULT_IGNORE_PATTERNS: string[];
|
|
1172
1212
|
}
|
|
1173
1213
|
|
|
1174
1214
|
declare namespace Keybind {
|
|
@@ -1303,4 +1343,4 @@ declare function initLog(options: {
|
|
|
1303
1343
|
level?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
|
|
1304
1344
|
}): Promise<void>;
|
|
1305
1345
|
|
|
1306
|
-
export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, type EasServer,
|
|
1346
|
+
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, 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 ParsedFrontmatter, PkgShell, Process, type RPCMethod, type RenderLink, type RenderOptions, type RouteDefinition, type SSEHandler, type ServerOptions, 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, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getTimezoneOffset, git, iife, initLog, isSafeFenceBreak, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, now, nowLocalISO, 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
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import z, { z as z$1 } from 'zod';
|
|
2
2
|
export { z } from 'zod';
|
|
3
|
-
import
|
|
4
|
-
import { statSync } from 'fs';
|
|
3
|
+
import { statSync } from 'node:fs';
|
|
5
4
|
import * as stream from 'stream';
|
|
6
5
|
import { Readable } from 'stream';
|
|
7
6
|
import * as _hono_node_ws from '@hono/node-ws';
|
|
8
7
|
export { createNodeWebSocket } from '@hono/node-ws';
|
|
8
|
+
import * as fs from 'fs';
|
|
9
9
|
import { Context as Context$1, Next, Hono } from 'hono';
|
|
10
10
|
export { Hono, Next } from 'hono';
|
|
11
11
|
import { ServerType } from '@hono/node-server';
|
|
12
12
|
import { cors } from 'hono/cors';
|
|
13
13
|
export { cors } from 'hono/cors';
|
|
14
|
+
import { GlobOptions } from 'glob';
|
|
14
15
|
import { ChildProcess } from 'node:child_process';
|
|
15
|
-
import { EasbotShell, ShellExpression, EasbotShellPromise } from '@easbot/types';
|
|
16
16
|
export { HTTPException } from 'hono/http-exception';
|
|
17
|
+
import { ShellExpression, EasbotShellPromise, EasbotShell } from '@easbot/types';
|
|
17
18
|
export { SSEStreamingApi } from 'hono/streaming';
|
|
18
19
|
export { WebSocket as WSContext } from 'ws';
|
|
19
20
|
export { compress } from 'hono/compress';
|
|
@@ -255,6 +256,9 @@ declare abstract class NamedError extends Error {
|
|
|
255
256
|
}
|
|
256
257
|
|
|
257
258
|
declare namespace Filesystem {
|
|
259
|
+
function mkdir(p: string, options?: {
|
|
260
|
+
recursive?: boolean;
|
|
261
|
+
}): Promise<void>;
|
|
258
262
|
function exists(p: string): Promise<boolean>;
|
|
259
263
|
function isDir(p: string): Promise<boolean>;
|
|
260
264
|
function stat(p: string): ReturnType<typeof statSync> | undefined;
|
|
@@ -296,12 +300,6 @@ declare namespace Fn {
|
|
|
296
300
|
|
|
297
301
|
declare function loadEnv(): void;
|
|
298
302
|
|
|
299
|
-
declare namespace Identifier {
|
|
300
|
-
function ascending(): string;
|
|
301
|
-
function descending(): string;
|
|
302
|
-
function create(descending: boolean, timestamp?: number): string;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
303
|
interface GitResult {
|
|
306
304
|
exitCode: number;
|
|
307
305
|
text(): string | Promise<string>;
|
|
@@ -501,7 +499,9 @@ declare function scanParenAwareBreakpoints(text: string, start: number, end: num
|
|
|
501
499
|
lastNewline: number;
|
|
502
500
|
lastWhitespace: number;
|
|
503
501
|
};
|
|
504
|
-
declare function chunkText(text: string, limit: number
|
|
502
|
+
declare function chunkText(text: string, limit: number, options?: {
|
|
503
|
+
minLength?: number;
|
|
504
|
+
}): string[];
|
|
505
505
|
declare function chunkTextByBreakResolver(text: string, limit: number, resolveBreakIndex: (window: string) => number): string[];
|
|
506
506
|
|
|
507
507
|
type InlineCodeState = {
|
|
@@ -538,7 +538,9 @@ declare namespace Markdown {
|
|
|
538
538
|
frontmatter: ParsedFrontmatter;
|
|
539
539
|
content: string;
|
|
540
540
|
};
|
|
541
|
-
function chunk(text: string, limit: number
|
|
541
|
+
function chunk(text: string, limit: number, options?: {
|
|
542
|
+
minLength?: number;
|
|
543
|
+
}): string[];
|
|
542
544
|
function buildCodeIndex(text: string, inlineState?: InlineCodeState$1): CodeSpanIndex$1;
|
|
543
545
|
function convertTables(markdown: string, tableMode: MarkdownTableMode): string;
|
|
544
546
|
}
|
|
@@ -713,7 +715,7 @@ declare class PkgShell {
|
|
|
713
715
|
throws(shouldThrow: boolean): EasbotShell;
|
|
714
716
|
}
|
|
715
717
|
declare function createPkgShell(options?: ShellOptions): EasbotShell;
|
|
716
|
-
declare const
|
|
718
|
+
declare const shell: EasbotShell;
|
|
717
719
|
|
|
718
720
|
interface NodeWhichOptions {
|
|
719
721
|
PATH?: string;
|
|
@@ -1111,6 +1113,39 @@ declare const $: typeof PKG.$;
|
|
|
1111
1113
|
declare const readableStreamToText: typeof PKG.readableStreamToText;
|
|
1112
1114
|
declare const whichSync: typeof PKG.whichSync;
|
|
1113
1115
|
|
|
1116
|
+
declare namespace PackageRegistry {
|
|
1117
|
+
function info(pkg: string, field: string, cwd?: string): Promise<string | null>;
|
|
1118
|
+
function isOutdated(pkg: string, cachedVersion: string, cwd?: string): Promise<boolean>;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
declare namespace Identifier {
|
|
1122
|
+
const prefixes: {
|
|
1123
|
+
readonly event: "evt";
|
|
1124
|
+
readonly session: "ses";
|
|
1125
|
+
readonly message: "msg";
|
|
1126
|
+
readonly permission: "per";
|
|
1127
|
+
readonly question: "que";
|
|
1128
|
+
readonly user: "usr";
|
|
1129
|
+
readonly part: "prt";
|
|
1130
|
+
readonly pty: "pty";
|
|
1131
|
+
readonly tool: "tool";
|
|
1132
|
+
readonly workspace: "wrk";
|
|
1133
|
+
readonly command: "cmd";
|
|
1134
|
+
readonly task: "task";
|
|
1135
|
+
readonly heartbeat: "hb";
|
|
1136
|
+
readonly subagent: "sub";
|
|
1137
|
+
readonly hook: "hok";
|
|
1138
|
+
readonly compaction: "cmp";
|
|
1139
|
+
readonly context: "ctx";
|
|
1140
|
+
};
|
|
1141
|
+
export function schema(prefix: keyof typeof prefixes): z.ZodString;
|
|
1142
|
+
export function ascending(prefix: keyof typeof prefixes, given?: string): string;
|
|
1143
|
+
export function descending(prefix: keyof typeof prefixes, given?: string): string;
|
|
1144
|
+
export function create(prefix: keyof typeof prefixes, descending: boolean, timestamp?: number): string;
|
|
1145
|
+
export function timestamp(id: string): number;
|
|
1146
|
+
export { };
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1114
1149
|
declare function abortAfter(ms: number): {
|
|
1115
1150
|
controller: AbortController;
|
|
1116
1151
|
signal: AbortSignal;
|
|
@@ -1159,16 +1194,21 @@ declare namespace EventLoop {
|
|
|
1159
1194
|
declare function formatDuration(secs: number): string;
|
|
1160
1195
|
|
|
1161
1196
|
declare namespace Glob {
|
|
1162
|
-
interface Options {
|
|
1197
|
+
interface Options extends GlobOptions {
|
|
1163
1198
|
cwd?: string;
|
|
1164
1199
|
absolute?: boolean;
|
|
1165
1200
|
include?: 'file' | 'all';
|
|
1166
1201
|
dot?: boolean;
|
|
1167
1202
|
symlink?: boolean;
|
|
1203
|
+
ignore?: string[];
|
|
1168
1204
|
}
|
|
1169
1205
|
function scan(pattern: string, options?: Options): Promise<string[]>;
|
|
1170
1206
|
function scanSync(pattern: string, options?: Options): string[];
|
|
1171
1207
|
function match(pattern: string, filepath: string): boolean;
|
|
1208
|
+
function parseGitignore(gitignorePath: string): Promise<string[]>;
|
|
1209
|
+
function parseGitignoreContent(content: string): string[];
|
|
1210
|
+
function isIgnored(filepath: string, patterns: string[]): boolean;
|
|
1211
|
+
const DEFAULT_IGNORE_PATTERNS: string[];
|
|
1172
1212
|
}
|
|
1173
1213
|
|
|
1174
1214
|
declare namespace Keybind {
|
|
@@ -1303,4 +1343,4 @@ declare function initLog(options: {
|
|
|
1303
1343
|
level?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
|
|
1304
1344
|
}): Promise<void>;
|
|
1305
1345
|
|
|
1306
|
-
export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, type EasServer,
|
|
1346
|
+
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, 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 ParsedFrontmatter, PkgShell, Process, type RPCMethod, type RenderLink, type RenderOptions, type RouteDefinition, type SSEHandler, type ServerOptions, 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, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getTimezoneOffset, git, iife, initLog, isSafeFenceBreak, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, now, nowLocalISO, parseFenceSpans, parseFrontmatterBlock, parseLocalISO, parseModelId, proxied, readableStreamToText, renderMarkdown, renderMarkdownWithMarkers, retry, scanParenAwareBreakpoints, serializeFrontmatter, shell, signal, startServer, truncateMiddle, updateSchema, whichSync, withTimeout, work };
|