@sixb/agent 0.2.4 → 0.2.5
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.md +2 -2
- package/dist/agent-prompt.d.ts.map +1 -1
- package/dist/artifacts/layout-check/layout-check.d.ts +21 -24
- package/dist/artifacts/layout-check/layout-check.d.ts.map +1 -1
- package/dist/artifacts/publish-tool.d.ts.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10590 -8888
- package/dist/index.js.map +30 -26
- package/dist/run-agent-turn.d.ts +3 -14
- package/dist/run-agent-turn.d.ts.map +1 -1
- package/dist/run-environment.d.ts.map +1 -1
- package/dist/run-subagent.d.ts.map +1 -1
- package/dist/sandbox-api-context.d.ts.map +1 -1
- package/dist/search-script.d.ts +7 -0
- package/dist/search-script.d.ts.map +1 -0
- package/dist/skills/built-in.d.ts.map +1 -1
- package/dist/tools/glob.d.ts +41 -0
- package/dist/tools/glob.d.ts.map +1 -0
- package/dist/tools/grep.d.ts +64 -0
- package/dist/tools/grep.d.ts.map +1 -0
- package/dist/tools/model-spec.d.ts.map +1 -1
- package/dist/tools/sandbox-search.d.ts +26 -0
- package/dist/tools/sandbox-search.d.ts.map +1 -0
- package/dist/tools/search/command.d.ts +15 -0
- package/dist/tools/search/command.d.ts.map +1 -0
- package/dist/tools/search/gitignore.d.ts +28 -0
- package/dist/tools/search/gitignore.d.ts.map +1 -0
- package/dist/tools/search/glob.d.ts +15 -0
- package/dist/tools/search/glob.d.ts.map +1 -0
- package/dist/tools/search/main.d.ts +2 -0
- package/dist/tools/search/main.d.ts.map +1 -0
- package/dist/tools/search/match.d.ts +30 -0
- package/dist/tools/search/match.d.ts.map +1 -0
- package/dist/tools/search/pattern.d.ts +19 -0
- package/dist/tools/search/pattern.d.ts.map +1 -0
- package/dist/tools/search/read.d.ts +62 -0
- package/dist/tools/search/read.d.ts.map +1 -0
- package/dist/tools/search/request.d.ts +80 -0
- package/dist/tools/search/request.d.ts.map +1 -0
- package/dist/tools/search/search.d.ts +4 -0
- package/dist/tools/search/search.d.ts.map +1 -0
- package/dist/tools/search/walk.d.ts +43 -0
- package/dist/tools/search/walk.d.ts.map +1 -0
- package/dist/tools/tool-outputs.d.ts.map +1 -1
- package/dist/turn-inbox.d.ts +75 -0
- package/dist/turn-inbox.d.ts.map +1 -0
- package/package.json +6 -4
- package/src/agent-prompt.ts +1 -0
- package/src/agent-runtime/preflight.ts +1 -0
- package/src/artifacts/layout-check/check.cjs +176 -95
- package/src/artifacts/layout-check/layout-check.ts +118 -76
- package/src/artifacts/publish-tool.ts +48 -99
- package/src/generated/search.mjs +985 -0
- package/src/index.ts +0 -1
- package/src/run-agent-turn.ts +85 -129
- package/src/run-conversation-turn.ts +4 -4
- package/src/run-environment.ts +4 -0
- package/src/run-subagent.ts +1 -1
- package/src/sandbox-api-context.ts +3 -0
- package/src/search-script-assets.d.ts +5 -0
- package/src/search-script.ts +9 -0
- package/src/skills/built-in.ts +16 -0
- package/src/skills/sixb-artifacts/SKILL.md +7 -7
- package/src/skills/sixb-artifacts/canvas.md +3 -2
- package/src/skills/sixb-artifacts/document.md +92 -5
- package/src/skills/sixb-artifacts/examples/document/service-proposal/design.css +114 -0
- package/src/skills/sixb-artifacts/examples/document/service-proposal/document.html +159 -0
- package/src/skills/sixb-artifacts/examples/document/service-proposal/images/fieldwise.svg +1 -0
- package/src/skills/sixb-artifacts/examples/document/service-proposal/images/harbor-pine.svg +1 -0
- package/src/skills/sixb-artifacts/queries.md +2 -1
- package/src/tools/glob.ts +124 -0
- package/src/tools/grep.ts +190 -0
- package/src/tools/model-spec.ts +4 -0
- package/src/tools/sandbox-search.ts +219 -0
- package/src/tools/search/command.ts +116 -0
- package/src/tools/search/gitignore.ts +101 -0
- package/src/tools/search/glob.ts +90 -0
- package/src/tools/search/main.ts +9 -0
- package/src/tools/search/match.ts +278 -0
- package/src/tools/search/pattern.ts +178 -0
- package/src/tools/search/read.ts +237 -0
- package/src/tools/search/request.ts +101 -0
- package/src/tools/search/search.ts +297 -0
- package/src/tools/search/walk.ts +145 -0
- package/src/tools/tool-outputs.ts +7 -2
- package/src/turn-inbox.ts +283 -0
- package/dist/artifacts/board-previews.d.ts +0 -41
- package/dist/artifacts/board-previews.d.ts.map +0 -1
- package/src/artifacts/board-previews.ts +0 -218
package/dist/run-agent-turn.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { AgentMessagePart, AgentStepRequestSize } from "@sixb/core";
|
|
2
1
|
import { type AgentContextBudget, type AgentRunSession } from "@sixb/core/internal/agents";
|
|
3
2
|
import { type AgentRunRecord, type AppendAgentMessageInput, type ConversationAgentRunRecord } from "@sixb/core/storage";
|
|
4
3
|
import type { ResolvedAgentExecutionPlan } from "./execution-plan";
|
|
@@ -44,10 +43,10 @@ export interface RunAgentTurnInput {
|
|
|
44
43
|
readonly compactInTurn?: ConversationAgentExecutionEnvironment["compactInTurn"];
|
|
45
44
|
};
|
|
46
45
|
/**
|
|
47
|
-
* Handed the answer so far after each step that completed, as the
|
|
48
|
-
* append: a turn that fails then records
|
|
46
|
+
* Handed the answer so far after each step that completed, as the messages the turn would
|
|
47
|
+
* append: a turn that fails then records them with its failure, and keeps that work.
|
|
49
48
|
*/
|
|
50
|
-
readonly onWork?: (
|
|
49
|
+
readonly onWork?: (messages: readonly AppendAgentMessageInput[]) => void;
|
|
51
50
|
}
|
|
52
51
|
/**
|
|
53
52
|
* How a turn hears the questions its children ask, leaves them waiting when it ends, and waits for
|
|
@@ -75,16 +74,6 @@ export declare function runAgentTurn(input: RunAgentTurnInput): Promise<AgentRun
|
|
|
75
74
|
* Whether the turn holds a call for its requester, as `runs.finish` checks before it pauses: one
|
|
76
75
|
* waiting, or decided and not reported to the model yet, its children's included.
|
|
77
76
|
*/
|
|
78
|
-
/**
|
|
79
|
-
* Mark each step from `fromStep` on as answering a request the turn reduced, for the next turn's
|
|
80
|
-
* estimate not to go by what those calls read.
|
|
81
|
-
*/
|
|
82
|
-
export declare function markReducedSteps(parts: readonly AgentMessagePart[], fromStep: number | undefined): readonly AgentMessagePart[];
|
|
83
|
-
/**
|
|
84
|
-
* Record on each step-start what its request carried, by step: the next turn's context meter
|
|
85
|
-
* reads the system prompt and tools the latest one sent.
|
|
86
|
-
*/
|
|
87
|
-
export declare function recordStepRequests(parts: readonly AgentMessagePart[], requests: readonly (AgentStepRequestSize | undefined)[]): readonly AgentMessagePart[];
|
|
88
77
|
/**
|
|
89
78
|
* Whether the worker's stop, rather than the user's, ended the turn. Whichever fired first wins:
|
|
90
79
|
* the combined turn signal carries the reason of the first source that aborted it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-agent-turn.d.ts","sourceRoot":"","sources":["../src/run-agent-turn.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run-agent-turn.d.ts","sourceRoot":"","sources":["../src/run-agent-turn.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EAOrB,MAAM,4BAA4B,CAAA;AAGnC,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAEhC,MAAM,oBAAoB,CAAA;AAK3B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAA;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,mBAAmB,CAAA;AAE9E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAA;AAErE,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,gBAAgB,CAAA;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE/C,MAAM,WAAW,iBAAiB;IAChC,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAA;IAClC,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,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAA;IACtC,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAA;IACxC,2FAA2F;IAC3F,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAA;IAClC,0EAA0E;IAC1E,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC,WAAW,CAAC,CAAA;CAChD;AAED,6FAA6F;AAC7F,wBAAsB,kCAAkC,CACtD,KAAK,EAAE,uCAAuC,GAC7C,OAAO,CAAC,qCAAqC,CAAC,CAyNhD;AAED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,iCAAiC,CAAC,CAsC5C;AAoND,mFAAmF;AACnF,wBAAsB,kCAAkC,CACtD,KAAK,EAAE,uCAAuC,GAC7C,OAAO,CAAC,yBAAyB,CAAC,CAqDpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-subagent.d.ts","sourceRoot":"","sources":["../src/run-subagent.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EAKrB,MAAM,4BAA4B,CAAA;AAEnC,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAE5B,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAA;AAM3B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"run-subagent.d.ts","sourceRoot":"","sources":["../src/run-subagent.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EAKrB,MAAM,4BAA4B,CAAA;AAEnC,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAEL,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,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAA;IAClC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;IACjC,2FAA2F;IAC3F,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAA;IAClC,gGAAgG;IAChG,QAAQ,CAAC,IAAI,CAAC,EAAE,YAAY,CAAA;IAC5B,uFAAuF;IACvF,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAA;IAChC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAA;CAC9B,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA6G7B;AAkND;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,aAAa,SAAI,GAAG,MAAM,CASrF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-api-context.d.ts","sourceRoot":"","sources":["../src/sandbox-api-context.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,OAAO,EAER,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AACpE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"sandbox-api-context.d.ts","sourceRoot":"","sources":["../src/sandbox-api-context.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,OAAO,EAER,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AACpE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,eAAe,CAAA;AAInE;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,cAAc,CAAA;AACpD,eAAO,MAAM,wBAAwB,2BAA2B,CAAA;AAGhE,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAC/C;AAED,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,gFAAgF;IAChF,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;IACjC,sFAAsF;IACtF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,8BAA8B,CAAA;IACrD,QAAQ,CAAC,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAA;IAChD,iGAAiG;IACjG,QAAQ,CAAC,aAAa,EAAE,SAAS,gBAAgB,EAAE,CAAA;IACnD,qFAAqF;IACrF,QAAQ,CAAC,SAAS,CAAC,EAAE,qBAAqB,CAAA;IAC1C,uEAAuE;IACvE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAA;CACjD;AAED,wBAAsB,6BAA6B,CACjD,KAAK,EAAE,kCAAkC,GACxC,OAAO,CAAC,sBAAsB,CAAC,CAoIjC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The engine of `glob` and `grep`, bundled from `tools/search/` by
|
|
3
|
+
* `bun run generate:search-script`. A run installs it at `lib/search.mjs` and runs it on Bun or
|
|
4
|
+
* Node. Part of this module, so that a program compiled to one file carries it too.
|
|
5
|
+
*/
|
|
6
|
+
export declare const SEARCH_SCRIPT_SOURCE: Uint8Array;
|
|
7
|
+
//# sourceMappingURL=search-script.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-script.d.ts","sourceRoot":"","sources":["../src/search-script.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,UAA6C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"built-in.d.ts","sourceRoot":"","sources":["../../src/skills/built-in.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"built-in.d.ts","sourceRoot":"","sources":["../../src/skills/built-in.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAuGtD;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,oBAAoB,EA0CzD,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,oBAA4D,CAAA;AAEvF,oDAAoD;AACpD,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,SAAS,oBAAoB,EAAE,GAC7C,SAAS,oBAAoB,EAAE,CAEjC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ModelTool } from "@sixb/core/models";
|
|
2
|
+
import type { AgentSandboxHandle } from "../sandbox-handle";
|
|
3
|
+
export declare const GLOB_TOOL_SPEC: {
|
|
4
|
+
readonly name: "glob";
|
|
5
|
+
readonly strict: true;
|
|
6
|
+
readonly description: "Find files by name. A pattern without / matches at any depth (*.md finds every Markdown file); one with / matches from path (src/**/*.ts). Supports *, **, ?, [abc] and {a,b}. Skips .git and what .gitignore excludes, and hidden files and node_modules unless the pattern names them. Returns at most 100 paths, sorted. Prefer this over bash to find files.";
|
|
7
|
+
readonly inputSchema: {
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
pattern: {
|
|
11
|
+
type: string;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
path: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
required: string[];
|
|
20
|
+
additionalProperties: false;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export interface GlobToolInput {
|
|
24
|
+
readonly pattern: string;
|
|
25
|
+
readonly path?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface GlobToolOutput {
|
|
28
|
+
readonly pattern: string;
|
|
29
|
+
/** As the call named it; `.` for the working directory. */
|
|
30
|
+
readonly path: string;
|
|
31
|
+
/** Relative to the working directory when under it, absolute otherwise. */
|
|
32
|
+
readonly files: readonly string[];
|
|
33
|
+
/** More files match than the 100 listed. */
|
|
34
|
+
readonly truncated: boolean;
|
|
35
|
+
/** The search stopped at its deadline. */
|
|
36
|
+
readonly incomplete?: true;
|
|
37
|
+
}
|
|
38
|
+
export declare function createGlobTool(resolveSandbox: () => Promise<AgentSandboxHandle>): ModelTool<GlobToolInput>;
|
|
39
|
+
/** One path per line, then what the list leaves out. */
|
|
40
|
+
export declare function globModelText(output: GlobToolOutput): string;
|
|
41
|
+
//# sourceMappingURL=glob.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/tools/glob.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAY3D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;CAkBjB,CAAA;AAEV,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,4CAA4C;IAC5C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,0CAA0C;IAC1C,QAAQ,CAAC,UAAU,CAAC,EAAE,IAAI,CAAA;CAC3B;AAED,wBAAgB,cAAc,CAC5B,cAAc,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,GAChD,SAAS,CAAC,aAAa,CAAC,CA4B1B;AAED,wDAAwD;AACxD,wBAAgB,aAAa,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAS5D"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ModelTool } from "@sixb/core/models";
|
|
2
|
+
import type { AgentSandboxHandle } from "../sandbox-handle";
|
|
3
|
+
import type { GrepMatch } from "./search/request";
|
|
4
|
+
export declare const GREP_TOOL_SPEC: {
|
|
5
|
+
readonly name: "grep";
|
|
6
|
+
readonly strict: true;
|
|
7
|
+
readonly description: "Search file contents with a JavaScript regular expression, or with literal text. Case is ignored unless the pattern has an uppercase letter. Searches hidden files, and skips .git, node_modules, what .gitignore excludes, binary files and files over 10 MiB. Matches the first 4,000 characters of a line. Returns matching lines grouped by file, at most 100 in all and 20 per file, with line numbers that read takes as its offset. Prefer this over bash to search text.";
|
|
8
|
+
readonly inputSchema: {
|
|
9
|
+
type: string;
|
|
10
|
+
properties: {
|
|
11
|
+
pattern: {
|
|
12
|
+
type: string;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
path: {
|
|
16
|
+
type: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
include: {
|
|
20
|
+
type: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
literal: {
|
|
24
|
+
type: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
required: string[];
|
|
29
|
+
additionalProperties: false;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export interface GrepToolInput {
|
|
33
|
+
readonly pattern: string;
|
|
34
|
+
readonly path?: string;
|
|
35
|
+
readonly include?: string;
|
|
36
|
+
readonly literal?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface GrepToolOutput {
|
|
39
|
+
readonly pattern: string;
|
|
40
|
+
/** As the call named it; `.` for the working directory. */
|
|
41
|
+
readonly path: string;
|
|
42
|
+
/** Paths relative to the working directory when under it, absolute otherwise. */
|
|
43
|
+
readonly matches: readonly GrepMatch[];
|
|
44
|
+
/** How many files the matches are in. */
|
|
45
|
+
readonly files: number;
|
|
46
|
+
/** Matching lines past the 20 a file shows, by path. */
|
|
47
|
+
readonly more?: Readonly<Record<string, number>>;
|
|
48
|
+
/** Another file matches past the 100 lines shown. */
|
|
49
|
+
readonly truncated: boolean;
|
|
50
|
+
/** The search stopped at its deadline. */
|
|
51
|
+
readonly incomplete?: true;
|
|
52
|
+
}
|
|
53
|
+
export declare function createGrepTool(resolveSandbox: () => Promise<AgentSandboxHandle>): ModelTool<GrepToolInput>;
|
|
54
|
+
/**
|
|
55
|
+
* Matches grouped by file, each line with its number, then how many more the file holds:
|
|
56
|
+
*
|
|
57
|
+
* ```
|
|
58
|
+
* src/config.ts
|
|
59
|
+
* 12: const retries = 3
|
|
60
|
+
* … 7 more in this file
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function grepModelText(output: GrepToolOutput): string;
|
|
64
|
+
//# sourceMappingURL=grep.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grep.d.ts","sourceRoot":"","sources":["../../src/tools/grep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAW3D,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,kBAAkB,CAAA;AAEnE,eAAO,MAAM,cAAc;;;;;;;;;;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","sources":["../../src/tools/model-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAChF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAYhE;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,SAAS,aAAa,EAAE,EACtC,OAAO,GAAE;IACP,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,GAAG,CAAC,EAAE,eAAe,CAAA;IAC9B,QAAQ,CAAC,aAAa,CAAC,EAAE,oBAAoB,CAAA;CACzC,GACL,SAAS,aAAa,EAAE,CAe1B;AAED,8FAA8F;AAC9F,wBAAgB,UAAU,CACxB,GAAG,EAAE,eAAe,GAAG,SAAS,EAChC,aAAa,EAAE,oBAAoB,GAAG,SAAS,GAC9C,OAAO,CAET"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AgentToolPublicError } from "@sixb/core";
|
|
2
|
+
import { type AgentSandboxHandle } from "../sandbox-handle";
|
|
3
|
+
import type { GlobSearchRequest, GrepSearchRequest } from "./search/request";
|
|
4
|
+
type SearchTool = "glob" | "grep";
|
|
5
|
+
type SandboxSearchRequest = Omit<GlobSearchRequest, "contextDirectory" | "timeoutMs"> | Omit<GrepSearchRequest, "contextDirectory" | "timeoutMs">;
|
|
6
|
+
/**
|
|
7
|
+
* Search with the run's `lib/search.mjs`, the same in every sandbox and on a computer. The script
|
|
8
|
+
* confines the search to the working directory and the context directory, as `read` does, and
|
|
9
|
+
* prints one JSON line. Returns that result, unchecked.
|
|
10
|
+
*
|
|
11
|
+
* A search that ran too long, or a script that could not search, is the model's to know: it can
|
|
12
|
+
* narrow the search, or fall back to bash.
|
|
13
|
+
*/
|
|
14
|
+
export declare function runSandboxSearch(handle: AgentSandboxHandle, request: SandboxSearchRequest, signal: AbortSignal): Promise<unknown>;
|
|
15
|
+
/**
|
|
16
|
+
* A search the run's script could not make: the model reads why, in words of ours rather than the
|
|
17
|
+
* sandbox's, and the way out. The script's own words stay in the cause.
|
|
18
|
+
*/
|
|
19
|
+
export declare function searchUnavailable(tool: SearchTool, reason: string, cause: unknown): AgentToolPublicError;
|
|
20
|
+
/** An optional value left out: models send `"null"` or `"undefined"` for one. */
|
|
21
|
+
export declare function isLeftOut(value: unknown): boolean;
|
|
22
|
+
export declare function optionalPathInput(value: unknown, tool: SearchTool): string | undefined;
|
|
23
|
+
export declare const INCOMPLETE_SEARCH_FOOTER = "(The search stopped after 20 seconds, before it looked everywhere: narrow the pattern or the path)";
|
|
24
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=sandbox-search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-search.d.ts","sourceRoot":"","sources":["../../src/tools/sandbox-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAsB,MAAM,YAAY,CAAA;AAErE,OAAO,EAAE,KAAK,kBAAkB,EAAe,MAAM,mBAAmB,CAAA;AAGxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAmB,MAAM,kBAAkB,CAAA;AAO7F,KAAK,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;AAEjC,KAAK,oBAAoB,GACrB,IAAI,CAAC,iBAAiB,EAAE,kBAAkB,GAAG,WAAW,CAAC,GACzD,IAAI,CAAC,iBAAiB,EAAE,kBAAkB,GAAG,WAAW,CAAC,CAAA;AAE7D;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,kBAAkB,EAC1B,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,OAAO,CAAC,CAkDlB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,GACb,oBAAoB,CAKtB;AAWD,iFAAiF;AACjF,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQjD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAEtF;AAED,eAAO,MAAM,wBAAwB,uGACiE,CAAA;AAyEtG,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** What the process prints, and the code it exits with. */
|
|
2
|
+
export interface SearchCommandResult {
|
|
3
|
+
readonly exitCode: number;
|
|
4
|
+
readonly stdout: string;
|
|
5
|
+
readonly stderr: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* `search.mjs '<request JSON>'`: the Agent's `glob` and `grep`, the same in every sandbox. The
|
|
9
|
+
* request is one JSON argument, so no shell quoting reaches a pattern; the result is one JSON
|
|
10
|
+
* line. A search that cannot run exits 2 with `{"error":{"code","message"}}` on stderr: a request
|
|
11
|
+
* it does not understand is `invalid_arguments`, and a search the request names wrongly has its
|
|
12
|
+
* own code ({@link SearchError}). Anything else exits 3, as `internal_error`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function runSearchCommand(args: readonly string[], workingDirectory: string): Promise<SearchCommandResult>;
|
|
15
|
+
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/tools/search/command.ts"],"names":[],"mappings":"AAeA,2DAA2D;AAC3D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,mBAAmB,CAAC,CAgB9B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** One line of a `.gitignore`. */
|
|
2
|
+
export interface IgnoreRule {
|
|
3
|
+
/** `!pattern`: brings back what an earlier rule excluded. */
|
|
4
|
+
readonly negated: boolean;
|
|
5
|
+
/** `pattern/`: matches folders only. */
|
|
6
|
+
readonly folderOnly: boolean;
|
|
7
|
+
/** No `/` but a trailing one: matches a name at any depth below the file's folder. */
|
|
8
|
+
readonly anyDepth: boolean;
|
|
9
|
+
readonly regex: RegExp;
|
|
10
|
+
}
|
|
11
|
+
/** A `.gitignore` and the folder it applies to, an absolute path. */
|
|
12
|
+
export interface IgnoreFile {
|
|
13
|
+
readonly folder: string;
|
|
14
|
+
readonly rules: readonly IgnoreRule[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parse a `.gitignore` as git reads it. A line that is not a valid pattern is skipped, as git
|
|
18
|
+
* skips it.
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseGitignore(text: string): IgnoreRule[];
|
|
21
|
+
/**
|
|
22
|
+
* Whether the `.gitignore` files that apply exclude an entry, given as an absolute path. Files
|
|
23
|
+
* come from the outermost folder in, and a later rule wins over an earlier one, so a deeper file
|
|
24
|
+
* overrides its parents. What lies inside an excluded folder is never asked about: the walk does
|
|
25
|
+
* not enter it, so a rule cannot bring it back, as in git.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isIgnored(files: readonly IgnoreFile[], path: string, isFolder: boolean): boolean;
|
|
28
|
+
//# sourceMappingURL=gitignore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitignore.d.ts","sourceRoot":"","sources":["../../../src/tools/search/gitignore.ts"],"names":[],"mappings":"AAEA,kCAAkC;AAClC,MAAM,WAAW,UAAU;IACzB,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,wCAAwC;IACxC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,sFAAsF;IACtF,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,qEAAqE;AACrE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAA;CACtC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,CAYzD;AAyCD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAkBhG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A `glob` pattern, matched against paths relative to where the search starts. A pattern without
|
|
3
|
+
* `/` matches a name at any depth (`*.md` finds every Markdown file), as in `.gitignore`; one with
|
|
4
|
+
* `/` matches from the start, with `**` for any number of folders.
|
|
5
|
+
*/
|
|
6
|
+
export interface GlobMatcher {
|
|
7
|
+
matches(relativePath: string): boolean;
|
|
8
|
+
/** Whether a folder, relative to where the search starts, may hold a match. */
|
|
9
|
+
mayContain(relativeFolder: string): boolean;
|
|
10
|
+
/** A segment starts with `.`: the pattern looks for hidden files. */
|
|
11
|
+
readonly namesHidden: boolean;
|
|
12
|
+
readonly namesNodeModules: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function compileGlob(pattern: string): GlobMatcher;
|
|
15
|
+
//# sourceMappingURL=glob.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../../src/tools/search/glob.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAA;IACtC,+EAA+E;IAC/E,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAA;IAC3C,qEAAqE;IACrE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAA;CACnC;AASD,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CA0CxD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/tools/search/main.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Where a line first matched `grep`'s pattern, in UTF-16 units. */
|
|
2
|
+
export interface LineMatch {
|
|
3
|
+
readonly index: number;
|
|
4
|
+
readonly length: number;
|
|
5
|
+
}
|
|
6
|
+
export interface TextMatcher {
|
|
7
|
+
/**
|
|
8
|
+
* Where a line first matches, over its first {@link SEARCH_LIMITS.matchCharacters} characters.
|
|
9
|
+
*/
|
|
10
|
+
line(line: string): LineMatch | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Whether any line of a file may match: false only when none does, so a file that cannot match
|
|
13
|
+
* is never split into lines. It may say true of a file with no matching line.
|
|
14
|
+
*/
|
|
15
|
+
mayMatch(text: string): boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* `grep`'s pattern, matched line by line. Case is smart: ignored when the pattern has no uppercase
|
|
19
|
+
* letter. Literal text is a plain substring search, which no line can slow down.
|
|
20
|
+
*/
|
|
21
|
+
export declare function textMatcher(pattern: string, literal: boolean): TextMatcher;
|
|
22
|
+
/** A file's lines, without their `\n` or `\r\n`. */
|
|
23
|
+
export declare function lines(text: string): string[];
|
|
24
|
+
/**
|
|
25
|
+
* A line as `grep` shows it: whole when it fits, else cut to {@link SEARCH_LIMITS.lineCharacters}
|
|
26
|
+
* characters around its first match, so a match far into a minified line is still seen. A cut
|
|
27
|
+
* never splits a character written as two units.
|
|
28
|
+
*/
|
|
29
|
+
export declare function cutLine(line: string, match: LineMatch): string;
|
|
30
|
+
//# sourceMappingURL=match.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../../src/tools/search/match.ts"],"names":[],"mappings":"AAEA,oEAAoE;AACpE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;IACzC;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;CAChC;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,WAAW,CAE1E;AAiND,oDAAoD;AACpD,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAI5C;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,CAkB9D"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path patterns, as `glob` and `.gitignore` write them: `*` and `?` within a name, `[abc]`,
|
|
3
|
+
* `[!abc]` and `[^abc]`, `**` as a whole segment for any number of folders, `\` to escape.
|
|
4
|
+
* `{a,b}` belongs to `glob` alone and is expanded before compiling ({@link expandBraces}).
|
|
5
|
+
*/
|
|
6
|
+
export declare class PatternError extends Error {
|
|
7
|
+
}
|
|
8
|
+
/** A pattern's regular expression source, for a whole path relative to where it applies. */
|
|
9
|
+
export declare function pathPatternSource(pattern: string): string;
|
|
10
|
+
/** One name's source: never crosses a `/`. */
|
|
11
|
+
export declare function segmentSource(segment: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Expand `{a,b}` into its alternatives, nested ones included. A brace without a comma, or that
|
|
14
|
+
* never closes, is a literal brace.
|
|
15
|
+
*/
|
|
16
|
+
export declare function expandBraces(pattern: string): string[];
|
|
17
|
+
/** Compile a regular expression source, or say why the pattern is not one. */
|
|
18
|
+
export declare function compilePattern(source: string, flags?: string): RegExp;
|
|
19
|
+
//# sourceMappingURL=pattern.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../../../src/tools/search/pattern.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,qBAAa,YAAa,SAAQ,KAAK;CAAG;AAE1C,4FAA4F;AAC5F,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAkBzD;AAED,8CAA8C;AAC9C,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA4BrD;AAmCD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAItD;AA0DD,8EAA8E;AAC9E,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,MAAM,CAMjE"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export type FileText = {
|
|
2
|
+
readonly text: string;
|
|
3
|
+
} | {
|
|
4
|
+
readonly skipped: "binary" | "too_large" | "unreadable";
|
|
5
|
+
};
|
|
6
|
+
/** A read that knows what it will hold before it holds it. */
|
|
7
|
+
export interface PendingRead<R> {
|
|
8
|
+
/** The bytes the read holds once started, until its result is taken. */
|
|
9
|
+
readonly bytes: number;
|
|
10
|
+
/** Never rejects. */
|
|
11
|
+
read(): Promise<R>;
|
|
12
|
+
/** Lets go of a read never started. Never rejects. */
|
|
13
|
+
close(): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A file opened to be read: one open, and its size from that descriptor. Its text comes from
|
|
17
|
+
* {@link PendingRead.read}, unless it is too large or unreadable, which is known already.
|
|
18
|
+
*/
|
|
19
|
+
export declare function openText(path: string, strict: boolean): Promise<PendingRead<FileText>>;
|
|
20
|
+
/**
|
|
21
|
+
* How far reads run ahead of the file searched. Reading is most of a search's time, and mostly
|
|
22
|
+
* waiting: reads in flight overlap that wait. At most {@link READ_AHEAD} files are open, and a read
|
|
23
|
+
* starts only while the reads started hold at most {@link READ_AHEAD_BYTES} of file with it, but
|
|
24
|
+
* for the next file in line, which always starts: one file of 10 MiB past the bound at most. A
|
|
25
|
+
* binary file's bytes are let go once its first bytes show it is one.
|
|
26
|
+
*
|
|
27
|
+
* Memory: the texts read ahead take up to twice their bytes once decoded (a string with one
|
|
28
|
+
* character beyond Latin-1 takes two bytes for each): 52 MiB at worst, plus the file searched and
|
|
29
|
+
* the copies its search makes. 16 MiB reads a source tree as fast as 32 did, and holds half as
|
|
30
|
+
* much over a folder of large files.
|
|
31
|
+
*/
|
|
32
|
+
export declare const READ_AHEAD = 32;
|
|
33
|
+
export declare const READ_AHEAD_BYTES: number;
|
|
34
|
+
/**
|
|
35
|
+
* Files read ahead of the one searched, handed back in the order they come, so a search finds the
|
|
36
|
+
* same lines, in the same order, as reading one file at a time. Files are opened as they come,
|
|
37
|
+
* and read as soon as they are open and their bytes fit. A search that stops reads no further than
|
|
38
|
+
* {@link READ_AHEAD} files past where it stopped.
|
|
39
|
+
*/
|
|
40
|
+
export declare class ReadAhead<T, R> {
|
|
41
|
+
#private;
|
|
42
|
+
private readonly items;
|
|
43
|
+
/** Never rejects. */
|
|
44
|
+
private readonly open;
|
|
45
|
+
/** What a read that holds nothing once done looks like, a binary file. */
|
|
46
|
+
private readonly holdsNothing;
|
|
47
|
+
constructor(items: Iterator<T>,
|
|
48
|
+
/** Never rejects. */
|
|
49
|
+
open: (item: T) => Promise<PendingRead<R>>,
|
|
50
|
+
/** What a read that holds nothing once done looks like, a binary file. */
|
|
51
|
+
holdsNothing?: (result: R) => boolean);
|
|
52
|
+
next(): Promise<{
|
|
53
|
+
readonly item: T;
|
|
54
|
+
readonly read: R;
|
|
55
|
+
} | undefined>;
|
|
56
|
+
/**
|
|
57
|
+
* Starts no other read, waits for those in flight and closes the files never read: no file
|
|
58
|
+
* stays open past the search.
|
|
59
|
+
*/
|
|
60
|
+
stop(): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../src/tools/search/read.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,QAAQ,GAChB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,GAAG,WAAW,GAAG,YAAY,CAAA;CAAE,CAAA;AAE/D,8DAA8D;AAC9D,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,qBAAqB;IACrB,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,CAAA;IAClB,sDAAsD;IACtD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACvB;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAsB5F;AAsED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,KAAK,CAAA;AAC5B,eAAO,MAAM,gBAAgB,QAAmB,CAAA;AAahD;;;;;GAKG;AACH,qBAAa,SAAS,CAAC,CAAC,EAAE,CAAC;;IAOvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,qBAAqB;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,0EAA0E;IAC1E,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAJZ,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IACnC,qBAAqB;IACJ,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAC3D,0EAA0E;IACzD,YAAY,GAAE,CAAC,MAAM,EAAE,CAAC,KAAK,OAAqB;IAG/D,IAAI,IAAI,OAAO,CAAC;QAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;KAAE,GAAG,SAAS,CAAC;IAiBzE;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAuD5B"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `search.mjs` takes and prints: the contract between the `glob` and `grep` tools and the
|
|
3
|
+
* engine the run installs.
|
|
4
|
+
*/
|
|
5
|
+
/** How much a search returns, and which files `grep` reads. */
|
|
6
|
+
export declare const SEARCH_LIMITS: {
|
|
7
|
+
readonly files: 100;
|
|
8
|
+
readonly lines: 100;
|
|
9
|
+
readonly linesPerFile: 20;
|
|
10
|
+
readonly lineCharacters: 500;
|
|
11
|
+
/** How much of a cut line shows before its first match. */
|
|
12
|
+
readonly matchLead: 40;
|
|
13
|
+
/**
|
|
14
|
+
* How much of a line `grep` matches. A backtracking regex can take seconds on one long line of a
|
|
15
|
+
* minified file; past this, a match is missed rather than the search stalled.
|
|
16
|
+
*/
|
|
17
|
+
readonly matchCharacters: 4000;
|
|
18
|
+
/** What `grep`'s matches may add to its model text, in UTF-8 bytes, before it is truncated. */
|
|
19
|
+
readonly textBytes: number;
|
|
20
|
+
readonly fileBytes: number;
|
|
21
|
+
/** A NUL byte in this many first bytes makes a file binary. */
|
|
22
|
+
readonly binaryProbeBytes: number;
|
|
23
|
+
};
|
|
24
|
+
interface SearchScopeRequest {
|
|
25
|
+
/** Relative to the working directory, or absolute. Default: the working directory. */
|
|
26
|
+
readonly path?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The run's context directory: the second root a search may start from. A search that starts
|
|
29
|
+
* outside it never enters it.
|
|
30
|
+
*/
|
|
31
|
+
readonly contextDirectory?: string;
|
|
32
|
+
/** How long the walk may take before it stops with what it found. */
|
|
33
|
+
readonly timeoutMs: number;
|
|
34
|
+
}
|
|
35
|
+
export interface GlobSearchRequest extends SearchScopeRequest {
|
|
36
|
+
readonly tool: "glob";
|
|
37
|
+
readonly pattern: string;
|
|
38
|
+
}
|
|
39
|
+
export interface GrepSearchRequest extends SearchScopeRequest {
|
|
40
|
+
readonly tool: "grep";
|
|
41
|
+
/** A JavaScript regular expression, or the text itself with `literal`. */
|
|
42
|
+
readonly pattern: string;
|
|
43
|
+
/** A `glob` pattern the files searched must match. */
|
|
44
|
+
readonly include?: string;
|
|
45
|
+
readonly literal?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export type SearchRequest = GlobSearchRequest | GrepSearchRequest;
|
|
48
|
+
/**
|
|
49
|
+
* Paths are relative to the working directory when they are under it, absolute otherwise.
|
|
50
|
+
* `incomplete` says the walk stopped at its deadline.
|
|
51
|
+
*/
|
|
52
|
+
export interface GlobSearchResult {
|
|
53
|
+
readonly files: string[];
|
|
54
|
+
readonly truncated: boolean;
|
|
55
|
+
readonly incomplete?: true;
|
|
56
|
+
}
|
|
57
|
+
export interface GrepMatch {
|
|
58
|
+
readonly path: string;
|
|
59
|
+
/** One-based. */
|
|
60
|
+
readonly line: number;
|
|
61
|
+
readonly text: string;
|
|
62
|
+
}
|
|
63
|
+
export interface GrepSearchResult {
|
|
64
|
+
readonly matches: GrepMatch[];
|
|
65
|
+
/** How many files the matches are in. */
|
|
66
|
+
readonly files: number;
|
|
67
|
+
/** Matching lines counted past what a file shows, by path. */
|
|
68
|
+
readonly more?: Record<string, number>;
|
|
69
|
+
/** Another file matches past the cap. */
|
|
70
|
+
readonly truncated: boolean;
|
|
71
|
+
readonly incomplete?: true;
|
|
72
|
+
}
|
|
73
|
+
export type SearchErrorCode = "path_missing" | "path_outside" | "path_is_file" | "path_not_searchable" | "invalid_pattern" | "invalid_include" | "file_binary" | "file_too_large";
|
|
74
|
+
/** A search that cannot run as asked: the caller says why in its own words. */
|
|
75
|
+
export declare class SearchError extends Error {
|
|
76
|
+
readonly code: SearchErrorCode;
|
|
77
|
+
constructor(code: SearchErrorCode, message: string);
|
|
78
|
+
}
|
|
79
|
+
export {};
|
|
80
|
+
//# sourceMappingURL=request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../src/tools/search/request.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,+DAA+D;AAC/D,eAAO,MAAM,aAAa;;;;;IAKxB,2DAA2D;;IAE3D;;;OAGG;;IAEH,+FAA+F;;;IAG/F,+DAA+D;;CAEvD,CAAA;AAEV,UAAU,kBAAkB;IAC1B,sFAAsF;IACtF,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAClC,qEAAqE;IACrE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,sDAAsD;IACtD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,iBAAiB,CAAA;AAEjE;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAA;IACxB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,IAAI,CAAA;CAC3B;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,iBAAiB;IACjB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,SAAS,EAAE,CAAA;IAC7B,yCAAyC;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtC,yCAAyC;IACzC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,IAAI,CAAA;CAC3B;AAED,MAAM,MAAM,eAAe,GACvB,cAAc,GACd,cAAc,GACd,cAAc,GACd,qBAAqB,GACrB,iBAAiB,GACjB,iBAAiB,GACjB,aAAa,GACb,gBAAgB,CAAA;AAEpB,+EAA+E;AAC/E,qBAAa,WAAY,SAAQ,KAAK;IAElC,QAAQ,CAAC,IAAI,EAAE,eAAe;gBAArB,IAAI,EAAE,eAAe,EAC9B,OAAO,EAAE,MAAM;CAKlB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type GlobSearchRequest, type GlobSearchResult, type GrepSearchRequest, type GrepSearchResult } from "./request";
|
|
2
|
+
export declare function globFiles(request: GlobSearchRequest, workingDirectory: string): GlobSearchResult;
|
|
3
|
+
export declare function grepFiles(request: GrepSearchRequest, workingDirectory: string): Promise<GrepSearchResult>;
|
|
4
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/tools/search/search.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAErB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAKtB,MAAM,WAAW,CAAA;AAGlB,wBAAgB,SAAS,CAAC,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,GAAG,gBAAgB,CAmBhG;AAED,wBAAsB,SAAS,CAC7B,OAAO,EAAE,iBAAiB,EAC1B,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,gBAAgB,CAAC,CAmG3B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type IgnoreFile } from "./gitignore";
|
|
2
|
+
export interface WalkOptions {
|
|
3
|
+
/** The folder to walk: a real, absolute path. */
|
|
4
|
+
readonly root: string;
|
|
5
|
+
/** The `.gitignore` files of the folders above the root that apply, outermost first. */
|
|
6
|
+
readonly ignoreFiles: readonly IgnoreFile[];
|
|
7
|
+
/** Enter folders and list files whose name starts with `.`. */
|
|
8
|
+
readonly hidden: boolean;
|
|
9
|
+
readonly nodeModules: boolean;
|
|
10
|
+
/** Real, absolute paths of folders never entered: the run's context directory. */
|
|
11
|
+
readonly skipFolders: ReadonlySet<string>;
|
|
12
|
+
/** Whether a folder, relative to the root, may hold what the search looks for. */
|
|
13
|
+
readonly mayContain?: (relativeFolder: string) => boolean;
|
|
14
|
+
/** The time, in epoch milliseconds, at which the walk stops. */
|
|
15
|
+
readonly deadline: number;
|
|
16
|
+
}
|
|
17
|
+
export interface WalkedFile {
|
|
18
|
+
readonly path: string;
|
|
19
|
+
/** From the root, with `/`. */
|
|
20
|
+
readonly relative: string;
|
|
21
|
+
/** A link to a file: listed, but its target may be anywhere. */
|
|
22
|
+
readonly symlink: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The files under a folder, in byte order of their paths, so that the first results of a capped
|
|
26
|
+
* search are the same on every run. `.git`, hidden entries and `node_modules` unless asked for,
|
|
27
|
+
* what `.gitignore` files exclude, and unreadable entries are skipped. Links to folders are not
|
|
28
|
+
* followed. Past its deadline, the walk stops and says it is {@link incomplete}.
|
|
29
|
+
*/
|
|
30
|
+
export declare class FileWalk {
|
|
31
|
+
#private;
|
|
32
|
+
private readonly options;
|
|
33
|
+
constructor(options: WalkOptions);
|
|
34
|
+
get incomplete(): boolean;
|
|
35
|
+
files(): Generator<WalkedFile>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A folder's `.gitignore`, or another ignore file applying from it, when it is a regular file it
|
|
39
|
+
* can read. A link is not followed, as git does not, and a device or a FIFO is never opened.
|
|
40
|
+
*/
|
|
41
|
+
export declare function readIgnoreFile(folder: string, name?: string): IgnoreFile | undefined;
|
|
42
|
+
export declare function childPath(folder: string, name: string): string;
|
|
43
|
+
//# sourceMappingURL=walk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../../../src/tools/search/walk.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAA6B,MAAM,aAAa,CAAA;AAExE,MAAM,WAAW,WAAW;IAC1B,iDAAiD;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,wFAAwF;IACxF,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAA;IAC3C,+DAA+D;IAC/D,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAA;IAC7B,kFAAkF;IAClF,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACzC,kFAAkF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