@johannes.latzel/llm-chat-shell 0.2.0 → 0.4.0
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/lib/env.d.ts +6 -27
- package/dist/lib/env.d.ts.map +1 -1
- package/dist/lib/env.js +22 -64
- package/dist/lib/env.js.map +1 -1
- package/dist/lib/permission.d.ts +0 -1
- package/dist/lib/permission.d.ts.map +1 -1
- package/dist/lib/permission.js +9 -31
- package/dist/lib/permission.js.map +1 -1
- package/dist/tools/shell-command-tool.d.ts +15 -6
- package/dist/tools/shell-command-tool.d.ts.map +1 -1
- package/dist/tools/shell-command-tool.js +76 -34
- package/dist/tools/shell-command-tool.js.map +1 -1
- package/dist/tools/shell-create-tool.d.ts +1 -1
- package/dist/tools/shell-create-tool.d.ts.map +1 -1
- package/dist/tools/shell-create-tool.js +1 -1
- package/dist/tools/shell-create-tool.js.map +1 -1
- package/dist/tools/shell-job-status-tool.d.ts +1 -1
- package/dist/tools/shell-job-status-tool.d.ts.map +1 -1
- package/dist/tools/shell-job-status-tool.js +1 -1
- package/dist/tools/shell-job-status-tool.js.map +1 -1
- package/dist/tools/shell-jobs-tool.d.ts +1 -1
- package/dist/tools/shell-jobs-tool.d.ts.map +1 -1
- package/dist/tools/shell-jobs-tool.js +1 -1
- package/dist/tools/shell-jobs-tool.js.map +1 -1
- package/dist/tools/shell-package.d.ts +1 -1
- package/dist/tools/shell-package.d.ts.map +1 -1
- package/dist/tools/shell-package.js +1 -1
- package/dist/tools/shell-package.js.map +1 -1
- package/dist/tools/shell-permissions-tool.d.ts +1 -1
- package/dist/tools/shell-permissions-tool.d.ts.map +1 -1
- package/dist/tools/shell-permissions-tool.js +1 -1
- package/dist/tools/shell-permissions-tool.js.map +1 -1
- package/package.json +7 -7
- package/dist/lib/glob.d.ts +0 -35
- package/dist/lib/glob.d.ts.map +0 -1
- package/dist/lib/glob.js +0 -56
- package/dist/lib/glob.js.map +0 -1
package/dist/lib/env.d.ts
CHANGED
|
@@ -1,34 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Read a string environment variable with an optional fallback default.
|
|
3
|
-
* Returns `defaultValue` when the variable is unset or empty.
|
|
4
|
-
*/
|
|
1
|
+
/** Read a string environment variable with an optional fallback default. */
|
|
5
2
|
export declare function envString(key: string, defaultValue?: string): string | undefined;
|
|
6
|
-
/**
|
|
7
|
-
* Read an optional string environment variable.
|
|
8
|
-
* Returns `undefined` when the variable is unset or empty.
|
|
9
|
-
*/
|
|
3
|
+
/** Read an optional string environment variable. */
|
|
10
4
|
export declare function envOptionalString(key: string): string | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Read an integer environment variable with an optional fallback default.
|
|
13
|
-
* Returns `defaultValue` when the variable is unset, empty, or not a valid integer.
|
|
14
|
-
*/
|
|
5
|
+
/** Read an integer environment variable with an optional fallback default. */
|
|
15
6
|
export declare function envInt(key: string, defaultValue?: number): number | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Read a float environment variable with an optional fallback default.
|
|
18
|
-
* Returns `defaultValue` when the variable is unset, empty, or not a valid number.
|
|
19
|
-
*/
|
|
7
|
+
/** Read a float environment variable with an optional fallback default. */
|
|
20
8
|
export declare function envFloat(key: string, defaultValue?: number): number | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* Read a boolean environment variable. Returns `true` only when the value is the string `"true"`.
|
|
23
|
-
* Returns `defaultValue` when the variable is unset or empty.
|
|
24
|
-
*/
|
|
9
|
+
/** Read a boolean environment variable. */
|
|
25
10
|
export declare function envBool(key: string, defaultValue: boolean): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Read an enum environment variable constrained to a set of valid string values.
|
|
28
|
-
* Returns `defaultValue` when the variable is unset, empty, or not one of the
|
|
29
|
-
* accepted values.
|
|
30
|
-
*
|
|
31
|
-
* @typeParam T - The string literal type of the valid values.
|
|
32
|
-
*/
|
|
11
|
+
/** Read an enum environment variable constrained to a set of valid string values. */
|
|
33
12
|
export declare function envEnum<T extends string>(key: string, validValues: readonly T[], defaultValue?: T): T | undefined;
|
|
34
13
|
//# sourceMappingURL=env.d.ts.map
|
package/dist/lib/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/lib/env.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/lib/env.ts"],"names":[],"mappings":"AAiBA,4EAA4E;AAC5E,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEhF;AAED,oDAAoD;AACpD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEjE;AAED,8EAA8E;AAC9E,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE7E;AAED,2EAA2E;AAC3E,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE/E;AAED,2CAA2C;AAC3C,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,OAAO,CAEnE;AAED,qFAAqF;AACrF,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EACpC,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,SAAS,CAAC,EAAE,EACzB,YAAY,CAAC,EAAE,CAAC,GACjB,CAAC,GAAG,SAAS,CAEf"}
|
package/dist/lib/env.js
CHANGED
|
@@ -1,77 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { createEnvReader, EmptyStringPolicy, NumberParsing, RangePolicy } from '@johannes.latzel/env';
|
|
2
|
+
function makeEnv() {
|
|
3
|
+
return createEnvReader({
|
|
4
|
+
emptyString: EmptyStringPolicy.Unset,
|
|
5
|
+
numberParsing: NumberParsing.Lenient,
|
|
6
|
+
rangePolicy: RangePolicy.Fallback,
|
|
7
|
+
booleanTrue: ['true'],
|
|
8
|
+
booleanFalse: ['false']
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
/** Read a string environment variable with an optional fallback default. */
|
|
5
12
|
export function envString(key, defaultValue) {
|
|
6
|
-
|
|
7
|
-
if (value === undefined || value === '') {
|
|
8
|
-
return defaultValue;
|
|
9
|
-
}
|
|
10
|
-
return value;
|
|
13
|
+
return makeEnv().string(key, defaultValue);
|
|
11
14
|
}
|
|
12
|
-
/**
|
|
13
|
-
* Read an optional string environment variable.
|
|
14
|
-
* Returns `undefined` when the variable is unset or empty.
|
|
15
|
-
*/
|
|
15
|
+
/** Read an optional string environment variable. */
|
|
16
16
|
export function envOptionalString(key) {
|
|
17
|
-
return
|
|
17
|
+
return makeEnv().optionalString(key);
|
|
18
18
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Read an integer environment variable with an optional fallback default.
|
|
21
|
-
* Returns `defaultValue` when the variable is unset, empty, or not a valid integer.
|
|
22
|
-
*/
|
|
19
|
+
/** Read an integer environment variable with an optional fallback default. */
|
|
23
20
|
export function envInt(key, defaultValue) {
|
|
24
|
-
|
|
25
|
-
if (value === undefined || value === '') {
|
|
26
|
-
return defaultValue;
|
|
27
|
-
}
|
|
28
|
-
const parsed = parseInt(value, 10);
|
|
29
|
-
if (isNaN(parsed)) {
|
|
30
|
-
return defaultValue;
|
|
31
|
-
}
|
|
32
|
-
return parsed;
|
|
21
|
+
return makeEnv().int(key, defaultValue);
|
|
33
22
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Read a float environment variable with an optional fallback default.
|
|
36
|
-
* Returns `defaultValue` when the variable is unset, empty, or not a valid number.
|
|
37
|
-
*/
|
|
23
|
+
/** Read a float environment variable with an optional fallback default. */
|
|
38
24
|
export function envFloat(key, defaultValue) {
|
|
39
|
-
|
|
40
|
-
if (value === undefined || value === '') {
|
|
41
|
-
return defaultValue;
|
|
42
|
-
}
|
|
43
|
-
const parsed = parseFloat(value);
|
|
44
|
-
if (isNaN(parsed)) {
|
|
45
|
-
return defaultValue;
|
|
46
|
-
}
|
|
47
|
-
return parsed;
|
|
25
|
+
return makeEnv().float(key, defaultValue);
|
|
48
26
|
}
|
|
49
|
-
/**
|
|
50
|
-
* Read a boolean environment variable. Returns `true` only when the value is the string `"true"`.
|
|
51
|
-
* Returns `defaultValue` when the variable is unset or empty.
|
|
52
|
-
*/
|
|
27
|
+
/** Read a boolean environment variable. */
|
|
53
28
|
export function envBool(key, defaultValue) {
|
|
54
|
-
|
|
55
|
-
if (value === undefined || value === '') {
|
|
56
|
-
return defaultValue;
|
|
57
|
-
}
|
|
58
|
-
return value === 'true';
|
|
29
|
+
return makeEnv().bool(key, defaultValue);
|
|
59
30
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Read an enum environment variable constrained to a set of valid string values.
|
|
62
|
-
* Returns `defaultValue` when the variable is unset, empty, or not one of the
|
|
63
|
-
* accepted values.
|
|
64
|
-
*
|
|
65
|
-
* @typeParam T - The string literal type of the valid values.
|
|
66
|
-
*/
|
|
31
|
+
/** Read an enum environment variable constrained to a set of valid string values. */
|
|
67
32
|
export function envEnum(key, validValues, defaultValue) {
|
|
68
|
-
|
|
69
|
-
if (value === undefined || value === '') {
|
|
70
|
-
return defaultValue;
|
|
71
|
-
}
|
|
72
|
-
if (validValues.includes(value)) {
|
|
73
|
-
return value;
|
|
74
|
-
}
|
|
75
|
-
return defaultValue;
|
|
33
|
+
return makeEnv().enum(key, validValues, defaultValue);
|
|
76
34
|
}
|
|
77
35
|
//# sourceMappingURL=env.js.map
|
package/dist/lib/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/lib/env.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"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AAG,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;AAC1D,CAAC"}
|
package/dist/lib/permission.d.ts
CHANGED
|
@@ -108,7 +108,6 @@ export declare class PermissionSystem {
|
|
|
108
108
|
* when no rule matches. See the class doc for the specificity criteria.
|
|
109
109
|
*/
|
|
110
110
|
private pickMatchingRule;
|
|
111
|
-
private sortBySpecificity;
|
|
112
111
|
/**
|
|
113
112
|
* Apply a single winning rule to a subcommand. An allow rule requiring
|
|
114
113
|
* write access (its explicit access or the default access) is denied when
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission.d.ts","sourceRoot":"","sources":["../../src/lib/permission.ts"],"names":[],"mappings":"AACA,OAAO,EACH,gBAAgB,EAEhB,oBAAoB,EAGpB,KAAK,gBAAgB,EAIxB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,oCAAoC;AACpC,MAAM,WAAW,qBAAqB;IAClC,0CAA0C;IAC1C,MAAM,EAAE,gBAAgB,CAAC;IACzB,yDAAyD;IACzD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,sEAAsE;IACtE,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,iEAAiE;IACjE,UAAU,CAAC,EAAE,oBAAoB,CAAC;CACrC;AAaD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAUrF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,gBAAgB;IACzB,OAAO,CAAC,OAAO,CAAkD;IACjE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqC;IAE9D;;;;OAIG;gBACS,MAAM,EAAE,kBAAkB,EAAE,QAAQ,CAAC,EAAE,CAAC,aAAa,E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KrF;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,qBAAqB;IA6BrE,OAAO,CAAC,UAAU;IAalB;;;;;;OAMG;IACH,OAAO,CAAC,SAAS;IAajB;;;;;;;;OAQG;IACH,OAAO,CAAC,UAAU;IA2BlB,oFAAoF;IACpF,OAAO,CAAC,aAAa;IAIrB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAQxB;;;;OAIG;IACH,OAAO,CAAC,MAAM;CAmBjB;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/lib/permission.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolve, sep } from 'node:path';
|
|
2
2
|
import { PermissionAction, PermissionAccess, PermissionDenyReason, PermissionType, RedirectMode } from './types.js';
|
|
3
|
-
import {
|
|
3
|
+
import { RuleSet } from '@johannes.latzel/pattern-specific';
|
|
4
4
|
import { parseSubcommands } from './redirect-parser.js';
|
|
5
5
|
/**
|
|
6
6
|
* Whether `target` equals `root` or is located underneath it.
|
|
@@ -139,7 +139,7 @@ export class PermissionSystem {
|
|
|
139
139
|
const best = this.pickMatchingRule(commandRules, core);
|
|
140
140
|
if (best === undefined)
|
|
141
141
|
return { action: perms.defaultPermission };
|
|
142
|
-
return this.decide(best
|
|
142
|
+
return this.decide(best, perms.defaultAccess, workspaceRoot);
|
|
143
143
|
}
|
|
144
144
|
/**
|
|
145
145
|
* Match a single redirect token against the redirect rules.
|
|
@@ -153,11 +153,11 @@ export class PermissionSystem {
|
|
|
153
153
|
checkToken(token, perms, workspaceRoot) {
|
|
154
154
|
const redirectRules = perms.permissionRules.filter((rule) => this.effectiveType(rule, perms) === PermissionType.Redirect);
|
|
155
155
|
const best = this.pickMatchingRule(redirectRules, token.target);
|
|
156
|
-
if (best === undefined || best.
|
|
156
|
+
if (best === undefined || best.action === PermissionAction.Deny) {
|
|
157
157
|
return { action: PermissionAction.Deny, denyReason: PermissionDenyReason.Pattern };
|
|
158
158
|
}
|
|
159
159
|
const required = token.mode === RedirectMode.Output ? PermissionAccess.Write : PermissionAccess.Read;
|
|
160
|
-
const ruleAccess = best.
|
|
160
|
+
const ruleAccess = best.access ?? perms.defaultAccess;
|
|
161
161
|
if (ruleAccess !== required) {
|
|
162
162
|
return { action: PermissionAction.Deny, denyReason: PermissionDenyReason.Pattern };
|
|
163
163
|
}
|
|
@@ -175,33 +175,11 @@ export class PermissionSystem {
|
|
|
175
175
|
* when no rule matches. See the class doc for the specificity criteria.
|
|
176
176
|
*/
|
|
177
177
|
pickMatchingRule(rules, value) {
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
.
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (matching.length === 1)
|
|
184
|
-
return matching[0];
|
|
185
|
-
return this.sortBySpecificity(matching)[0];
|
|
186
|
-
}
|
|
187
|
-
sortBySpecificity(matching) {
|
|
188
|
-
return matching.sort((a, b) => {
|
|
189
|
-
const aDominates = dominates(a.rule.pattern, b.rule.pattern);
|
|
190
|
-
const bDominates = dominates(b.rule.pattern, a.rule.pattern);
|
|
191
|
-
if (aDominates && !bDominates)
|
|
192
|
-
return -1;
|
|
193
|
-
if (!aDominates && bDominates)
|
|
194
|
-
return 1;
|
|
195
|
-
const aWildcards = countWildcards(a.rule.pattern);
|
|
196
|
-
const bWildcards = countWildcards(b.rule.pattern);
|
|
197
|
-
if (aWildcards !== bWildcards)
|
|
198
|
-
return aWildcards - bWildcards;
|
|
199
|
-
const aLiterals = countLiterals(a.rule.pattern);
|
|
200
|
-
const bLiterals = countLiterals(b.rule.pattern);
|
|
201
|
-
if (aLiterals !== bLiterals)
|
|
202
|
-
return bLiterals - aLiterals;
|
|
203
|
-
return a.index - b.index;
|
|
204
|
-
});
|
|
178
|
+
const set = new RuleSet((_current, next) => next);
|
|
179
|
+
for (const rule of rules) {
|
|
180
|
+
set.add(rule);
|
|
181
|
+
}
|
|
182
|
+
return set.apply(value);
|
|
205
183
|
}
|
|
206
184
|
/**
|
|
207
185
|
* Apply a single winning rule to a subcommand. An allow rule requiring
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission.js","sourceRoot":"","sources":["../../src/lib/permission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACH,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,YAAY,EAKf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"permission.js","sourceRoot":"","sources":["../../src/lib/permission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACH,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,YAAY,EAKf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAcxD;;;;;GAKG;AACH,SAAS,QAAQ,CAAC,MAAc,EAAE,IAAY;IAC1C,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC;IACtD,OAAO,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACxD,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,WAA8B;IACzE,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/B,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE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CAAC,EAAE,UAAU,EAAE,oBAAoB,CAAC,OAAO,EAAE;gBAC9C,CAAC,CAAC,EAAE,CAAC;SACZ,CAAC;IACN,CAAC;CACJ;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Tool, type PartialToolResult } from '@johannes.latzel/llm-chat';
|
|
1
|
+
import { Tool, type PartialToolResult } from '@johannes.latzel/llm-chat-tool';
|
|
2
2
|
import type { Workspace } from '@johannes.latzel/llm-chat-workspace';
|
|
3
3
|
import type { ShellSessionManager } from '../lib/session-manager.js';
|
|
4
4
|
import { PermissionSystem } from '../lib/permission.js';
|
|
@@ -7,6 +7,11 @@ import { PermissionSystem } from '../lib/permission.js';
|
|
|
7
7
|
* Checks command permissions before execution. With `background=true` the
|
|
8
8
|
* command is submitted as a queued job and the tool returns a job ID
|
|
9
9
|
* immediately; poll `shell_job_status` for its progress and results.
|
|
10
|
+
*
|
|
11
|
+
* When `sessionId` is omitted or empty, a new session is created in the
|
|
12
|
+
* current workspace once the command is allowed, and its id is reported in a
|
|
13
|
+
* delimited notice ahead of the output. A non-empty id that is unknown or
|
|
14
|
+
* tombstoned keeps its descriptive error and never spawns a session.
|
|
10
15
|
*/
|
|
11
16
|
export declare class ShellCommandTool extends Tool {
|
|
12
17
|
private sessionManager;
|
|
@@ -17,13 +22,17 @@ export declare class ShellCommandTool extends Tool {
|
|
|
17
22
|
/** Only finite, positive numbers are honored; anything else falls back to the default. */
|
|
18
23
|
private parseTimeout;
|
|
19
24
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
25
|
+
* Resolve the cwd and workspace root a command targets. When no usable id
|
|
26
|
+
* was given, the command runs in the current workspace and a session is
|
|
27
|
+
* created; an explicit id keeps its bound cwd/root unless
|
|
28
|
+
* `useCurrentWorkspace` moves it to the current workspace.
|
|
24
29
|
*/
|
|
25
|
-
private
|
|
30
|
+
private resolveTarget;
|
|
31
|
+
/** Deepest workspace access root containing the current workspace path. */
|
|
32
|
+
private currentWorkspaceRoot;
|
|
26
33
|
private getDeniedSubcommands;
|
|
34
|
+
/** Wrap output with the created-session notice and delimiters the model can spot. */
|
|
35
|
+
private withSessionNotice;
|
|
27
36
|
private formatJobSubmitted;
|
|
28
37
|
private formatOutput;
|
|
29
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-command-tool.d.ts","sourceRoot":"","sources":["../../src/tools/shell-command-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EAIJ,KAAK,iBAAiB,EACzB,MAAM,
|
|
1
|
+
{"version":3,"file":"shell-command-tool.d.ts","sourceRoot":"","sources":["../../src/tools/shell-command-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EAIJ,KAAK,iBAAiB,EACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EACH,gBAAgB,EAGnB,MAAM,sBAAsB,CAAC;AAqB9B;;;;;;;;;;GAUG;AACH,qBAAa,gBAAiB,SAAQ,IAAI;IAElC,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,SAAS;gBAFT,cAAc,EAAE,mBAAmB,EACnC,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS;cA8BhB,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAkEpF,0FAA0F;IAC1F,OAAO,CAAC,YAAY;IAOpB;;;;;OAKG;YACW,aAAa;IAyB3B,2EAA2E;IAC3E,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,oBAAoB;IAe5B,qFAAqF;IACrF,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,YAAY;CAmCvB"}
|
|
@@ -1,71 +1,98 @@
|
|
|
1
|
-
import { Tool, ToolParameters, ToolParameterProperty, ResultStatus } from '@johannes.latzel/llm-chat';
|
|
1
|
+
import { Tool, ToolParameters, ToolParameterProperty, ResultStatus } from '@johannes.latzel/llm-chat-tool';
|
|
2
2
|
import { workspaceForPath } from '../lib/permission.js';
|
|
3
3
|
import { PermissionAction, PermissionDenyReason } from '../lib/types.js';
|
|
4
|
+
/** Prefix of the notice reporting an auto-created session id. */
|
|
5
|
+
const SESSION_NOTICE = '[shell_command] new session: ';
|
|
6
|
+
/** Opening delimiter wrapping command output when a session was auto-created. */
|
|
7
|
+
const OUTPUT_BEGIN = '[shell_command] --- begin output ---';
|
|
8
|
+
/** Closing delimiter wrapping command output when a session was auto-created. */
|
|
9
|
+
const OUTPUT_END = '[shell_command] --- end output ---';
|
|
4
10
|
/**
|
|
5
11
|
* Tool that executes a shell command in a persistent session.
|
|
6
12
|
* Checks command permissions before execution. With `background=true` the
|
|
7
13
|
* command is submitted as a queued job and the tool returns a job ID
|
|
8
14
|
* immediately; poll `shell_job_status` for its progress and results.
|
|
15
|
+
*
|
|
16
|
+
* When `sessionId` is omitted or empty, a new session is created in the
|
|
17
|
+
* current workspace once the command is allowed, and its id is reported in a
|
|
18
|
+
* delimited notice ahead of the output. A non-empty id that is unknown or
|
|
19
|
+
* tombstoned keeps its descriptive error and never spawns a session.
|
|
9
20
|
*/
|
|
10
21
|
export class ShellCommandTool extends Tool {
|
|
11
22
|
sessionManager;
|
|
12
23
|
permissionSystem;
|
|
13
24
|
workspace;
|
|
14
25
|
constructor(sessionManager, permissionSystem, workspace) {
|
|
15
|
-
super('shell_command', 'Executes a shell command in a persistent session. Supports pipes (|), logical operators (&&, ||), and redirects.
|
|
26
|
+
super('shell_command', 'Executes a shell command in a persistent session. Supports pipes (|), logical operators (&&, ||), and redirects. ' +
|
|
27
|
+
'When sessionId is omitted or empty, a new session is created in the current workspace and its id is returned in the result. ' +
|
|
16
28
|
'Set background=true to submit the command as a queued job and return immediately with a job ID; poll shell_job_status / shell_jobs for results. ' +
|
|
17
29
|
'Set timeout to override the max idle time (no output) in ms; larger values are capped by the server config. ' +
|
|
18
30
|
'Set useCurrentWorkspace=true to run the command in the current workspace and permanently rebind the session to it.', new ToolParameters({
|
|
19
31
|
command: ToolParameterProperty.string('The shell command to execute.'),
|
|
20
|
-
sessionId: ToolParameterProperty.string('The session ID from shell_create.'),
|
|
32
|
+
sessionId: ToolParameterProperty.string('The session ID from shell_create. When omitted or empty, a new session is created in the current workspace and its id is returned in the result.'),
|
|
21
33
|
useCurrentWorkspace: ToolParameterProperty.boolean('When true, run the command in the current workspace and permanently bind this session to that workspace.'),
|
|
22
34
|
background: ToolParameterProperty.boolean('When true, submit the command as a background job, return immediately with a jobId, and continue with other work. Poll shell_job_status for the result.'),
|
|
23
35
|
timeout: ToolParameterProperty.integer('Max idle time in ms (no stdout/stderr output) before the command is killed. Defaults to the configured foreground or background timeout; larger values are capped by the server config.')
|
|
24
|
-
}, ['command'
|
|
36
|
+
}, ['command']));
|
|
25
37
|
this.sessionManager = sessionManager;
|
|
26
38
|
this.permissionSystem = permissionSystem;
|
|
27
39
|
this.workspace = workspace;
|
|
28
40
|
}
|
|
29
41
|
async onExecute(args) {
|
|
30
|
-
this.validateRequiredParams(args, ['command'
|
|
42
|
+
this.validateRequiredParams(args, ['command']);
|
|
31
43
|
const command = args['command'];
|
|
32
|
-
const
|
|
44
|
+
const rawSessionId = args['sessionId'];
|
|
45
|
+
const providedId = typeof rawSessionId === 'string' ? rawSessionId.trim() : '';
|
|
33
46
|
const useCurrentWorkspace = args['useCurrentWorkspace'] === true;
|
|
34
47
|
const background = args['background'] === true;
|
|
35
48
|
const timeout = this.parseTimeout(args['timeout']);
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
const
|
|
49
|
+
// Resolve the cwd and permission root. A non-empty unknown id throws here,
|
|
50
|
+
// before anything is created; an absent id resolves to the current workspace.
|
|
51
|
+
const target = await this.resolveTarget(providedId, useCurrentWorkspace);
|
|
52
|
+
// Check permissions against the effective workspace root before creating a session
|
|
53
|
+
const permission = this.permissionSystem.check(command, target.workspaceRoot);
|
|
39
54
|
if (permission.action === PermissionAction.Deny) {
|
|
40
|
-
const deniedSubs = this.getDeniedSubcommands(permission,
|
|
55
|
+
const deniedSubs = this.getDeniedSubcommands(permission, target.workspaceRoot);
|
|
41
56
|
const message = deniedSubs.length > 0
|
|
42
57
|
? `Permission denied for: ${deniedSubs.join(', ')}`
|
|
43
58
|
: 'Permission denied';
|
|
44
59
|
const reason = permission.denyReason === PermissionDenyReason.WriteAccess
|
|
45
|
-
? ` (requires write access to ${
|
|
60
|
+
? ` (requires write access to ${target.workspaceRoot})`
|
|
46
61
|
: '';
|
|
47
62
|
return { result: message + reason, status: ResultStatus.Error };
|
|
48
63
|
}
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
|
|
64
|
+
// The command is allowed: create the session now, or rebind an existing one.
|
|
65
|
+
let sessionId = providedId;
|
|
66
|
+
let createdId;
|
|
67
|
+
if (target.create) {
|
|
68
|
+
sessionId = await this.sessionManager.createSession(target.cwd);
|
|
69
|
+
createdId = sessionId;
|
|
70
|
+
}
|
|
71
|
+
else if (useCurrentWorkspace) {
|
|
72
|
+
await this.sessionManager.rebindSession(sessionId, target.workspaceRoot, target.cwd);
|
|
52
73
|
}
|
|
53
74
|
if (background) {
|
|
54
|
-
const job = await this.sessionManager.submitCommand(sessionId,
|
|
55
|
-
cwd:
|
|
75
|
+
const job = await this.sessionManager.submitCommand(sessionId, command, {
|
|
76
|
+
cwd: target.cwd,
|
|
56
77
|
...(timeout !== undefined ? { timeout } : {})
|
|
57
78
|
});
|
|
58
|
-
return {
|
|
79
|
+
return {
|
|
80
|
+
result: this.formatJobSubmitted(job, createdId),
|
|
81
|
+
status: ResultStatus.Success
|
|
82
|
+
};
|
|
59
83
|
}
|
|
60
84
|
// Execute command (blocks until the shell gets to it, running queued jobs first)
|
|
61
|
-
const result = await this.sessionManager.executeCommand(sessionId,
|
|
62
|
-
cwd:
|
|
85
|
+
const result = await this.sessionManager.executeCommand(sessionId, command, {
|
|
86
|
+
cwd: target.cwd,
|
|
63
87
|
...(timeout !== undefined ? { timeout } : {})
|
|
64
88
|
});
|
|
65
89
|
// Format output
|
|
66
90
|
const output = this.formatOutput(result);
|
|
67
91
|
const status = result.exitCode === 0 ? ResultStatus.Success : ResultStatus.Error;
|
|
68
|
-
return {
|
|
92
|
+
return {
|
|
93
|
+
result: createdId !== undefined ? this.withSessionNotice(createdId, output) : output,
|
|
94
|
+
status
|
|
95
|
+
};
|
|
69
96
|
}
|
|
70
97
|
/** Only finite, positive numbers are honored; anything else falls back to the default. */
|
|
71
98
|
parseTimeout(value) {
|
|
@@ -75,27 +102,37 @@ export class ShellCommandTool extends Tool {
|
|
|
75
102
|
return value;
|
|
76
103
|
}
|
|
77
104
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
105
|
+
* Resolve the cwd and workspace root a command targets. When no usable id
|
|
106
|
+
* was given, the command runs in the current workspace and a session is
|
|
107
|
+
* created; an explicit id keeps its bound cwd/root unless
|
|
108
|
+
* `useCurrentWorkspace` moves it to the current workspace.
|
|
82
109
|
*/
|
|
83
|
-
async
|
|
110
|
+
async resolveTarget(providedId, useCurrentWorkspace) {
|
|
111
|
+
if (providedId.length === 0) {
|
|
112
|
+
return {
|
|
113
|
+
create: true,
|
|
114
|
+
cwd: this.workspace.currentPath,
|
|
115
|
+
workspaceRoot: this.currentWorkspaceRoot()
|
|
116
|
+
};
|
|
117
|
+
}
|
|
84
118
|
if (!useCurrentWorkspace) {
|
|
85
119
|
return {
|
|
86
|
-
|
|
87
|
-
cwd: await this.sessionManager.getSessionCwd(
|
|
88
|
-
workspaceRoot: await this.sessionManager.getSessionWorkspaceRoot(
|
|
120
|
+
create: false,
|
|
121
|
+
cwd: await this.sessionManager.getSessionCwd(providedId),
|
|
122
|
+
workspaceRoot: await this.sessionManager.getSessionWorkspaceRoot(providedId)
|
|
89
123
|
};
|
|
90
124
|
}
|
|
91
|
-
const roots = this.workspace.getAccesses().map((a) => a.path);
|
|
92
|
-
const workspaceRoot = workspaceForPath(this.workspace.currentPath, roots);
|
|
93
125
|
return {
|
|
94
|
-
|
|
126
|
+
create: false,
|
|
95
127
|
cwd: this.workspace.currentPath,
|
|
96
|
-
workspaceRoot
|
|
128
|
+
workspaceRoot: this.currentWorkspaceRoot()
|
|
97
129
|
};
|
|
98
130
|
}
|
|
131
|
+
/** Deepest workspace access root containing the current workspace path. */
|
|
132
|
+
currentWorkspaceRoot() {
|
|
133
|
+
const roots = this.workspace.getAccesses().map((a) => a.path);
|
|
134
|
+
return workspaceForPath(this.workspace.currentPath, roots);
|
|
135
|
+
}
|
|
99
136
|
getDeniedSubcommands(permission, workspaceRoot) {
|
|
100
137
|
// Re-check each raw fragment (core + redirects) to find which are denied
|
|
101
138
|
const denied = [];
|
|
@@ -107,8 +144,13 @@ export class ShellCommandTool extends Tool {
|
|
|
107
144
|
}
|
|
108
145
|
return denied;
|
|
109
146
|
}
|
|
110
|
-
|
|
111
|
-
|
|
147
|
+
/** Wrap output with the created-session notice and delimiters the model can spot. */
|
|
148
|
+
withSessionNotice(sessionId, output) {
|
|
149
|
+
return `${SESSION_NOTICE}${sessionId}\n${OUTPUT_BEGIN}\n${output}\n${OUTPUT_END}`;
|
|
150
|
+
}
|
|
151
|
+
formatJobSubmitted(job, createdId) {
|
|
152
|
+
const message = `Background job ${job.id} submitted (status: ${job.status}, queue position ${job.position}). Poll shell_job_status with this jobId for results.`;
|
|
153
|
+
return createdId !== undefined ? `${SESSION_NOTICE}${createdId}\n${message}` : message;
|
|
112
154
|
}
|
|
113
155
|
formatOutput(result) {
|
|
114
156
|
const parts = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-command-tool.js","sourceRoot":"","sources":["../../src/tools/shell-command-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EACJ,cAAc,EACd,qBAAqB,EACrB,YAAY,EAEf,MAAM,
|
|
1
|
+
{"version":3,"file":"shell-command-tool.js","sourceRoot":"","sources":["../../src/tools/shell-command-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EACJ,cAAc,EACd,qBAAqB,EACrB,YAAY,EAEf,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAGH,gBAAgB,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAGzE,iEAAiE;AACjE,MAAM,cAAc,GAAG,+BAA+B,CAAC;AACvD,iFAAiF;AACjF,MAAM,YAAY,GAAG,sCAAsC,CAAC;AAC5D,iFAAiF;AACjF,MAAM,UAAU,GAAG,oCAAoC,CAAC;AAYxD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,gBAAiB,SAAQ,IAAI;IAE1B;IACA;IACA;IAHZ,YACY,cAAmC,EACnC,gBAAkC,EAClC,SAAoB;QAE5B,KAAK,CACD,eAAe,EACf,mHAAmH;YAC/G,8HAA8H;YAC9H,kJAAkJ;YAClJ,8GAA8G;YAC9G,oHAAoH,EACxH,IAAI,cAAc,CACd;YACI,OAAO,EAAE,qBAAqB,CAAC,MAAM,CAAC,+BAA+B,CAAC;YACtE,SAAS,EAAE,qBAAqB,CAAC,MAAM,CACnC,kJAAkJ,CACrJ;YACD,mBAAmB,EAAE,qBAAqB,CAAC,OAAO,CAC9C,0GAA0G,CAC7G;YACD,UAAU,EAAE,qBAAqB,CAAC,OAAO,CACrC,yJAAyJ,CAC5J;YACD,OAAO,EAAE,qBAAqB,CAAC,OAAO,CAClC,yLAAyL,CAC5L;SACJ,EACD,CAAC,SAAS,CAAC,CACd,CACJ,CAAC;QA7BM,mBAAc,GAAd,cAAc,CAAqB;QACnC,qBAAgB,GAA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@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Tool, type PartialToolResult } from '@johannes.latzel/llm-chat';
|
|
1
|
+
import { Tool, type PartialToolResult } from '@johannes.latzel/llm-chat-tool';
|
|
2
2
|
import type { ShellSessionManager } from '../lib/session-manager.js';
|
|
3
3
|
/**
|
|
4
4
|
* Tool that creates a new persistent shell session.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-create-tool.d.ts","sourceRoot":"","sources":["../../src/tools/shell-create-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EAIJ,KAAK,iBAAiB,EACzB,MAAM,
|
|
1
|
+
{"version":3,"file":"shell-create-tool.d.ts","sourceRoot":"","sources":["../../src/tools/shell-create-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EAIJ,KAAK,iBAAiB,EACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,IAAI;IACzB,OAAO,CAAC,cAAc;gBAAd,cAAc,EAAE,mBAAmB;cAavC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAQvF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Tool, ToolParameters, ToolParameterProperty, ResultStatus } from '@johannes.latzel/llm-chat';
|
|
1
|
+
import { Tool, ToolParameters, ToolParameterProperty, ResultStatus } from '@johannes.latzel/llm-chat-tool';
|
|
2
2
|
/**
|
|
3
3
|
* Tool that creates a new persistent shell session.
|
|
4
4
|
* Returns a session ID that can be used with the shell_command tool.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-create-tool.js","sourceRoot":"","sources":["../../src/tools/shell-create-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EACJ,cAAc,EACd,qBAAqB,EACrB,YAAY,EAEf,MAAM,
|
|
1
|
+
{"version":3,"file":"shell-create-tool.js","sourceRoot":"","sources":["../../src/tools/shell-create-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EACJ,cAAc,EACd,qBAAqB,EACrB,YAAY,EAEf,MAAM,gCAAgC,CAAC;AAGxC;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,IAAI;IACjB;IAApB,YAAoB,cAAmC;QACnD,KAAK,CACD,cAAc,EACd,0FAA0F,EAC1F,IAAI,cAAc,CAAC;YACf,GAAG,EAAE,qBAAqB,CAAC,MAAM,CAC7B,uFAAuF;gBACnF,yDAAyD,CAChE;SACJ,CAAC,CACL,CAAC;QAVc,mBAAc,GAAd,cAAc,CAAqB;IAWvD,CAAC;IAES,KAAK,CAAC,SAAS,CAAC,IAA6B;QACnD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAuB,CAAC;QAC9C,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAC/D,OAAO;YACH,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,YAAY,CAAC,OAAO;SAC/B,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Tool, type PartialToolResult } from '@johannes.latzel/llm-chat';
|
|
1
|
+
import { Tool, type PartialToolResult } from '@johannes.latzel/llm-chat-tool';
|
|
2
2
|
import type { ShellSessionManager } from '../lib/session-manager.js';
|
|
3
3
|
/**
|
|
4
4
|
* Tool that returns the status and, once finished, the results of a background
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-job-status-tool.d.ts","sourceRoot":"","sources":["../../src/tools/shell-job-status-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EAIJ,KAAK,iBAAiB,EACzB,MAAM,
|
|
1
|
+
{"version":3,"file":"shell-job-status-tool.d.ts","sourceRoot":"","sources":["../../src/tools/shell-job-status-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EAIJ,KAAK,iBAAiB,EACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAIrE;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,IAAI;IAC5B,OAAO,CAAC,cAAc;gBAAd,cAAc,EAAE,mBAAmB;cAevC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAOpF,OAAO,CAAC,SAAS;CAqCpB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Tool, ToolParameters, ToolParameterProperty, ResultStatus } from '@johannes.latzel/llm-chat';
|
|
1
|
+
import { Tool, ToolParameters, ToolParameterProperty, ResultStatus } from '@johannes.latzel/llm-chat-tool';
|
|
2
2
|
import { ShellJobStatus } from '../lib/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Tool that returns the status and, once finished, the results of a background
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-job-status-tool.js","sourceRoot":"","sources":["../../src/tools/shell-job-status-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EACJ,cAAc,EACd,qBAAqB,EACrB,YAAY,EAEf,MAAM,
|
|
1
|
+
{"version":3,"file":"shell-job-status-tool.js","sourceRoot":"","sources":["../../src/tools/shell-job-status-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EACJ,cAAc,EACd,qBAAqB,EACrB,YAAY,EAEf,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,IAAI;IACpB;IAApB,YAAoB,cAAmC;QACnD,KAAK,CACD,kBAAkB,EAClB,+LAA+L,EAC/L,IAAI,cAAc,CACd;YACI,KA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AAK,CAAC,EAAE,CAAC;gBACnD,KAAK,CAAC,IAAI,CAAC,eAAe,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC;YAC/C,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;CACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Tool, type PartialToolResult } from '@johannes.latzel/llm-chat';
|
|
1
|
+
import { Tool, type PartialToolResult } from '@johannes.latzel/llm-chat-tool';
|
|
2
2
|
import type { ShellSessionManager } from '../lib/session-manager.js';
|
|
3
3
|
/**
|
|
4
4
|
* Tool that lists the background jobs submitted to a session
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-jobs-tool.d.ts","sourceRoot":"","sources":["../../src/tools/shell-jobs-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EAIJ,KAAK,iBAAiB,EACzB,MAAM,
|
|
1
|
+
{"version":3,"file":"shell-jobs-tool.d.ts","sourceRoot":"","sources":["../../src/tools/shell-jobs-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EAIJ,KAAK,iBAAiB,EACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE;;;GAGG;AACH,qBAAa,aAAc,SAAQ,IAAI;IACvB,OAAO,CAAC,cAAc;gBAAd,cAAc,EAAE,mBAAmB;cAavC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAavF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Tool, ToolParameters, ToolParameterProperty, ResultStatus } from '@johannes.latzel/llm-chat';
|
|
1
|
+
import { Tool, ToolParameters, ToolParameterProperty, ResultStatus } from '@johannes.latzel/llm-chat-tool';
|
|
2
2
|
/**
|
|
3
3
|
* Tool that lists the background jobs submitted to a session
|
|
4
4
|
* (queued, running, completed, failed), oldest first.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-jobs-tool.js","sourceRoot":"","sources":["../../src/tools/shell-jobs-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EACJ,cAAc,EACd,qBAAqB,EACrB,YAAY,EAEf,MAAM,
|
|
1
|
+
{"version":3,"file":"shell-jobs-tool.js","sourceRoot":"","sources":["../../src/tools/shell-jobs-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EACJ,cAAc,EACd,qBAAqB,EACrB,YAAY,EAEf,MAAM,gCAAgC,CAAC;AAGxC;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,IAAI;IACf;IAApB,YAAoB,cAAmC;QACnD,KAAK,CACD,YAAY,EACZ,+IAA+I,EAC/I,IAAI,cAAc,CACd;YACI,SAAS,EAAE,qBAAqB,CAAC,MAAM,CAAC,mCAAmC,CAAC;SAC/E,EACD,CAAC,WAAW,CAAC,CAChB,CACJ,CAAC;QAVc,mBAAc,GAAd,cAAc,CAAqB;IAWvD,CAAC;IAES,KAAK,CAAC,SAAS,CAAC,IAA6B;QACnD,IAAI,CAAC,sBAAsB,CAAC,IAAI,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;QACjD,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAW,CAAC;QAC9C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC3D,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpB,OAAO,EAAE,MAAM,EAAE,uBAAuB,SAAS,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC;QACzF,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACxF,OAAO;YACH,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,uBAAuB,SAAS,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YAC9E,MAAM,EAAE,YAAY,CAAC,OAAO;SAC/B,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ToolPackage } from '@johannes.latzel/llm-chat';
|
|
1
|
+
import { ToolPackage } from '@johannes.latzel/llm-chat-tool';
|
|
2
2
|
import { Workspace } from '@johannes.latzel/llm-chat-workspace';
|
|
3
3
|
import { ShellConfiguration } from '../lib/config.js';
|
|
4
4
|
import { ShellSessionManager } from '../lib/session-manager.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-package.d.ts","sourceRoot":"","sources":["../../src/tools/shell-package.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"shell-package.d.ts","sourceRoot":"","sources":["../../src/tools/shell-package.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EACH,SAAS,EAGZ,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAQhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBAAa,YAAa,SAAQ,WAAW;IACzC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAsB;IAErD;;;;;;OAMG;gBAEC,MAAM,CAAC,EAAE,kBAAkB,EAC3B,cAAc,CAAC,EAAE,mBAAmB,EACpC,SAAS,CAAC,EAAE,SAAS;IA4BzB;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAGjC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ToolPackage } from '@johannes.latzel/llm-chat';
|
|
1
|
+
import { ToolPackage } from '@johannes.latzel/llm-chat-tool';
|
|
2
2
|
import { Workspace, SwitchWorkspaceTool, DirectoryConfiguration } from '@johannes.latzel/llm-chat-workspace';
|
|
3
3
|
import { ShellConfiguration } from '../lib/config.js';
|
|
4
4
|
import { BashShellExecutorFactory } from '../lib/bash-executor.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-package.js","sourceRoot":"","sources":["../../src/tools/shell-package.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"shell-package.js","sourceRoot":"","sources":["../../src/tools/shell-package.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EACH,SAAS,EACT,mBAAmB,EACnB,sBAAsB,EACzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAO,YAAa,SAAQ,WAAW;IACxB,cAAc,CAAsB;IAErD;;;;;;OAMG;IACH,YACI,MAA2B,EAC3B,cAAoC,EACpC,SAAqB;QAErB,MAAM,GAAG,GAAG,MAAM,IAAI,IAAI,kBAAkB,EAAE,CAAC;QAE/C,MAAM,OAAO,GACT,cAAc;YACd,IAAI,mBAAmB,CACnB,IAAI,wBAAwB,CAAC,GAAG,CAAC,EACjC,GAAG,EACH,SAAS,IAAI,IAAI,SAAS,CAAC,IAAI,sBAAsB,EAAE,CAAC,CAC3D,CAAC;QAEN,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CACxD,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CACnC,CAAC;QAEF,KAAK,CAAC;YACF,IAAI,eAAe,CAAC,OAAO,CAAC;YAC5B,IAAI,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,CAAC,SAAS,CAAC;YAClE,IAAI,oBAAoB,CAAC,GAAG,EAAE,OAAO,CAAC,SAAS,CAAC;YAChD,IAAI,kBAAkB,CAAC,OAAO,CAAC;YAC/B,IAAI,aAAa,CAAC,OAAO,CAAC;YAC1B,IAAI,mBAAmB,CAAC,OAAO,CAAC,SAAS,CAAC;SAC7C,CAAC,CAAC;QAEH,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACT,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;IACxC,CAAC;CACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Tool, type PartialToolResult } from '@johannes.latzel/llm-chat';
|
|
1
|
+
import { Tool, type PartialToolResult } from '@johannes.latzel/llm-chat-tool';
|
|
2
2
|
import type { Workspace } from '@johannes.latzel/llm-chat-workspace';
|
|
3
3
|
import type { ShellConfiguration } from '../lib/config.js';
|
|
4
4
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-permissions-tool.d.ts","sourceRoot":"","sources":["../../src/tools/shell-permissions-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EAGJ,KAAK,iBAAiB,EACzB,MAAM,
|
|
1
|
+
{"version":3,"file":"shell-permissions-tool.d.ts","sourceRoot":"","sources":["../../src/tools/shell-permissions-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EAGJ,KAAK,iBAAiB,EACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAI3D;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,IAAI;IAEtC,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,SAAS;gBADT,MAAM,EAAE,kBAAkB,EAC1B,SAAS,EAAE,SAAS;cAUhB,SAAS,IAAI,OAAO,CAAC,iBAAiB,CAAC;CA4B1D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Tool, ToolParameters, ResultStatus } from '@johannes.latzel/llm-chat';
|
|
1
|
+
import { Tool, ToolParameters, ResultStatus } from '@johannes.latzel/llm-chat-tool';
|
|
2
2
|
import { workspaceForPath } from '../lib/permission.js';
|
|
3
3
|
import { PermissionType } from '../lib/types.js';
|
|
4
4
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-permissions-tool.js","sourceRoot":"","sources":["../../src/tools/shell-permissions-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EACJ,cAAc,EACd,YAAY,EAEf,MAAM,
|
|
1
|
+
{"version":3,"file":"shell-permissions-tool.js","sourceRoot":"","sources":["../../src/tools/shell-permissions-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EACJ,cAAc,EACd,YAAY,EAEf,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,gBA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ACpD,MAAM,IAAI,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC,CAAE,CAAC;gBACvC,MAAM,WAAW,GAAa,EAAE,CAAC;gBACjC,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;oBAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAC7D,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,WAAW,CAAC,KAAK,cAAc,CAAC,QAAQ,EAAE,CAAC;oBAC/D,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBACjC,CAAC;gBACD,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC5E,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,OAAO,MAAM,IAAI,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;YACtE,CAAC;QACL,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC;IACtE,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johannes.latzel/llm-chat-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Tightly controlled shell tool for llm-chat with permission system",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"permissions"
|
|
27
27
|
],
|
|
28
28
|
"engines": {
|
|
29
|
-
"node": ">=
|
|
29
|
+
"node": ">=22"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
@@ -65,15 +65,15 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@johannes.latzel/
|
|
69
|
-
"@johannes.latzel/llm-chat-
|
|
70
|
-
"
|
|
71
|
-
"
|
|
68
|
+
"@johannes.latzel/env": "^0.1.0",
|
|
69
|
+
"@johannes.latzel/llm-chat-tool": "^0.1.0",
|
|
70
|
+
"@johannes.latzel/llm-chat-workspace": "^0.3.0",
|
|
71
|
+
"@johannes.latzel/pattern-specific": "^0.1.0",
|
|
72
|
+
"async-mutex": "^0.5.0"
|
|
72
73
|
},
|
|
73
74
|
"devDependencies": {
|
|
74
75
|
"@eslint/js": "^10.0.1",
|
|
75
76
|
"@types/node": "^26.4.0",
|
|
76
|
-
"@types/picomatch": "^4.0.3",
|
|
77
77
|
"@typescript-eslint/eslint-plugin": "^8.68.0",
|
|
78
78
|
"@typescript-eslint/parser": "^8.60.0",
|
|
79
79
|
"@vitest/coverage-v8": "^5.0.0",
|
package/dist/lib/glob.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/** Check whether a string matches a glob pattern using picomatch. */
|
|
2
|
-
export declare function matchesPattern(str: string, pattern: string): boolean;
|
|
3
|
-
/**
|
|
4
|
-
* Check whether pattern A "dominates" pattern B, meaning A is more concrete
|
|
5
|
-
* (more specific) than B. This is the primary specificity criterion.
|
|
6
|
-
*
|
|
7
|
-
* A dominates B when A is a literal string (no wildcards) and B as a glob
|
|
8
|
-
* pattern matches A. Intuitively: if B is broad enough to match the literal
|
|
9
|
-
* text of A, then B is more general and A is more concrete.
|
|
10
|
-
*
|
|
11
|
-
* This check only applies when A has no wildcards. When both patterns contain
|
|
12
|
-
* wildcards, the literal-match test can produce false positives (e.g. `ls ?`
|
|
13
|
-
* matches the literal "ls *", but that doesn't make `ls *` more general).
|
|
14
|
-
* In those cases, we fall through to wildcard count and literal character
|
|
15
|
-
* count instead.
|
|
16
|
-
*
|
|
17
|
-
* Examples:
|
|
18
|
-
* `git push` dominates `git *` — `git *` matches the literal "git push"
|
|
19
|
-
* `git push origin main` dominates `git push *` — `git push *` matches "git push origin main"
|
|
20
|
-
* `rm -rf` dominates `rm *` — `rm *` matches the literal "rm -rf"
|
|
21
|
-
*
|
|
22
|
-
* @returns True if A is more concrete than B.
|
|
23
|
-
*/
|
|
24
|
-
export declare function dominates(a: string, b: string): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Count the number of wildcard characters (`*` and `?`) in a pattern.
|
|
27
|
-
* Fewer wildcards means a more specific (concrete) pattern.
|
|
28
|
-
*/
|
|
29
|
-
export declare function countWildcards(pattern: string): number;
|
|
30
|
-
/**
|
|
31
|
-
* Count the number of literal (non-wildcard) characters in a pattern.
|
|
32
|
-
* More literal characters means a more specific (concrete) pattern.
|
|
33
|
-
*/
|
|
34
|
-
export declare function countLiterals(pattern: string): number;
|
|
35
|
-
//# sourceMappingURL=glob.d.ts.map
|
package/dist/lib/glob.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/lib/glob.ts"],"names":[],"mappings":"AAEA,qEAAqE;AACrE,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEpE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAGvD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMtD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMrD"}
|
package/dist/lib/glob.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import picomatch from 'picomatch';
|
|
2
|
-
/** Check whether a string matches a glob pattern using picomatch. */
|
|
3
|
-
export function matchesPattern(str, pattern) {
|
|
4
|
-
return picomatch.isMatch(str, pattern);
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Check whether pattern A "dominates" pattern B, meaning A is more concrete
|
|
8
|
-
* (more specific) than B. This is the primary specificity criterion.
|
|
9
|
-
*
|
|
10
|
-
* A dominates B when A is a literal string (no wildcards) and B as a glob
|
|
11
|
-
* pattern matches A. Intuitively: if B is broad enough to match the literal
|
|
12
|
-
* text of A, then B is more general and A is more concrete.
|
|
13
|
-
*
|
|
14
|
-
* This check only applies when A has no wildcards. When both patterns contain
|
|
15
|
-
* wildcards, the literal-match test can produce false positives (e.g. `ls ?`
|
|
16
|
-
* matches the literal "ls *", but that doesn't make `ls *` more general).
|
|
17
|
-
* In those cases, we fall through to wildcard count and literal character
|
|
18
|
-
* count instead.
|
|
19
|
-
*
|
|
20
|
-
* Examples:
|
|
21
|
-
* `git push` dominates `git *` — `git *` matches the literal "git push"
|
|
22
|
-
* `git push origin main` dominates `git push *` — `git push *` matches "git push origin main"
|
|
23
|
-
* `rm -rf` dominates `rm *` — `rm *` matches the literal "rm -rf"
|
|
24
|
-
*
|
|
25
|
-
* @returns True if A is more concrete than B.
|
|
26
|
-
*/
|
|
27
|
-
export function dominates(a, b) {
|
|
28
|
-
if (countWildcards(a) > 0)
|
|
29
|
-
return false;
|
|
30
|
-
return matchesPattern(a, b);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Count the number of wildcard characters (`*` and `?`) in a pattern.
|
|
34
|
-
* Fewer wildcards means a more specific (concrete) pattern.
|
|
35
|
-
*/
|
|
36
|
-
export function countWildcards(pattern) {
|
|
37
|
-
let count = 0;
|
|
38
|
-
for (let i = 0; i < pattern.length; i++) {
|
|
39
|
-
if (pattern[i] === '*' || pattern[i] === '?')
|
|
40
|
-
count++;
|
|
41
|
-
}
|
|
42
|
-
return count;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Count the number of literal (non-wildcard) characters in a pattern.
|
|
46
|
-
* More literal characters means a more specific (concrete) pattern.
|
|
47
|
-
*/
|
|
48
|
-
export function countLiterals(pattern) {
|
|
49
|
-
let count = 0;
|
|
50
|
-
for (let i = 0; i < pattern.length; i++) {
|
|
51
|
-
if (pattern[i] !== '*' && pattern[i] !== '?')
|
|
52
|
-
count++;
|
|
53
|
-
}
|
|
54
|
-
return count;
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=glob.js.map
|
package/dist/lib/glob.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/lib/glob.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC,qEAAqE;AACrE,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,OAAe;IACvD,OAAO,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,SAAS,CAAC,CAAS,EAAE,CAAS;IAC1C,IAAI,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACxC,OAAO,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAChC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC1C,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG;YAAE,KAAK,EAAE,CAAC;IAC1D,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IACzC,IAAI,KAAK,GAAG,CAAC,CAAC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