@hardlydifficult/text 1.0.39 → 1.0.41
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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/questionDetection.d.ts +12 -0
- package/dist/questionDetection.d.ts.map +1 -0
- package/dist/questionDetection.js +51 -0
- package/dist/questionDetection.js.map +1 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -13,4 +13,5 @@ export { healYaml } from "./healYaml.js";
|
|
|
13
13
|
export { Linker, createLinker, type LinkRule, type LinkHrefBuilder, type LinkMatchContext, type LinkerApplyOptions, type LinkerPlatform, } from "./linker.js";
|
|
14
14
|
export { escapeFence } from "./escapeFence.js";
|
|
15
15
|
export { stripAnsi } from "./stripAnsi.js";
|
|
16
|
+
export { isWaitingForInput } from "./questionDetection.js";
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACvE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,UAAU,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AAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stripAnsi = exports.escapeFence = exports.createLinker = exports.Linker = exports.healYaml = exports.formatYaml = exports.formatWithLineNumbers = exports.convertFormat = exports.FILE_TREE_DEFAULTS = exports.buildFileTree = exports.formatDuration = exports.slugify = exports.chunkText = exports.extractPlaceholders = exports.replaceTemplate = exports.formatErrorForLog = exports.formatError = exports.getErrorMessage = void 0;
|
|
3
|
+
exports.isWaitingForInput = exports.stripAnsi = exports.escapeFence = exports.createLinker = exports.Linker = exports.healYaml = exports.formatYaml = exports.formatWithLineNumbers = exports.convertFormat = exports.FILE_TREE_DEFAULTS = exports.buildFileTree = exports.formatDuration = exports.slugify = exports.chunkText = exports.extractPlaceholders = exports.replaceTemplate = exports.formatErrorForLog = exports.formatError = exports.getErrorMessage = void 0;
|
|
4
4
|
var errors_js_1 = require("./errors.js");
|
|
5
5
|
Object.defineProperty(exports, "getErrorMessage", { enumerable: true, get: function () { return errors_js_1.getErrorMessage; } });
|
|
6
6
|
Object.defineProperty(exports, "formatError", { enumerable: true, get: function () { return errors_js_1.formatError; } });
|
|
@@ -32,4 +32,6 @@ var escapeFence_js_1 = require("./escapeFence.js");
|
|
|
32
32
|
Object.defineProperty(exports, "escapeFence", { enumerable: true, get: function () { return escapeFence_js_1.escapeFence; } });
|
|
33
33
|
var stripAnsi_js_1 = require("./stripAnsi.js");
|
|
34
34
|
Object.defineProperty(exports, "stripAnsi", { enumerable: true, get: function () { return stripAnsi_js_1.stripAnsi; } });
|
|
35
|
+
var questionDetection_js_1 = require("./questionDetection.js");
|
|
36
|
+
Object.defineProperty(exports, "isWaitingForInput", { enumerable: true, get: function () { return questionDetection_js_1.isWaitingForInput; } });
|
|
35
37
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yCAA8E;AAArE,4GAAA,eAAe,OAAA;AAAE,wGAAA,WAAW,OAAA;AAAE,8GAAA,iBAAiB,OAAA;AACxD,6CAAqE;AAA5D,8GAAA,eAAe,OAAA;AAAE,kHAAA,mBAAmB,OAAA;AAC7C,+CAA2C;AAAlC,yGAAA,SAAS,OAAA;AAClB,2CAAuC;AAA9B,qGAAA,OAAO,OAAA;AAChB,yDAAqD;AAA5C,mHAAA,cAAc,OAAA;AACvB,uDAAuE;AAA9D,iHAAA,aAAa,OAAA;AAAE,sHAAA,kBAAkB,OAAA;AAE1C,uDAAmD;AAA1C,iHAAA,aAAa,OAAA;AAEtB,uEAAmE;AAA1D,iIAAA,qBAAqB,OAAA;AAC9B,iDAA6C;AAApC,2GAAA,UAAU,OAAA;AACnB,6CAAyC;AAAhC,uGAAA,QAAQ,OAAA;AACjB,yCAQqB;AAPnB,mGAAA,MAAM,OAAA;AACN,yGAAA,YAAY,OAAA;AAOd,mDAA+C;AAAtC,6GAAA,WAAW,OAAA;AACpB,+CAA2C;AAAlC,yGAAA,SAAS,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yCAA8E;AAArE,4GAAA,eAAe,OAAA;AAAE,wGAAA,WAAW,OAAA;AAAE,8GAAA,iBAAiB,OAAA;AACxD,6CAAqE;AAA5D,8GAAA,eAAe,OAAA;AAAE,kHAAA,mBAAmB,OAAA;AAC7C,+CAA2C;AAAlC,yGAAA,SAAS,OAAA;AAClB,2CAAuC;AAA9B,qGAAA,OAAO,OAAA;AAChB,yDAAqD;AAA5C,mHAAA,cAAc,OAAA;AACvB,uDAAuE;AAA9D,iHAAA,aAAa,OAAA;AAAE,sHAAA,kBAAkB,OAAA;AAE1C,uDAAmD;AAA1C,iHAAA,aAAa,OAAA;AAEtB,uEAAmE;AAA1D,iIAAA,qBAAqB,OAAA;AAC9B,iDAA6C;AAApC,2GAAA,UAAU,OAAA;AACnB,6CAAyC;AAAhC,uGAAA,QAAQ,OAAA;AACjB,yCAQqB;AAPnB,mGAAA,MAAM,OAAA;AACN,yGAAA,YAAY,OAAA;AAOd,mDAA+C;AAAtC,6GAAA,WAAW,OAAA;AACpB,+CAA2C;AAAlC,yGAAA,SAAS,OAAA;AAClB,+DAA2D;AAAlD,yHAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Heuristic to detect whether an AI response is asking the user a question
|
|
3
|
+
* vs. reporting completion. Used to determine whether to notify the user
|
|
4
|
+
* that input is needed.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Check if the AI's response ends with a question or request for user input.
|
|
8
|
+
* Looks at the last meaningful paragraph for question marks and common
|
|
9
|
+
* input-requesting phrases.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isWaitingForInput(response: string): boolean;
|
|
12
|
+
//# sourceMappingURL=questionDetection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"questionDetection.d.ts","sourceRoot":"","sources":["../src/questionDetection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAwC3D"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Heuristic to detect whether an AI response is asking the user a question
|
|
4
|
+
* vs. reporting completion. Used to determine whether to notify the user
|
|
5
|
+
* that input is needed.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.isWaitingForInput = isWaitingForInput;
|
|
9
|
+
/**
|
|
10
|
+
* Check if the AI's response ends with a question or request for user input.
|
|
11
|
+
* Looks at the last meaningful paragraph for question marks and common
|
|
12
|
+
* input-requesting phrases.
|
|
13
|
+
*/
|
|
14
|
+
function isWaitingForInput(response) {
|
|
15
|
+
const trimmed = response.trim();
|
|
16
|
+
if (trimmed.length === 0) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
// Extract the last ~500 characters (roughly the last paragraph or two)
|
|
20
|
+
const tail = trimmed.slice(-500);
|
|
21
|
+
// Check if the tail ends with a question mark (most reliable signal)
|
|
22
|
+
if (tail.trimEnd().endsWith("?")) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
// Check for common question/input-requesting phrases in the tail (case-insensitive)
|
|
26
|
+
const lowerTail = tail.toLowerCase();
|
|
27
|
+
const inputPhrases = [
|
|
28
|
+
"should i",
|
|
29
|
+
"would you like",
|
|
30
|
+
"do you want",
|
|
31
|
+
"which option",
|
|
32
|
+
"which approach",
|
|
33
|
+
"let me know",
|
|
34
|
+
"please clarify",
|
|
35
|
+
"please confirm",
|
|
36
|
+
"what would you prefer",
|
|
37
|
+
"what do you think",
|
|
38
|
+
"could you provide",
|
|
39
|
+
"could you clarify",
|
|
40
|
+
"can you provide",
|
|
41
|
+
"need your input",
|
|
42
|
+
"waiting for your",
|
|
43
|
+
"before i proceed",
|
|
44
|
+
"before proceeding",
|
|
45
|
+
"your preference",
|
|
46
|
+
"how would you like",
|
|
47
|
+
"please let me know",
|
|
48
|
+
];
|
|
49
|
+
return inputPhrases.some((phrase) => lowerTail.includes(phrase));
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=questionDetection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"questionDetection.js","sourceRoot":"","sources":["../src/questionDetection.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAOH,8CAwCC;AA7CD;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,QAAgB;IAChD,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;IAChC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,uEAAuE;IACvE,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;IAEjC,qEAAqE;IACrE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oFAAoF;IACpF,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACrC,MAAM,YAAY,GAAG;QACnB,UAAU;QACV,gBAAgB;QAChB,aAAa;QACb,cAAc;QACd,gBAAgB;QAChB,aAAa;QACb,gBAAgB;QAChB,gBAAgB;QAChB,uBAAuB;QACvB,mBAAmB;QACnB,mBAAmB;QACnB,mBAAmB;QACnB,iBAAiB;QACjB,iBAAiB;QACjB,kBAAkB;QAClB,kBAAkB;QAClB,mBAAmB;QACnB,iBAAiB;QACjB,oBAAoB;QACpB,oBAAoB;KACrB,CAAC;IAEF,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hardlydifficult/text",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.41",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"yaml": "2.8.2"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@types/node": "25.3.
|
|
21
|
+
"@types/node": "25.3.5",
|
|
22
22
|
"typescript": "5.9.3",
|
|
23
23
|
"vitest": "4.0.18",
|
|
24
24
|
"@vitest/coverage-v8": "4.0.18"
|