@huanlin/dsh-plugin-better-glob 0.1.0 → 0.1.2
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/lib/index.js +7 -6
- package/lib/types/index.d.ts +4 -1
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { FIRST_PARTY_SECTION_ORDER } from "@deepseek-ai/dsh-system-prompt";
|
|
2
1
|
import z from "schemastery";
|
|
3
2
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
4
3
|
import { runRipgrep, sampleAcrossTopLevel, toWorkdirRelative, trySaveFormattedResult } from "@deepseek-ai/dsh-tool-fs-search";
|
|
@@ -415,14 +414,16 @@ const inject = [
|
|
|
415
414
|
* the built-in text; the section text names the configured exclusions and
|
|
416
415
|
* the include whitelist escape hatch.
|
|
417
416
|
* @param caps - the deployment's resolved caps.
|
|
417
|
+
* @param order - the section order for `tool:glob` (resolve via
|
|
418
|
+
* `ctx.systemPrompt.getSectionOrder('TOOL_GLOB')` so the shadow stays
|
|
419
|
+
* aligned with the built-in registration).
|
|
418
420
|
* @returns the section to register through `agent.ctx.systemPrompt`.
|
|
419
421
|
*/
|
|
420
|
-
function shadowSection(caps) {
|
|
421
|
-
const excluded = caps.excludeDirs.length > 0 ? `Bottomless directories (${caps.excludeDirs.join(", ")}) are excluded automatically — pass include (for example ["node_modules/**"]) when a search must look inside one.` : "No directories are excluded by configuration.";
|
|
422
|
+
function shadowSection(caps, order) {
|
|
422
423
|
return {
|
|
423
424
|
name: "tool:glob",
|
|
424
|
-
order
|
|
425
|
-
text: "Use the glob tool — not shell find — to discover files by path pattern. A pattern with no \"/\" matches basenames at any depth, so \"*\" matches every file in the tree rather than its top level. Results are files only, never directories, and include hidden and ignored files. " + excluded + " A result that fits comes back in modification-time order."
|
|
425
|
+
order,
|
|
426
|
+
text: "Use the glob tool — not shell find — to discover files by path pattern. A pattern with no \"/\" matches basenames at any depth, so \"*\" matches every file in the tree rather than its top level. Results are files only, never directories, and include hidden and ignored files. " + (caps.excludeDirs.length > 0 ? `Bottomless directories (${caps.excludeDirs.join(", ")}) are excluded automatically — pass include (for example ["node_modules/**"]) when a search must look inside one.` : "No directories are excluded by configuration.") + " A result that fits comes back in modification-time order."
|
|
426
427
|
};
|
|
427
428
|
}
|
|
428
429
|
/** Register the shadow into one agent's own layer; returns the combined disposer for reload resync. */
|
|
@@ -451,7 +452,7 @@ const shadowed = /* @__PURE__ */ new WeakMap();
|
|
|
451
452
|
function apply(ctx, config) {
|
|
452
453
|
const caps = resolveConfig(config);
|
|
453
454
|
const tool = defineBetterGlobTool(ctx, caps);
|
|
454
|
-
const section = shadowSection(caps);
|
|
455
|
+
const section = shadowSection(caps, ctx.systemPrompt.getSectionOrder("TOOL_GLOB"));
|
|
455
456
|
const shadow = (agent) => {
|
|
456
457
|
if (shadowed.has(agent)) return;
|
|
457
458
|
shadowed.set(agent, shadowAgent(agent, tool, section));
|
package/lib/types/index.d.ts
CHANGED
|
@@ -57,9 +57,12 @@ export type { BetterGlobCaps } from './caps.ts';
|
|
|
57
57
|
* the built-in text; the section text names the configured exclusions and
|
|
58
58
|
* the include whitelist escape hatch.
|
|
59
59
|
* @param caps - the deployment's resolved caps.
|
|
60
|
+
* @param order - the section order for `tool:glob` (resolve via
|
|
61
|
+
* `ctx.systemPrompt.getSectionOrder('TOOL_GLOB')` so the shadow stays
|
|
62
|
+
* aligned with the built-in registration).
|
|
60
63
|
* @returns the section to register through `agent.ctx.systemPrompt`.
|
|
61
64
|
*/
|
|
62
|
-
export declare function shadowSection(caps: BetterGlobCaps): PromptSection;
|
|
65
|
+
export declare function shadowSection(caps: BetterGlobCaps, order: number): PromptSection;
|
|
63
66
|
/**
|
|
64
67
|
* Register the better-`glob` shadow: a `agent/session-start` listener that
|
|
65
68
|
* mounts the tool and prompt section into every agent's own layer, plus a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huanlin/dsh-plugin-better-glob",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
36
|
-
"@deepseek-ai/dsh-agent": "^0.1.
|
|
37
|
-
"@deepseek-ai/dsh-system-prompt": "^0.1.
|
|
38
|
-
"@deepseek-ai/dsh-tool-fs-search": "^0.1.
|
|
39
|
-
"@deepseek-ai/dsh-tools": "^0.1.
|
|
36
|
+
"@deepseek-ai/dsh-agent": "^0.1.5-rc.1",
|
|
37
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.5-rc.1",
|
|
38
|
+
"@deepseek-ai/dsh-tool-fs-search": "^0.1.5-rc.1",
|
|
39
|
+
"@deepseek-ai/dsh-tools": "^0.1.5-rc.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependenciesMeta": {
|
|
42
42
|
"@deepseek-ai/cordis": {
|