@poe-platform/safe-bash 0.1.427 → 0.1.429
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/safe-bash/browser.js +3 -1
- package/dist/safe-bash/browser.js.map +2 -2
- package/dist/safe-bash/commands/expr/command.d.ts +6 -0
- package/dist/safe-bash/commands/expr/command.d.ts.map +1 -0
- package/dist/safe-bash/commands/expr/command.js +75 -0
- package/dist/safe-bash/commands/expr/command.js.map +1 -0
- package/dist/safe-bash/commands/expr/index.d.ts +2 -2
- package/dist/safe-bash/commands/expr/index.d.ts.map +1 -1
- package/dist/safe-bash/commands/expr/index.js +3 -73
- package/dist/safe-bash/commands/expr/index.js.map +1 -1
- package/dist/safe-bash/commands/grep-aliases/aliases.d.ts +4 -0
- package/dist/safe-bash/commands/grep-aliases/aliases.d.ts.map +1 -0
- package/dist/safe-bash/commands/grep-aliases/aliases.js +29 -0
- package/dist/safe-bash/commands/grep-aliases/aliases.js.map +1 -0
- package/dist/safe-bash/commands/grep-aliases/index.d.ts.map +1 -1
- package/dist/safe-bash/commands/grep-aliases/index.js +2 -26
- package/dist/safe-bash/commands/grep-aliases/index.js.map +1 -1
- package/dist/safe-bash/commands/index.d.ts +3 -13
- package/dist/safe-bash/commands/index.d.ts.map +1 -1
- package/dist/safe-bash/commands/index.js +2 -18
- package/dist/safe-bash/commands/index.js.map +1 -1
- package/dist/safe-bash/commands/standard.d.ts +15 -0
- package/dist/safe-bash/commands/standard.d.ts.map +1 -0
- package/dist/safe-bash/commands/standard.js +22 -0
- package/dist/safe-bash/commands/standard.js.map +1 -0
- package/dist/safe-bash/contracts/errors.d.ts +2 -2
- package/dist/safe-bash/contracts/errors.d.ts.map +1 -1
- package/dist/safe-bash/contracts/errors.js +1 -1
- package/dist/safe-bash/contracts/errors.js.map +1 -1
- package/dist/safe-bash/contracts/filesystem.d.ts +2 -2
- package/dist/safe-bash/contracts/filesystem.d.ts.map +1 -1
- package/dist/safe-bash/contracts/filesystem.js +1 -1
- package/dist/safe-bash/contracts/filesystem.js.map +1 -1
- package/dist/safe-bash/contracts/io.d.ts +3 -3
- package/dist/safe-bash/contracts/io.d.ts.map +1 -1
- package/dist/safe-bash/contracts/io.js +2 -2
- package/dist/safe-bash/contracts/io.js.map +1 -1
- package/dist/safe-bash/contracts/path.d.ts +2 -1
- package/dist/safe-bash/contracts/path.d.ts.map +1 -1
- package/dist/safe-bash/contracts/path.js +2 -1
- package/dist/safe-bash/contracts/path.js.map +1 -1
- package/dist/safe-bash/fs/memory/index.d.ts +1 -1
- package/dist/safe-bash/fs/memory/index.d.ts.map +1 -1
- package/dist/safe-bash/fs/memory/index.js +1 -1
- package/dist/safe-bash/fs/memory/index.js.map +1 -1
- package/dist/safe-bash/fs/mount/index.d.ts +2 -2
- package/dist/safe-bash/fs/mount/index.d.ts.map +1 -1
- package/dist/safe-bash/fs/mount/index.js +1 -1
- package/dist/safe-bash/fs/mount/index.js.map +1 -1
- package/dist/safe-bash/fs/overlay/index.d.ts +2 -2
- package/dist/safe-bash/fs/overlay/index.d.ts.map +1 -1
- package/dist/safe-bash/fs/overlay/index.js +1 -1
- package/dist/safe-bash/fs/overlay/index.js.map +1 -1
- package/dist/safe-bash/fs/readonly/index.d.ts +1 -1
- package/dist/safe-bash/fs/readonly/index.d.ts.map +1 -1
- package/dist/safe-bash/fs/readonly/index.js +1 -1
- package/dist/safe-bash/fs/readonly/index.js.map +1 -1
- package/dist/safe-bash/plugins/composition.d.ts +64 -0
- package/dist/safe-bash/plugins/composition.d.ts.map +1 -0
- package/dist/safe-bash/plugins/composition.js +50 -0
- package/dist/safe-bash/plugins/composition.js.map +1 -0
- package/dist/safe-bash/plugins/index.d.ts +4 -54
- package/dist/safe-bash/plugins/index.d.ts.map +1 -1
- package/dist/safe-bash/plugins/index.js +9 -46
- package/dist/safe-bash/plugins/index.js.map +1 -1
- package/dist/safe-bash/plugins/portable.d.ts +9 -0
- package/dist/safe-bash/plugins/portable.d.ts.map +1 -0
- package/dist/safe-bash/plugins/portable.js +44 -0
- package/dist/safe-bash/plugins/portable.js.map +1 -0
- package/dist/safe-bash/portable.d.ts +3 -0
- package/dist/safe-bash/portable.d.ts.map +1 -0
- package/dist/safe-bash/portable.js +39092 -0
- package/dist/safe-bash/portable.js.map +7 -0
- package/dist/safe-bash/shell/runtime.js +1 -1
- package/dist/safe-bash/shell/runtime.js.map +1 -1
- package/package.json +6 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fs/mount/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fs/mount/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC/E,YAAY,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createMountFileSystem, MountFileSystem } from "@poe-platform/safe-fs";
|
|
1
|
+
export { createMountFileSystem, MountFileSystem } from "@poe-platform/safe-fs/core";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/fs/mount/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/fs/mount/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { createOverlayFileSystem, OverlayFileSystem } from "@poe-platform/safe-fs";
|
|
2
|
-
export type { OverlayFileSystemOptions } from "@poe-platform/safe-fs";
|
|
1
|
+
export { createOverlayFileSystem, OverlayFileSystem } from "@poe-platform/safe-fs/core";
|
|
2
|
+
export type { OverlayFileSystemOptions } from "@poe-platform/safe-fs/core";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fs/overlay/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fs/overlay/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACnF,YAAY,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createOverlayFileSystem, OverlayFileSystem } from "@poe-platform/safe-fs";
|
|
1
|
+
export { createOverlayFileSystem, OverlayFileSystem } from "@poe-platform/safe-fs/core";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/fs/overlay/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/fs/overlay/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createReadOnlyFileSystem, ReadOnlyFileSystem } from "@poe-platform/safe-fs";
|
|
1
|
+
export { createReadOnlyFileSystem, ReadOnlyFileSystem } from "@poe-platform/safe-fs/core";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fs/readonly/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fs/readonly/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createReadOnlyFileSystem, ReadOnlyFileSystem } from "@poe-platform/safe-fs";
|
|
1
|
+
export { createReadOnlyFileSystem, ReadOnlyFileSystem } from "@poe-platform/safe-fs/core";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/fs/readonly/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/fs/readonly/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type CommandDefinition, type CommandHandler } from "../contracts/index.js";
|
|
2
|
+
import { type ExecutionCommandsOptions } from "../commands/standard.js";
|
|
3
|
+
import { type TextProgramOptions } from "../commands/text-programs/index.js";
|
|
4
|
+
import { type StructuredCommandsOptions } from "../commands/structured/index.js";
|
|
5
|
+
import type { SearchOptions } from "../commands/search/options.js";
|
|
6
|
+
import type { RegexExecutor } from "../commands/regex-execution/portable.js";
|
|
7
|
+
import { type ByteCommandsOptions } from "../commands/bytes/index.js";
|
|
8
|
+
import { type DiffPatchOptions } from "../commands/diff-patch/index.js";
|
|
9
|
+
import { type MetadataCommandsOptions } from "../commands/metadata/index.js";
|
|
10
|
+
import { type ArchiveCommandsOptions } from "../commands/archive/index.js";
|
|
11
|
+
import { type TableTextCommandsOptions } from "../commands/table-text/index.js";
|
|
12
|
+
import { type StreamInspectionCommandsOptions } from "../commands/stream-inspection/index.js";
|
|
13
|
+
import { type StreamFormatCommandsOptions } from "../commands/stream-format/index.js";
|
|
14
|
+
import { type SplitCommandsOptions } from "../commands/split/index.js";
|
|
15
|
+
import { type TimeEnvCommandsOptions } from "../commands/time-env/index.js";
|
|
16
|
+
import { type TreeCommandsOptions } from "../commands/tree/index.js";
|
|
17
|
+
import { type FileCommandsOptions } from "../commands/file/index.js";
|
|
18
|
+
import { type ColumnCommandsOptions } from "../commands/column/index.js";
|
|
19
|
+
import { type HtmlToMarkdownCommandsOptions } from "../commands/html-to-markdown/index.js";
|
|
20
|
+
import { type DuCommandsOptions } from "../commands/du/index.js";
|
|
21
|
+
import type { ExprCommandsOptions } from "../commands/expr/internal.js";
|
|
22
|
+
import { type WhichCommandsOptions } from "../commands/which/index.js";
|
|
23
|
+
import { type TimeoutCommandsOptions } from "../commands/timeout/index.js";
|
|
24
|
+
import { type ApplyPatchCommandsOptions } from "../commands/apply-patch/index.js";
|
|
25
|
+
import type { RegexExecutionOptions } from "../commands/regex-execution/protocol.js";
|
|
26
|
+
export interface AgentCommandsOptions {
|
|
27
|
+
readonly execution?: ExecutionCommandsOptions;
|
|
28
|
+
readonly bytes?: Omit<ByteCommandsOptions, "replace">;
|
|
29
|
+
readonly applyPatch?: Omit<ApplyPatchCommandsOptions, "replace">;
|
|
30
|
+
readonly timeout?: Omit<TimeoutCommandsOptions, "replace">;
|
|
31
|
+
readonly which?: Omit<WhichCommandsOptions, "replace">;
|
|
32
|
+
readonly expr?: Omit<ExprCommandsOptions, "replace" | "regex">;
|
|
33
|
+
readonly du?: Omit<DuCommandsOptions, "replace">;
|
|
34
|
+
readonly htmlToMarkdown?: Omit<HtmlToMarkdownCommandsOptions, "replace">;
|
|
35
|
+
readonly replace?: boolean;
|
|
36
|
+
readonly execute?: CommandHandler;
|
|
37
|
+
readonly regex?: RegexExecutionOptions;
|
|
38
|
+
readonly maxDirectoryEntries?: number;
|
|
39
|
+
readonly maxTeeTargets?: number;
|
|
40
|
+
readonly maxTailFollowHandles?: number;
|
|
41
|
+
readonly text?: Omit<TextProgramOptions, "replace">;
|
|
42
|
+
readonly structured?: Omit<StructuredCommandsOptions, "replace">;
|
|
43
|
+
readonly search?: Omit<SearchOptions, "replace">;
|
|
44
|
+
readonly diffPatch?: Omit<DiffPatchOptions, "replace">;
|
|
45
|
+
readonly metadata?: Omit<MetadataCommandsOptions, "replace">;
|
|
46
|
+
readonly archive?: Omit<ArchiveCommandsOptions, "replace">;
|
|
47
|
+
readonly tableText?: Omit<TableTextCommandsOptions, "replace">;
|
|
48
|
+
readonly streamInspection?: Omit<StreamInspectionCommandsOptions, "replace">;
|
|
49
|
+
readonly streamFormat?: Omit<StreamFormatCommandsOptions, "replace">;
|
|
50
|
+
readonly split?: Omit<SplitCommandsOptions, "replace">;
|
|
51
|
+
readonly timeEnv?: Omit<TimeEnvCommandsOptions, "replace">;
|
|
52
|
+
readonly tree?: Omit<TreeCommandsOptions, "replace">;
|
|
53
|
+
readonly file?: Omit<FileCommandsOptions, "replace">;
|
|
54
|
+
readonly column?: Omit<ColumnCommandsOptions, "replace">;
|
|
55
|
+
}
|
|
56
|
+
export declare function commandExecutor(lookup: (name: string) => CommandDefinition | undefined): CommandHandler;
|
|
57
|
+
export interface AgentRegexExecutors {
|
|
58
|
+
readonly grep: RegexExecutor;
|
|
59
|
+
readonly aliases: RegexExecutor;
|
|
60
|
+
readonly expr: RegexExecutor;
|
|
61
|
+
readonly search: RegexExecutor;
|
|
62
|
+
}
|
|
63
|
+
export declare function composeAgentCommands(options: AgentCommandsOptions, executors: AgentRegexExecutors): readonly CommandDefinition[];
|
|
64
|
+
//# sourceMappingURL=composition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../../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B,eAAe,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,iBAAiB,GAAG,SAAS,GAAG,cAAc,CAOvG;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;CAChC;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,mBAAmB,GAAG,SAAS,iBAAiB,EAAE,CAqChI"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { CommandRegistry } from "../contracts/index.js";
|
|
2
|
+
import { createStandardCommandsWithGrep } from "../commands/standard.js";
|
|
3
|
+
import { diagnostic } from "../commands/internal.js";
|
|
4
|
+
import { createTextProgramCommands } from "../commands/text-programs/index.js";
|
|
5
|
+
import { createStructuredCommands } from "../commands/structured/index.js";
|
|
6
|
+
import { createRgCommand } from "../commands/search/rg-command.js";
|
|
7
|
+
import { createGrepCommands } from "../commands/search/grep.js";
|
|
8
|
+
import { createByteCommands } from "../commands/bytes/index.js";
|
|
9
|
+
import { createDiffPatchCommands } from "../commands/diff-patch/index.js";
|
|
10
|
+
import { createMetadataCommands } from "../commands/metadata/index.js";
|
|
11
|
+
import { createArchiveCommands } from "../commands/archive/index.js";
|
|
12
|
+
import { createTableTextCommands } from "../commands/table-text/index.js";
|
|
13
|
+
import { createStreamInspectionCommands } from "../commands/stream-inspection/index.js";
|
|
14
|
+
import { createStreamFormatCommands } from "../commands/stream-format/index.js";
|
|
15
|
+
import { createSplitCommands } from "../commands/split/index.js";
|
|
16
|
+
import { createTimeEnvCommands } from "../commands/time-env/index.js";
|
|
17
|
+
import { createTreeCommands } from "../commands/tree/index.js";
|
|
18
|
+
import { createFileCommands } from "../commands/file/index.js";
|
|
19
|
+
import { createGrepAliases } from "../commands/grep-aliases/aliases.js";
|
|
20
|
+
import { createColumnCommands } from "../commands/column/index.js";
|
|
21
|
+
import { createHtmlToMarkdownCommands } from "../commands/html-to-markdown/index.js";
|
|
22
|
+
import { createDuCommands } from "../commands/du/index.js";
|
|
23
|
+
import { createExprCommandWithExecutor } from "../commands/expr/command.js";
|
|
24
|
+
import { createWhichCommands } from "../commands/which/index.js";
|
|
25
|
+
import { createTimeoutCommands } from "../commands/timeout/index.js";
|
|
26
|
+
import { createApplyPatchCommands } from "../commands/apply-patch/index.js";
|
|
27
|
+
export function commandExecutor(lookup) {
|
|
28
|
+
return async (context) => {
|
|
29
|
+
const command = lookup(context.command);
|
|
30
|
+
if (command)
|
|
31
|
+
return command.execute(context);
|
|
32
|
+
await diagnostic(context, new Error("command not found"));
|
|
33
|
+
return { exitCode: 127 };
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export function composeAgentCommands(options, executors) {
|
|
37
|
+
const commands = [];
|
|
38
|
+
const grep = createGrepCommands(executors.grep);
|
|
39
|
+
const exprLimits = options.expr?.limits;
|
|
40
|
+
const whichLimits = options.which?.limits;
|
|
41
|
+
const timeoutOptions = options.timeout;
|
|
42
|
+
const applyPatchLimits = options.applyPatch?.limits;
|
|
43
|
+
commands.push(...createStandardCommandsWithGrep({ execute: options.execute ?? commandExecutor(name => commands.find(command => command.name === name)), ...(options.execution === undefined ? {} : { execution: options.execution }), ...(options.regex === undefined ? {} : { regex: options.regex }), ...(options.maxDirectoryEntries === undefined ? {} : { maxDirectoryEntries: options.maxDirectoryEntries }), ...(options.maxTeeTargets === undefined ? {} : { maxTeeTargets: options.maxTeeTargets }), ...(options.maxTailFollowHandles === undefined ? {} : { maxTailFollowHandles: options.maxTailFollowHandles }) }, grep), ...createTextProgramCommands({ ...options.text }), ...createStructuredCommands({ ...options.structured }), createRgCommand(executors.search, options.search), ...createByteCommands(options.bytes), ...createDiffPatchCommands({ ...options.diffPatch }), ...createMetadataCommands({ ...options.metadata }), ...createArchiveCommands({ ...options.archive }), ...createTableTextCommands({ ...options.tableText }), ...createStreamInspectionCommands({ ...options.streamInspection }), ...createStreamFormatCommands({ ...options.streamFormat }), ...createSplitCommands({ ...options.split }), ...createTimeEnvCommands({ ...options.timeEnv }), ...createTreeCommands({ ...options.tree }), ...createFileCommands({ ...options.file }), ...createGrepAliases(createGrepCommands(executors.aliases)[0]), ...createColumnCommands({ ...options.column }), ...createHtmlToMarkdownCommands({ ...options.htmlToMarkdown }), ...createDuCommands({ ...options.du }), createExprCommandWithExecutor(executors.expr, exprLimits === undefined ? {} : { limits: exprLimits }), ...createWhichCommands(whichLimits === undefined ? {} : { limits: whichLimits }), ...createTimeoutCommands(timeoutOptions === undefined ? undefined : {
|
|
44
|
+
invoke: timeoutOptions.invoke,
|
|
45
|
+
scheduler: timeoutOptions.scheduler,
|
|
46
|
+
maxTimerMilliseconds: timeoutOptions.maxTimerMilliseconds,
|
|
47
|
+
}), ...createApplyPatchCommands(applyPatchLimits === undefined ? {} : { limits: applyPatchLimits }));
|
|
48
|
+
return new CommandRegistry(commands).list();
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=composition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition.js","sourceRoot":"","sources":["../../src/plugins/composition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA+C,MAAM,uBAAuB,CAAC;AACrG,OAAO,EAAE,8BAA8B,EAAiC,MAAM,yBAAyB,CAAC;AACxG,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAA2B,MAAM,oCAAoC,CAAC;AACxG,OAAO,EAAE,wBAAwB,EAAkC,MAAM,iCAAiC,CAAC;AAC3G,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAA4B,MA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C,kBAAkB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAE,CAAC,EAC/D,GAAG,oBAAoB,CAAC,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAC9C,GAAG,4BAA4B,CAAC,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,EAC9D,GAAG,gBAAgB,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,CAAC,EACtC,6BAA6B,CAAC,SAAS,CAAC,IAAI,EAAE,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,EACrG,GAAG,mBAAmB,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,EAChF,GAAG,qBAAqB,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;QAClE,MAAM,EAAE,cAAc,CAAC,MAAM;QAC7B,SAAS,EAAE,cAAc,CAAC,SAAS;QACnC,oBAAoB,EAAE,cAAc,CAAC,oBAAoB;KAC1D,CAAC,EACF,GAAG,wBAAwB,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAChG,CAAC;IACF,OAAO,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;AAC9C,CAAC"}
|
|
@@ -1,57 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { type SearchOptions } from "../commands/search/index.js";
|
|
6
|
-
import { type ByteCommandsOptions } from "../commands/bytes/index.js";
|
|
7
|
-
import { type DiffPatchOptions } from "../commands/diff-patch/index.js";
|
|
8
|
-
import { type MetadataCommandsOptions } from "../commands/metadata/index.js";
|
|
9
|
-
import { type ArchiveCommandsOptions } from "../commands/archive/index.js";
|
|
10
|
-
import { type TableTextCommandsOptions } from "../commands/table-text/index.js";
|
|
11
|
-
import { type StreamInspectionCommandsOptions } from "../commands/stream-inspection/index.js";
|
|
12
|
-
import { type StreamFormatCommandsOptions } from "../commands/stream-format/index.js";
|
|
13
|
-
import { type SplitCommandsOptions } from "../commands/split/index.js";
|
|
14
|
-
import { type TimeEnvCommandsOptions } from "../commands/time-env/index.js";
|
|
15
|
-
import { type TreeCommandsOptions } from "../commands/tree/index.js";
|
|
16
|
-
import { type FileCommandsOptions } from "../commands/file/index.js";
|
|
17
|
-
import { type ColumnCommandsOptions } from "../commands/column/index.js";
|
|
18
|
-
import { type HtmlToMarkdownCommandsOptions } from "../commands/html-to-markdown/index.js";
|
|
19
|
-
import { type DuCommandsOptions } from "../commands/du/index.js";
|
|
20
|
-
import { type ExprCommandsOptions } from "../commands/expr/index.js";
|
|
21
|
-
import { type WhichCommandsOptions } from "../commands/which/index.js";
|
|
22
|
-
import { type TimeoutCommandsOptions } from "../commands/timeout/index.js";
|
|
23
|
-
import { type ApplyPatchCommandsOptions } from "../commands/apply-patch/index.js";
|
|
24
|
-
import type { RegexExecutionOptions } from "../commands/regex-execution/protocol.js";
|
|
25
|
-
export interface AgentCommandsOptions {
|
|
26
|
-
readonly execution?: ExecutionCommandsOptions;
|
|
27
|
-
readonly bytes?: Omit<ByteCommandsOptions, "replace">;
|
|
28
|
-
readonly applyPatch?: Omit<ApplyPatchCommandsOptions, "replace">;
|
|
29
|
-
readonly timeout?: Omit<TimeoutCommandsOptions, "replace">;
|
|
30
|
-
readonly which?: Omit<WhichCommandsOptions, "replace">;
|
|
31
|
-
readonly expr?: Omit<ExprCommandsOptions, "replace" | "regex">;
|
|
32
|
-
readonly du?: Omit<DuCommandsOptions, "replace">;
|
|
33
|
-
readonly htmlToMarkdown?: Omit<HtmlToMarkdownCommandsOptions, "replace">;
|
|
34
|
-
readonly replace?: boolean;
|
|
35
|
-
readonly execute?: CommandHandler;
|
|
36
|
-
readonly regex?: RegexExecutionOptions;
|
|
37
|
-
readonly maxDirectoryEntries?: number;
|
|
38
|
-
readonly maxTeeTargets?: number;
|
|
39
|
-
readonly maxTailFollowHandles?: number;
|
|
40
|
-
readonly text?: Omit<TextProgramOptions, "replace">;
|
|
41
|
-
readonly structured?: Omit<StructuredCommandsOptions, "replace">;
|
|
42
|
-
readonly search?: Omit<SearchOptions, "replace">;
|
|
43
|
-
readonly diffPatch?: Omit<DiffPatchOptions, "replace">;
|
|
44
|
-
readonly metadata?: Omit<MetadataCommandsOptions, "replace">;
|
|
45
|
-
readonly archive?: Omit<ArchiveCommandsOptions, "replace">;
|
|
46
|
-
readonly tableText?: Omit<TableTextCommandsOptions, "replace">;
|
|
47
|
-
readonly streamInspection?: Omit<StreamInspectionCommandsOptions, "replace">;
|
|
48
|
-
readonly streamFormat?: Omit<StreamFormatCommandsOptions, "replace">;
|
|
49
|
-
readonly split?: Omit<SplitCommandsOptions, "replace">;
|
|
50
|
-
readonly timeEnv?: Omit<TimeEnvCommandsOptions, "replace">;
|
|
51
|
-
readonly tree?: Omit<TreeCommandsOptions, "replace">;
|
|
52
|
-
readonly file?: Omit<FileCommandsOptions, "replace">;
|
|
53
|
-
readonly column?: Omit<ColumnCommandsOptions, "replace">;
|
|
54
|
-
}
|
|
1
|
+
import type { CommandDefinition } from "../contracts/index.js";
|
|
2
|
+
import { type AgentCommandsOptions } from "./composition.js";
|
|
3
|
+
import type { VirtualShellPlugin } from "../contracts/index.js";
|
|
4
|
+
export type { AgentCommandsOptions } from "./composition.js";
|
|
55
5
|
export declare function createAgentCommands(options?: AgentCommandsOptions): readonly CommandDefinition[];
|
|
56
6
|
export declare function agentCommands(options?: AgentCommandsOptions): VirtualShellPlugin;
|
|
57
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,EAAyC,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,GAAG,SAAS,iBAAiB,EAAE,CAOpG;AAED,wBAAgB,aAAa,CAAC,OAAO,GAAE,oBAAyB,GAAG,kBAAkB,CAWpF"}
|
|
@@ -1,55 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { diagnostic } from "../commands/internal.js";
|
|
4
|
-
import { createTextProgramCommands } from "../commands/text-programs/index.js";
|
|
5
|
-
import { createStructuredCommands } from "../commands/structured/index.js";
|
|
6
|
-
import { createSearchCommands } from "../commands/search/index.js";
|
|
7
|
-
import { createByteCommands } from "../commands/bytes/index.js";
|
|
8
|
-
import { createDiffPatchCommands } from "../commands/diff-patch/index.js";
|
|
9
|
-
import { createMetadataCommands } from "../commands/metadata/index.js";
|
|
10
|
-
import { createArchiveCommands } from "../commands/archive/index.js";
|
|
11
|
-
import { createTableTextCommands } from "../commands/table-text/index.js";
|
|
12
|
-
import { createStreamInspectionCommands } from "../commands/stream-inspection/index.js";
|
|
13
|
-
import { createStreamFormatCommands } from "../commands/stream-format/index.js";
|
|
14
|
-
import { createSplitCommands } from "../commands/split/index.js";
|
|
15
|
-
import { createTimeEnvCommands } from "../commands/time-env/index.js";
|
|
16
|
-
import { createTreeCommands } from "../commands/tree/index.js";
|
|
17
|
-
import { createFileCommands } from "../commands/file/index.js";
|
|
18
|
-
import { createGrepAliasCommands } from "../commands/grep-aliases/index.js";
|
|
19
|
-
import { createColumnCommands } from "../commands/column/index.js";
|
|
20
|
-
import { createHtmlToMarkdownCommands } from "../commands/html-to-markdown/index.js";
|
|
21
|
-
import { createDuCommands } from "../commands/du/index.js";
|
|
22
|
-
import { createExprCommands } from "../commands/expr/index.js";
|
|
23
|
-
import { createWhichCommands } from "../commands/which/index.js";
|
|
24
|
-
import { createTimeoutCommands } from "../commands/timeout/index.js";
|
|
25
|
-
import { createApplyPatchCommands } from "../commands/apply-patch/index.js";
|
|
26
|
-
function executor(lookup) {
|
|
27
|
-
return async (context) => {
|
|
28
|
-
const command = lookup(context.command);
|
|
29
|
-
if (command)
|
|
30
|
-
return command.execute(context);
|
|
31
|
-
await diagnostic(context, new Error("command not found"));
|
|
32
|
-
return { exitCode: 127 };
|
|
33
|
-
};
|
|
34
|
-
}
|
|
1
|
+
import { RegexExecutor } from "../commands/regex-execution/client.js";
|
|
2
|
+
import { commandExecutor, composeAgentCommands } from "./composition.js";
|
|
35
3
|
export function createAgentCommands(options = {}) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
invoke: timeoutOptions.invoke,
|
|
43
|
-
scheduler: timeoutOptions.scheduler,
|
|
44
|
-
maxTimerMilliseconds: timeoutOptions.maxTimerMilliseconds,
|
|
45
|
-
}), ...createApplyPatchCommands(applyPatchLimits === undefined ? {} : { limits: applyPatchLimits }));
|
|
46
|
-
return new CommandRegistry(commands).list();
|
|
4
|
+
return composeAgentCommands(options, {
|
|
5
|
+
grep: new RegexExecutor(options.regex),
|
|
6
|
+
aliases: new RegexExecutor(options.regex),
|
|
7
|
+
expr: new RegexExecutor(options.regex),
|
|
8
|
+
search: new RegexExecutor(options.search?.regex),
|
|
9
|
+
});
|
|
47
10
|
}
|
|
48
11
|
export function agentCommands(options = {}) {
|
|
49
12
|
return {
|
|
50
13
|
name: "agent-commands",
|
|
51
14
|
setup(host) {
|
|
52
|
-
const definitions = createAgentCommands({ ...options, execute: options.execute ??
|
|
15
|
+
const definitions = createAgentCommands({ ...options, execute: options.execute ?? commandExecutor(name => host.commands.get(name)) });
|
|
53
16
|
if (!options.replace)
|
|
54
17
|
for (const definition of definitions) {
|
|
55
18
|
if (host.commands.has(definition.name))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAA6B,MAAM,kBAAkB,CAAC;AAKpG,MAAM,UAAU,mBAAmB,CAAC,UAAgC,EAAE;IACpE,OAAO,oBAAoB,CAAC,OAAO,EAAE;QACnC,IAAI,EAAE,IAAI,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC;QACtC,OAAO,EAAE,IAAI,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC;QACzC,IAAI,EAAE,IAAI,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC;QACtC,MAAM,EAAE,IAAI,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC;KACjD,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,UAAgC,EAAE;IAC9D,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,KAAK,CAAC,IAAI;YACR,MAAM,WAAW,GAAG,mBAAmB,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;YACtI,IAAI,CAAC,OAAO,CAAC,OAAO;gBAAE,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;oBAC3D,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;wBAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;gBAC5G,CAAC;YACD,KAAK,MAAM,UAAU,IAAI,WAAW;gBAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC;QAClH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { VirtualShellPlugin } from "../contracts/index.js";
|
|
2
|
+
import type { BoundedRegexProvider } from "../commands/regex-execution/provider.js";
|
|
3
|
+
import { type AgentCommandsOptions } from "./composition.js";
|
|
4
|
+
export interface PortableAgentCommandsOptions extends AgentCommandsOptions {
|
|
5
|
+
readonly provider: BoundedRegexProvider;
|
|
6
|
+
}
|
|
7
|
+
export declare const portableAgentCommandNames: readonly string[];
|
|
8
|
+
export declare function portableAgentCommands(options: PortableAgentCommandsOptions): VirtualShellPlugin;
|
|
9
|
+
//# sourceMappingURL=portable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portable.d.ts","sourceRoot":"","sources":["../../src/plugins/portable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAyC,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEpG,MAAM,WAAW,4BAA6B,SAAQ,oBAAoB;IACxE,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;CACzC;AAED,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAQrD,CAAC;AAEH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,4BAA4B,GAAG,kBAAkB,CAyB/F"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { RegexExecutor } from "../commands/regex-execution/portable.js";
|
|
2
|
+
import { commandExecutor, composeAgentCommands } from "./composition.js";
|
|
3
|
+
export const portableAgentCommandNames = Object.freeze([
|
|
4
|
+
"true", "false", "echo", "pwd", "basename", "dirname", "printf", "mkdir", "touch",
|
|
5
|
+
"cp", "mv", "rm", "rmdir", "ln", "readlink", "realpath", "ls", "cat", "head", "tail",
|
|
6
|
+
"wc", "tee", "tr", "sort", "uniq", "cut", "grep", "test", "[", "env", "xargs", "find",
|
|
7
|
+
"sed", "awk", "jq", "rg", "base64", "base32", "xxd", "od", "sha256sum", "sha1sum",
|
|
8
|
+
"md5sum", "cksum", "gzip", "gunzip", "zcat", "diff", "patch", "chmod", "stat", "mktemp", "tar",
|
|
9
|
+
"paste", "comm", "join", "tac", "expand", "fold", "strings", "seq", "nl", "rev", "unexpand", "split",
|
|
10
|
+
"date", "sleep", "printenv", "tree", "file", "egrep", "fgrep", "column", "html-to-markdown", "du", "expr", "which", "timeout", "apply_patch",
|
|
11
|
+
]);
|
|
12
|
+
export function portableAgentCommands(options) {
|
|
13
|
+
const executor = new RegexExecutor(options.provider, options.regex);
|
|
14
|
+
const searchExecutor = options.search?.regex === undefined ? executor : new RegexExecutor(options.provider, options.search.regex);
|
|
15
|
+
let disposal;
|
|
16
|
+
return {
|
|
17
|
+
name: "portable-agent-commands",
|
|
18
|
+
setup(host) {
|
|
19
|
+
if (disposal)
|
|
20
|
+
throw new Error("Portable agent commands are disposed");
|
|
21
|
+
const commands = composeAgentCommands({ ...options, execute: options.execute ?? commandExecutor(name => host.commands.get(name)) }, {
|
|
22
|
+
grep: executor, aliases: executor, expr: executor, search: searchExecutor,
|
|
23
|
+
});
|
|
24
|
+
if (!options.replace)
|
|
25
|
+
for (const command of commands) {
|
|
26
|
+
if (host.commands.has(command.name))
|
|
27
|
+
throw new Error(`Command already registered: ${command.name}`);
|
|
28
|
+
}
|
|
29
|
+
for (const command of commands)
|
|
30
|
+
host.commands.register(command, { replace: options.replace ?? false });
|
|
31
|
+
},
|
|
32
|
+
dispose() {
|
|
33
|
+
return disposal ??= (async () => {
|
|
34
|
+
const results = await Promise.allSettled([executor.dispose(), ...(executor === searchExecutor ? [] : [searchExecutor.dispose()])]);
|
|
35
|
+
const errors = results.filter(result => result.status === "rejected").map(result => result.reason);
|
|
36
|
+
if (errors.length === 1)
|
|
37
|
+
throw errors[0];
|
|
38
|
+
if (errors.length > 1)
|
|
39
|
+
throw new AggregateError(errors, "portable agent regex disposal failed");
|
|
40
|
+
})();
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=portable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portable.js","sourceRoot":"","sources":["../../src/plugins/portable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAExE,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAA6B,MAAM,kBAAkB,CAAC;AAMpG,MAAM,CAAC,MAAM,yBAAyB,GAAsB,MAAM,CAAC,MAAM,CAAC;IACxE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO;IACjF,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM;IACpF,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM;IACrF,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ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