@agentick/connector 0.8.0 → 0.9.1
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.
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
/** Platform character limit. */
|
|
3
|
-
maxLength: number;
|
|
4
|
-
/** Preferred split points, tried in order. Default: ["\n\n", "\n", ". ", " "]. */
|
|
5
|
-
splitOn?: string[];
|
|
6
|
-
/** Appended to all chunks except the last. Default: "". */
|
|
7
|
-
continuation?: string;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Split text to fit within a platform's character limit.
|
|
11
|
-
*
|
|
12
|
-
* Greedy algorithm: finds the last occurrence of the highest-priority
|
|
13
|
-
* split point before maxLength, splits there, repeats for the remainder.
|
|
14
|
-
*/
|
|
15
|
-
export declare function splitMessage(text: string, options: SplitOptions): string[];
|
|
1
|
+
export { splitMessage, type SplitOptions } from "@agentick/shared";
|
|
16
2
|
//# sourceMappingURL=message-splitter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-splitter.d.ts","sourceRoot":"","sources":["../src/message-splitter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"message-splitter.d.ts","sourceRoot":"","sources":["../src/message-splitter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/message-splitter.js
CHANGED
|
@@ -1,41 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* Greedy algorithm: finds the last occurrence of the highest-priority
|
|
6
|
-
* split point before maxLength, splits there, repeats for the remainder.
|
|
7
|
-
*/
|
|
8
|
-
export function splitMessage(text, options) {
|
|
9
|
-
const { maxLength, continuation = "" } = options;
|
|
10
|
-
const splitOn = options.splitOn ?? DEFAULT_SPLIT_POINTS;
|
|
11
|
-
if (text.length <= maxLength)
|
|
12
|
-
return [text];
|
|
13
|
-
const effectiveMax = maxLength - continuation.length;
|
|
14
|
-
if (effectiveMax <= 0) {
|
|
15
|
-
throw new Error("maxLength must be greater than continuation length");
|
|
16
|
-
}
|
|
17
|
-
const chunks = [];
|
|
18
|
-
let remaining = text;
|
|
19
|
-
while (remaining.length > maxLength) {
|
|
20
|
-
let splitIndex = -1;
|
|
21
|
-
for (const delimiter of splitOn) {
|
|
22
|
-
const idx = remaining.lastIndexOf(delimiter, effectiveMax);
|
|
23
|
-
if (idx > 0) {
|
|
24
|
-
splitIndex = idx + delimiter.length;
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
// No split point found — hard break at effectiveMax
|
|
29
|
-
if (splitIndex <= 0) {
|
|
30
|
-
splitIndex = effectiveMax;
|
|
31
|
-
}
|
|
32
|
-
const chunk = remaining.slice(0, splitIndex).trimEnd();
|
|
33
|
-
chunks.push(chunk + continuation);
|
|
34
|
-
remaining = remaining.slice(splitIndex).trimStart();
|
|
35
|
-
}
|
|
36
|
-
if (remaining.length > 0) {
|
|
37
|
-
chunks.push(remaining);
|
|
38
|
-
}
|
|
39
|
-
return chunks;
|
|
40
|
-
}
|
|
1
|
+
// Canonical implementation lives in @agentick/shared.
|
|
2
|
+
// Re-exported here for backwards compatibility with existing connector consumers.
|
|
3
|
+
export { splitMessage } from "@agentick/shared";
|
|
41
4
|
//# sourceMappingURL=message-splitter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-splitter.js","sourceRoot":"","sources":["../src/message-splitter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"message-splitter.js","sourceRoot":"","sources":["../src/message-splitter.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,kFAAkF;AAClF,OAAO,EAAE,YAAY,EAAqB,MAAM,kBAAkB,CAAC"}
|
package/dist/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentick/connector",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Bridge external platforms to Agentick sessions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@agentick/client": "0.
|
|
35
|
-
"@agentick/shared": "0.
|
|
34
|
+
"@agentick/client": "0.9.1",
|
|
35
|
+
"@agentick/shared": "0.9.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"typescript": "^5.8.3"
|