@yukino.js/yukino 0.0.11 → 0.0.13-dev
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/README.md +111 -68
- package/dist/a2a-DG2JNM3U.js +14 -0
- package/dist/acp-DCZDS6FQ.js +14 -0
- package/dist/anthropic-5BTWVZVT.js +4 -0
- package/dist/chunk-4CLD7LEU.js +5 -0
- package/dist/{chunk-QMHSZVNF.js → chunk-5DK2M7VI.js} +1 -1
- package/dist/chunk-5URXBVET.js +4 -0
- package/dist/{chunk-3VTVI62N.js → chunk-AZQD75PX.js} +1 -1
- package/dist/{chunk-WH5FUZXY.js → chunk-BDLFNDC4.js} +3 -3
- package/dist/{chunk-TPEUG7AU.js → chunk-COHBT6M7.js} +161 -155
- package/dist/chunk-CW5XFH7H.js +59 -0
- package/dist/{chunk-YWTRNPNR.js → chunk-IWMCIYOG.js} +21 -21
- package/dist/chunk-OI2W6R6H.js +28 -0
- package/dist/chunk-SZXXASVH.js +4 -0
- package/dist/chunk-UGX62ZSO.js +4 -0
- package/dist/chunk-W4GMCNWF.js +65 -0
- package/dist/lib/{anthropic-7HQY42TP.js → anthropic-AVZIC22O.js} +5 -5
- package/dist/lib/bwrap-JS5GRKWY.js +7 -0
- package/dist/lib/{chunk-QQ2V5EX3.js → chunk-EGJKLA2W.js} +3 -3
- package/dist/lib/{chunk-AUU4RKMV.js → chunk-GVI5R2DA.js} +47 -29
- package/dist/lib/{chunk-XDGZMZ2B.js → chunk-LSI3T24Q.js} +2 -2
- package/dist/lib/{chunk-EATSQNOB.js → chunk-O2H6VKKR.js} +3 -3
- package/dist/lib/{chunk-55LKYMVV.js → chunk-OFDOP6I2.js} +2 -2
- package/dist/lib/{chunk-JXZ5KIUV.js → chunk-PCZ63WQL.js} +1 -1
- package/dist/lib/{chunk-Q6B6TAR3.js → chunk-QJ32WYQY.js} +120 -152
- package/dist/lib/{chunk-VXHBKGZW.js → chunk-TUNZLQLO.js} +12 -13
- package/dist/lib/{chunk-OCGX3ISG.js → chunk-XH7D5FLE.js} +4 -4
- package/dist/lib/{chunk-KC54MV5H.js → chunk-XLRV26YW.js} +1 -1
- package/dist/lib/index.d.ts +380 -351
- package/dist/lib/index.js +925 -638
- package/dist/lib/{openai-Z7PCXN2X.js → openai-54IQOU6Y.js} +4 -4
- package/dist/lib/{providers-GOU5DD3X.js → providers-MOCB6Y5L.js} +3 -3
- package/dist/lib/seatbelt-LDM6UB6N.js +7 -0
- package/dist/lib/{tool-filter-GVVYY5QO.js → tool-filter-5Z6UTRRR.js} +4 -4
- package/dist/main-IA22XMQR.js +494 -0
- package/dist/main.js +2 -487
- package/dist/{openai-WNPMC64P.js → openai-I2TTMBWK.js} +1 -1
- package/dist/providers-DXQRJUIY.js +4 -0
- package/dist/server-QS7CX37F.js +4 -0
- package/dist/tool-filter-KDQMXIDC.js +4 -0
- package/package.json +2 -2
- package/dist/a2a-WKGEGTP6.js +0 -14
- package/dist/acp-W2I7T2NT.js +0 -14
- package/dist/anthropic-CQUMQFUK.js +0 -4
- package/dist/chunk-CH7VZVG4.js +0 -4
- package/dist/chunk-F6WFTAOT.js +0 -59
- package/dist/chunk-R567WVDL.js +0 -90
- package/dist/chunk-ZPL2YHQU.js +0 -5
- package/dist/lib/bwrap-V6MFP7PT.js +0 -7
- package/dist/lib/seatbelt-2OE46ZE7.js +0 -7
- package/dist/providers-CMCKMYGG.js +0 -4
- package/dist/server-OQ5XVSZY.js +0 -4
- package/dist/tool-filter-BTQ7WTHR.js +0 -4
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
markLastUserTailForCache,
|
|
5
5
|
markToolsForCache,
|
|
6
6
|
needsToolSearchBeta
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-XH7D5FLE.js";
|
|
8
|
+
import "./chunk-TUNZLQLO.js";
|
|
9
|
+
import "./chunk-LSI3T24Q.js";
|
|
10
|
+
import "./chunk-GVI5R2DA.js";
|
|
11
|
+
import "./chunk-OFDOP6I2.js";
|
|
12
12
|
export {
|
|
13
13
|
AnthropicClient,
|
|
14
14
|
buildAnthropicMessages,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createChildLogger,
|
|
3
3
|
isRecord
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GVI5R2DA.js";
|
|
5
5
|
import {
|
|
6
6
|
__export
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-OFDOP6I2.js";
|
|
8
8
|
|
|
9
9
|
// src/telemetry/providers.ts
|
|
10
10
|
var providers_exports = {};
|
|
@@ -108,7 +108,7 @@ var PackageJsonSchema = z.object({
|
|
|
108
108
|
});
|
|
109
109
|
function resolveVersion() {
|
|
110
110
|
if (true) {
|
|
111
|
-
return "0.0.
|
|
111
|
+
return "0.0.13-dev";
|
|
112
112
|
}
|
|
113
113
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
114
114
|
for (const levels of ["..", "../.."]) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export,
|
|
3
|
+
canonicalPath,
|
|
3
4
|
paths_exports
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-OFDOP6I2.js";
|
|
5
6
|
|
|
6
7
|
// src/logger/index.ts
|
|
7
8
|
var logger_exports = {};
|
|
@@ -12,31 +13,44 @@ __export(logger_exports, {
|
|
|
12
13
|
logger: () => logger,
|
|
13
14
|
sanitizeNameSegment: () => sanitizeNameSegment
|
|
14
15
|
});
|
|
15
|
-
import { openSync, closeSync, mkdirSync
|
|
16
|
+
import { openSync, closeSync, mkdirSync } from "fs";
|
|
16
17
|
import { readdir, stat, unlink } from "fs/promises";
|
|
17
|
-
import {
|
|
18
|
-
import { join, dirname, basename } from "path";
|
|
18
|
+
import { join as join2, dirname } from "path";
|
|
19
19
|
import pino from "pino";
|
|
20
|
+
|
|
21
|
+
// src/storage/paths.ts
|
|
22
|
+
import { createHash } from "crypto";
|
|
23
|
+
import { homedir } from "os";
|
|
24
|
+
import { join } from "path";
|
|
25
|
+
function getYukinoDir() {
|
|
26
|
+
return join(homedir(), ".yukino");
|
|
27
|
+
}
|
|
28
|
+
function yukinoPath(...segments) {
|
|
29
|
+
return join(getYukinoDir(), ...segments);
|
|
30
|
+
}
|
|
31
|
+
function sessionPath(sessionId, ...segments) {
|
|
32
|
+
if (!/^[A-Za-z0-9_-]+$/u.test(sessionId)) {
|
|
33
|
+
throw new Error("Invalid session ID");
|
|
34
|
+
}
|
|
35
|
+
return yukinoPath("sessions", "artifacts", sessionId, ...segments);
|
|
36
|
+
}
|
|
37
|
+
function projectKey(cwd) {
|
|
38
|
+
return createHash("sha256").update(canonicalPath(cwd)).digest("hex");
|
|
39
|
+
}
|
|
40
|
+
function projectPath(cwd, ...segments) {
|
|
41
|
+
return yukinoPath("projects", projectKey(cwd), ...segments);
|
|
42
|
+
}
|
|
43
|
+
function getSessionsDir(cwd) {
|
|
44
|
+
return yukinoPath("sessions", projectKey(cwd));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// src/logger/index.ts
|
|
20
48
|
var currentLogger = null;
|
|
21
49
|
var currentDest = null;
|
|
22
50
|
var currentFd = null;
|
|
23
51
|
function resolveLogPath(opts) {
|
|
24
|
-
const dir = opts.logDir ??
|
|
25
|
-
return
|
|
26
|
-
}
|
|
27
|
-
function ensureYukinoGitignore(logPath) {
|
|
28
|
-
let dir = dirname(logPath);
|
|
29
|
-
while (basename(dir) !== ".yukino") {
|
|
30
|
-
const parent = dirname(dir);
|
|
31
|
-
if (parent === dir) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
dir = parent;
|
|
35
|
-
}
|
|
36
|
-
try {
|
|
37
|
-
writeFileSync(join(dir, ".gitignore"), "*\n", { flag: "wx" });
|
|
38
|
-
} catch {
|
|
39
|
-
}
|
|
52
|
+
const dir = opts.logDir ?? yukinoPath("logs");
|
|
53
|
+
return join2(dir, `${opts.sessionId}.jsonl`);
|
|
40
54
|
}
|
|
41
55
|
function sanitizeNameSegment(name) {
|
|
42
56
|
const cleaned = name.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
@@ -58,7 +72,6 @@ function initLogger(opts) {
|
|
|
58
72
|
}
|
|
59
73
|
const logPath = resolveLogPath(opts);
|
|
60
74
|
mkdirSync(dirname(logPath), { recursive: true });
|
|
61
|
-
ensureYukinoGitignore(logPath);
|
|
62
75
|
const fd = openSync(logPath, "a");
|
|
63
76
|
currentFd = fd;
|
|
64
77
|
currentDest = pino.destination(fd);
|
|
@@ -79,8 +92,7 @@ function initLogger(opts) {
|
|
|
79
92
|
currentLogger = pino(pinoOpts, currentDest);
|
|
80
93
|
}
|
|
81
94
|
if (!opts.skipCleanup) {
|
|
82
|
-
|
|
83
|
-
void cleanExpiredLogs(workDir).catch(() => {
|
|
95
|
+
void cleanExpiredLogs().catch(() => {
|
|
84
96
|
});
|
|
85
97
|
}
|
|
86
98
|
return currentLogger;
|
|
@@ -163,7 +175,7 @@ async function cleanDir(dir) {
|
|
|
163
175
|
const now = Date.now();
|
|
164
176
|
let removed = 0;
|
|
165
177
|
for (const file of files) {
|
|
166
|
-
const filePath =
|
|
178
|
+
const filePath = join2(dir, file);
|
|
167
179
|
try {
|
|
168
180
|
const s = await stat(filePath);
|
|
169
181
|
if (now - s.mtimeMs > 30 * 24 * 60 * 60 * 1e3) {
|
|
@@ -175,10 +187,10 @@ async function cleanDir(dir) {
|
|
|
175
187
|
}
|
|
176
188
|
return removed;
|
|
177
189
|
}
|
|
178
|
-
async function cleanExpiredLogs(
|
|
190
|
+
async function cleanExpiredLogs() {
|
|
179
191
|
let removed = 0;
|
|
180
|
-
removed += await cleanDir(
|
|
181
|
-
const teamsDir =
|
|
192
|
+
removed += await cleanDir(yukinoPath("logs"));
|
|
193
|
+
const teamsDir = yukinoPath("teams");
|
|
182
194
|
let teams;
|
|
183
195
|
try {
|
|
184
196
|
teams = await readdir(teamsDir);
|
|
@@ -188,12 +200,12 @@ async function cleanExpiredLogs(workDir) {
|
|
|
188
200
|
for (const namespace of teams) {
|
|
189
201
|
let teamNames;
|
|
190
202
|
try {
|
|
191
|
-
teamNames = await readdir(
|
|
203
|
+
teamNames = await readdir(join2(teamsDir, namespace));
|
|
192
204
|
} catch {
|
|
193
205
|
continue;
|
|
194
206
|
}
|
|
195
207
|
for (const teamName of teamNames) {
|
|
196
|
-
removed += await cleanDir(
|
|
208
|
+
removed += await cleanDir(join2(teamsDir, namespace, teamName, "logs"));
|
|
197
209
|
}
|
|
198
210
|
}
|
|
199
211
|
return removed;
|
|
@@ -606,6 +618,12 @@ function truncate(value, max) {
|
|
|
606
618
|
}
|
|
607
619
|
|
|
608
620
|
export {
|
|
621
|
+
getYukinoDir,
|
|
622
|
+
yukinoPath,
|
|
623
|
+
sessionPath,
|
|
624
|
+
projectKey,
|
|
625
|
+
projectPath,
|
|
626
|
+
getSessionsDir,
|
|
609
627
|
sanitizeNameSegment,
|
|
610
628
|
initLogger,
|
|
611
629
|
closeLogger,
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
asRecord,
|
|
4
4
|
createChildLogger,
|
|
5
5
|
strArg
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GVI5R2DA.js";
|
|
7
7
|
import {
|
|
8
8
|
__export
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-OFDOP6I2.js";
|
|
10
10
|
|
|
11
11
|
// src/tools/types.ts
|
|
12
12
|
var types_exports = {};
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
parseToolArguments,
|
|
15
15
|
resolveAPIKey,
|
|
16
16
|
toReasoningEffort
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-TUNZLQLO.js";
|
|
18
18
|
import {
|
|
19
19
|
asRecord,
|
|
20
20
|
asString,
|
|
@@ -22,10 +22,10 @@ import {
|
|
|
22
22
|
createChildLogger,
|
|
23
23
|
isRecord,
|
|
24
24
|
strArg
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-GVI5R2DA.js";
|
|
26
26
|
import {
|
|
27
27
|
__export
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-OFDOP6I2.js";
|
|
29
29
|
|
|
30
30
|
// src/llm/openai.ts
|
|
31
31
|
var openai_exports = {};
|
|
@@ -23,9 +23,9 @@ import {
|
|
|
23
23
|
resolve,
|
|
24
24
|
sep
|
|
25
25
|
} from "path";
|
|
26
|
-
function resolveToolPath(
|
|
26
|
+
function resolveToolPath(cwd, path) {
|
|
27
27
|
const expanded = path === "~" ? homedir() : path.startsWith("~/") || sep === "\\" && path.startsWith("~\\") ? join(homedir(), path.slice(2)) : path;
|
|
28
|
-
return resolve(
|
|
28
|
+
return resolve(cwd, expanded);
|
|
29
29
|
}
|
|
30
30
|
function canonicalPath(path) {
|
|
31
31
|
let current = resolve(path);
|