@clinebot/shared 0.0.18 → 0.0.21
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.browser.d.ts +4 -1
- package/dist/index.browser.js +21 -21
- package/dist/index.d.ts +4 -1
- package/dist/index.js +27 -27
- package/dist/parse/shell.d.ts +2 -0
- package/dist/parse/string.d.ts +1 -0
- package/dist/session/index.d.ts +1 -0
- package/dist/storage/index.js +1 -1
- package/package.json +2 -3
- package/src/auth/constants.ts +0 -41
- package/src/connectors/adapters.ts +0 -152
- package/src/connectors/events.ts +0 -73
- package/src/db/index.ts +0 -14
- package/src/db/sqlite-db.ts +0 -329
- package/src/index.browser.ts +0 -187
- package/src/index.ts +0 -187
- package/src/llms/model-id.ts +0 -154
- package/src/llms/tools.ts +0 -137
- package/src/logging/logger.ts +0 -9
- package/src/parse/json.ts +0 -43
- package/src/parse/time.ts +0 -21
- package/src/parse/zod.ts +0 -23
- package/src/prompt/format.ts +0 -22
- package/src/remote-config/constants.ts +0 -5
- package/src/remote-config/schema.test.ts +0 -1004
- package/src/remote-config/schema.ts +0 -263
- package/src/rpc/index.ts +0 -4
- package/src/rpc/runtime.ts +0 -317
- package/src/rpc/team-progress.ts +0 -71
- package/src/services/telemetry-config.ts +0 -55
- package/src/services/telemetry.ts +0 -141
- package/src/session/hook-context.ts +0 -54
- package/src/session/records.ts +0 -40
- package/src/session/runtime-config.ts +0 -24
- package/src/session/runtime-env.ts +0 -8
- package/src/storage/index.ts +0 -37
- package/src/storage/paths.test.ts +0 -99
- package/src/storage/paths.ts +0 -400
- package/src/vcr.ts +0 -717
package/src/parse/json.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { jsonrepair } from "jsonrepair";
|
|
2
|
-
|
|
3
|
-
function tryParseJson(text: string): unknown {
|
|
4
|
-
return JSON.parse(text);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function parseJsonStream(input: unknown): unknown {
|
|
8
|
-
if (typeof input !== "string") return input;
|
|
9
|
-
|
|
10
|
-
const text = input.trimStart();
|
|
11
|
-
if (!(text.startsWith("{") || text.startsWith("["))) return input;
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
return tryParseJson(text);
|
|
15
|
-
} catch {
|
|
16
|
-
try {
|
|
17
|
-
return tryParseJson(jsonrepair(text));
|
|
18
|
-
} catch {
|
|
19
|
-
return input;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function safeJsonStringify(input: unknown): string {
|
|
25
|
-
const seen = new WeakSet<object>();
|
|
26
|
-
|
|
27
|
-
try {
|
|
28
|
-
const result = JSON.stringify(input, (_key, value) => {
|
|
29
|
-
if (typeof value === "bigint") return value.toString();
|
|
30
|
-
|
|
31
|
-
if (value && typeof value === "object") {
|
|
32
|
-
if (seen.has(value as object)) return "[Circular]";
|
|
33
|
-
seen.add(value as object);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return value;
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
return result ?? "null";
|
|
40
|
-
} catch {
|
|
41
|
-
return String(input);
|
|
42
|
-
}
|
|
43
|
-
}
|
package/src/parse/time.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parses a date string and returns a human-readable format.
|
|
3
|
-
* If the input is invalid, it returns the original string or a placeholder.
|
|
4
|
-
*
|
|
5
|
-
* @param dateStr - The date string to parse.
|
|
6
|
-
* @returns A human-readable date string or the original input if invalid.
|
|
7
|
-
*/
|
|
8
|
-
export function formatHumanReadableDate(dateStr?: string): string {
|
|
9
|
-
if (!dateStr) return "(unknown-date)";
|
|
10
|
-
const date = new Date(dateStr);
|
|
11
|
-
if (Number.isNaN(date.getTime())) return dateStr;
|
|
12
|
-
return date.toLocaleString("en-US", {
|
|
13
|
-
year: "numeric",
|
|
14
|
-
month: "numeric",
|
|
15
|
-
day: "numeric",
|
|
16
|
-
hour: "numeric",
|
|
17
|
-
minute: "numeric",
|
|
18
|
-
second: "numeric",
|
|
19
|
-
hour12: true,
|
|
20
|
-
});
|
|
21
|
-
}
|
package/src/parse/zod.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod Utilities
|
|
3
|
-
*
|
|
4
|
-
* Helper functions for working with Zod schemas.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { z } from "zod";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Validate input using a Zod schema
|
|
11
|
-
* Throws a formatted error if validation fails
|
|
12
|
-
*/
|
|
13
|
-
export function validateWithZod<T>(schema: z.ZodType<T>, input: unknown): T {
|
|
14
|
-
const result = schema.safeParse(input);
|
|
15
|
-
if (!result.success) {
|
|
16
|
-
throw new Error(z.prettifyError(result.error));
|
|
17
|
-
}
|
|
18
|
-
return result.data;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function zodToJsonSchema(schema: z.ZodTypeAny): Record<string, unknown> {
|
|
22
|
-
return z.toJSONSchema(schema);
|
|
23
|
-
}
|
package/src/prompt/format.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export function formatFileContentBlock(path: string, content: string): string {
|
|
2
|
-
return `<file_content path="${path}">\n${content}\n</file_content>`;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export function formatUserInputBlock(
|
|
6
|
-
input: string,
|
|
7
|
-
mode: "act" | "plan" = "act",
|
|
8
|
-
): string {
|
|
9
|
-
return `<user_input mode="${mode}">${input}</user_input>`;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function normalizeUserInput(input?: string): string {
|
|
13
|
-
if (!input?.trim()) return "";
|
|
14
|
-
return xmlTagsRemoval(input, "user_input");
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function xmlTagsRemoval(input?: string, tag?: string): string {
|
|
18
|
-
if (!input?.trim()) return "";
|
|
19
|
-
if (!tag) return input;
|
|
20
|
-
const regex = new RegExp(`<${tag}.*?>(.*?)</${tag}>`, "g");
|
|
21
|
-
return input.replace(regex, "$1");
|
|
22
|
-
}
|