unagent 0.0.1 → 0.0.4
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 +47 -0
- package/dist/clone-DgXhqC05.mjs +104 -0
- package/dist/context/index.d.mts +2 -0
- package/dist/context/index.mjs +3 -0
- package/dist/context-CAk5kS7q.mjs +59 -0
- package/dist/{env-BUegcU7a.js → detect-CDtKsCsD.mjs} +1 -1
- package/dist/env/{index.d.ts → index.d.mts} +1 -1
- package/dist/env/{index.js → index.mjs} +3 -2
- package/dist/env-DeXFcrWN.mjs +1 -0
- package/dist/exec/index.d.mts +2 -0
- package/dist/exec/index.mjs +3 -0
- package/dist/exec-Dzl5r4Ui.mjs +116 -0
- package/dist/fs/index.d.mts +2 -0
- package/dist/fs/index.mjs +3 -0
- package/dist/fs-nJz4v9pE.mjs +269 -0
- package/dist/git/{index.d.ts → index.d.mts} +1 -1
- package/dist/git/index.mjs +4 -0
- package/dist/git-D3qsdy9d.mjs +86 -0
- package/dist/hooks/index.d.mts +3 -0
- package/dist/hooks/index.mjs +3 -0
- package/dist/hooks-335rp9Cp.mjs +9 -0
- package/dist/index-BZaywR9E.d.mts +97 -0
- package/dist/index-Bd1gSwMB.d.mts +31 -0
- package/dist/index-Bd4x_1H9.d.mts +33 -0
- package/dist/index-C0ulBa5T.d.mts +21 -0
- package/dist/{index-DwU61LUW.d.ts → index-C55JaUgw.d.mts} +10 -10
- package/dist/index-Csv1G0zj.d.mts +36 -0
- package/dist/index-CvCCCs-_.d.mts +20 -0
- package/dist/{index-LzafUiEo.d.ts → index-Cy8LThTV.d.mts} +1 -1
- package/dist/index-D5A0wwzb.d.mts +55 -0
- package/dist/index-DFqD_DAh.d.mts +80 -0
- package/dist/index-DShEKmmL.d.mts +43 -0
- package/dist/index-DpFup4kC.d.mts +21 -0
- package/dist/index-ucMWydcs.d.mts +19 -0
- package/dist/index.d.mts +18 -0
- package/dist/index.mjs +24 -0
- package/dist/link/{index.d.ts → index.d.mts} +1 -1
- package/dist/link/{index.js → index.mjs} +2 -1
- package/dist/link-BRZABZ3A.mjs +1 -0
- package/dist/lock/{index.d.ts → index.d.mts} +1 -1
- package/dist/lock/{index.js → index.mjs} +1 -1
- package/dist/{lock-BeR43Izo.js → lock-CB9Xr9pv.mjs} +1 -1
- package/dist/{path-nPuHl-f5.js → path-Dm-URQvz.mjs} +3 -3
- package/dist/registry/index.d.mts +2 -0
- package/dist/registry/index.mjs +3 -0
- package/dist/registry-DvxT2enn.mjs +30 -0
- package/dist/sandbox/index.d.mts +2 -0
- package/dist/sandbox/index.mjs +3 -0
- package/dist/sandbox-Dyz9jTaL.mjs +139 -0
- package/dist/skill/index.d.mts +2 -0
- package/dist/skill/index.mjs +9 -0
- package/dist/skill-BnKVgm4n.mjs +358 -0
- package/dist/source/{index.d.ts → index.d.mts} +1 -1
- package/dist/source/{index.js → index.mjs} +2 -1
- package/dist/source-BCRylzkW.mjs +1 -0
- package/dist/stop/index.d.mts +3 -0
- package/dist/stop/index.mjs +4 -0
- package/dist/stop-B9w8PiPj.mjs +39 -0
- package/dist/stream/index.d.mts +3 -0
- package/dist/stream/index.mjs +3 -0
- package/dist/stream-CzGvLSeV.mjs +99 -0
- package/dist/tool/index.d.mts +2 -0
- package/dist/tool/index.mjs +3 -0
- package/dist/tool-CESxMfOv.mjs +45 -0
- package/dist/usage/index.d.mts +2 -0
- package/dist/usage/index.mjs +3 -0
- package/dist/usage-DTaeWIUK.mjs +165 -0
- package/dist/utils/{index.d.ts → index.d.mts} +1 -1
- package/dist/utils/{index.js → index.mjs} +2 -2
- package/package.json +104 -34
- package/dist/git/index.js +0 -3
- package/dist/git-D4ZclaF6.js +0 -132
- package/dist/index-y5JZ6STt.d.ts +0 -36
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -10
- package/dist/skill/index.d.ts +0 -2
- package/dist/skill/index.js +0 -3
- package/dist/skill-BmLJYiQz.js +0 -69
- /package/dist/{index-CirIJDiq.d.ts → index-CbYchDwg.d.mts} +0 -0
- /package/dist/{index-BW91Ai1Y.d.ts → index-CzgY9GU2.d.mts} +0 -0
- /package/dist/{index-CFwFmDD-.d.ts → index-DPt7J0hF.d.mts} +0 -0
- /package/dist/{index-DmiDvQ8Q.d.ts → index-wTumcHrH.d.mts} +0 -0
- /package/dist/{source-IfQxnt_F.js → parse-CEbeorIB.mjs} +0 -0
- /package/dist/{link-C4PSDr4v.js → symlink-CbP-heyc.mjs} +0 -0
- /package/dist/{utils-CDyPZons.js → utils-bP3i6rq3.mjs} +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { r as calculateCost } from "./usage-DTaeWIUK.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/stop/index.ts
|
|
4
|
+
function iterationCountIs(max) {
|
|
5
|
+
return (ctx) => ctx.iteration >= max;
|
|
6
|
+
}
|
|
7
|
+
function tokenCountIs(max) {
|
|
8
|
+
return (ctx) => {
|
|
9
|
+
if (!ctx.usage) return false;
|
|
10
|
+
return ctx.usage.inputTokens + ctx.usage.outputTokens >= max;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function costIs(maxDollars, rates) {
|
|
14
|
+
return (ctx) => {
|
|
15
|
+
if (!ctx.usage) return false;
|
|
16
|
+
return calculateCost(ctx.usage, rates) >= maxDollars;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function timeout(ms) {
|
|
20
|
+
return (ctx) => Date.now() - ctx.startTime >= ms;
|
|
21
|
+
}
|
|
22
|
+
function and(...conditions) {
|
|
23
|
+
return async (ctx) => {
|
|
24
|
+
for (const condition of conditions) if (!await condition(ctx)) return false;
|
|
25
|
+
return true;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function or(...conditions) {
|
|
29
|
+
return async (ctx) => {
|
|
30
|
+
for (const condition of conditions) if (await condition(ctx)) return true;
|
|
31
|
+
return false;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function not(condition) {
|
|
35
|
+
return async (ctx) => !await condition(ctx);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { or as a, not as i, costIs as n, timeout as o, iterationCountIs as r, tokenCountIs as s, and as t };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import "../index-ucMWydcs.mjs";
|
|
2
|
+
import { a as createStreamResult, i as StreamResultOptions, n as StreamPart, o as formatSSE, r as StreamResult, s as parseSSE, t as SSEParser } from "../index-D5A0wwzb.mjs";
|
|
3
|
+
export { SSEParser, StreamPart, StreamResult, StreamResultOptions, createStreamResult, formatSSE, parseSSE };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
//#region src/stream/index.ts
|
|
2
|
+
function createStreamResult(options) {
|
|
3
|
+
const { stream, getValue } = options;
|
|
4
|
+
let consumed = false;
|
|
5
|
+
const parts = [];
|
|
6
|
+
async function* wrapStream() {
|
|
7
|
+
for await (const part of stream) {
|
|
8
|
+
parts.push(part);
|
|
9
|
+
yield part;
|
|
10
|
+
}
|
|
11
|
+
consumed = true;
|
|
12
|
+
}
|
|
13
|
+
const wrappedStream = wrapStream();
|
|
14
|
+
return {
|
|
15
|
+
get value() {
|
|
16
|
+
return getValue();
|
|
17
|
+
},
|
|
18
|
+
get stream() {
|
|
19
|
+
return wrappedStream;
|
|
20
|
+
},
|
|
21
|
+
toResponse() {
|
|
22
|
+
const encoder = new TextEncoder();
|
|
23
|
+
const readable = new ReadableStream({ async start(controller) {
|
|
24
|
+
for await (const part of wrappedStream) if (part.type === "text") controller.enqueue(encoder.encode(part.data));
|
|
25
|
+
controller.close();
|
|
26
|
+
} });
|
|
27
|
+
return new Response(readable, { headers: { "Content-Type": "text/plain; charset=utf-8" } });
|
|
28
|
+
},
|
|
29
|
+
toSSEResponse() {
|
|
30
|
+
const encoder = new TextEncoder();
|
|
31
|
+
const readable = new ReadableStream({ async start(controller) {
|
|
32
|
+
for await (const part of wrappedStream) {
|
|
33
|
+
const data = part.type === "error" ? {
|
|
34
|
+
type: part.type,
|
|
35
|
+
data: { message: part.data.message }
|
|
36
|
+
} : part;
|
|
37
|
+
controller.enqueue(encoder.encode(formatSSE(part.type, data)));
|
|
38
|
+
}
|
|
39
|
+
controller.close();
|
|
40
|
+
} });
|
|
41
|
+
return new Response(readable, { headers: {
|
|
42
|
+
"Content-Type": "text/event-stream",
|
|
43
|
+
"Cache-Control": "no-cache",
|
|
44
|
+
"Connection": "keep-alive"
|
|
45
|
+
} });
|
|
46
|
+
},
|
|
47
|
+
async consumeStream() {
|
|
48
|
+
if (consumed) return;
|
|
49
|
+
for await (const _part of wrappedStream);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function formatSSE(event, data) {
|
|
54
|
+
return `event: ${event}\ndata: ${JSON.stringify(data)}\n\n`;
|
|
55
|
+
}
|
|
56
|
+
function parseSSE(line) {
|
|
57
|
+
const trimmed = line.trim();
|
|
58
|
+
if (!trimmed || trimmed.startsWith(":")) return null;
|
|
59
|
+
if (trimmed.startsWith("event:")) return { event: trimmed.slice(6).trim() };
|
|
60
|
+
if (trimmed.startsWith("data:")) return { data: trimmed.slice(5).trim() };
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
var SSEParser = class {
|
|
64
|
+
currentEvent;
|
|
65
|
+
dataBuffer = [];
|
|
66
|
+
parse(chunk) {
|
|
67
|
+
const results = [];
|
|
68
|
+
const lines = chunk.split("\n");
|
|
69
|
+
for (const line of lines) {
|
|
70
|
+
const trimmed = line.trim();
|
|
71
|
+
if (!trimmed) {
|
|
72
|
+
if (this.dataBuffer.length > 0) {
|
|
73
|
+
const dataStr = this.dataBuffer.join("\n");
|
|
74
|
+
try {
|
|
75
|
+
results.push({
|
|
76
|
+
event: this.currentEvent,
|
|
77
|
+
data: JSON.parse(dataStr)
|
|
78
|
+
});
|
|
79
|
+
} catch {
|
|
80
|
+
results.push({
|
|
81
|
+
event: this.currentEvent,
|
|
82
|
+
data: dataStr
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
this.currentEvent = void 0;
|
|
86
|
+
this.dataBuffer = [];
|
|
87
|
+
}
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (trimmed.startsWith(":")) continue;
|
|
91
|
+
if (trimmed.startsWith("event:")) this.currentEvent = trimmed.slice(6).trim();
|
|
92
|
+
else if (trimmed.startsWith("data:")) this.dataBuffer.push(trimmed.slice(5).trim());
|
|
93
|
+
}
|
|
94
|
+
return results;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
//#endregion
|
|
99
|
+
export { parseSSE as i, createStreamResult as n, formatSSE as r, SSEParser as t };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as defineTool, i as ToolParameter, n as JSONSchemaProperty, o as toolToSchema, r as ToolDefinition, s as toolsToSchema, t as JSONSchema } from "../index-DShEKmmL.mjs";
|
|
2
|
+
export { JSONSchema, JSONSchemaProperty, ToolDefinition, ToolParameter, defineTool, toolToSchema, toolsToSchema };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//#region src/tool/index.ts
|
|
2
|
+
function defineTool(tool) {
|
|
3
|
+
return tool;
|
|
4
|
+
}
|
|
5
|
+
function parameterToJSONSchema(param) {
|
|
6
|
+
const schema = { type: param.type };
|
|
7
|
+
if (param.description) schema.description = param.description;
|
|
8
|
+
if (param.enum) schema.enum = param.enum;
|
|
9
|
+
if (param.default !== void 0) schema.default = param.default;
|
|
10
|
+
if (param.type === "array" && param.items) schema.items = parameterToJSONSchema(param.items);
|
|
11
|
+
if (param.type === "object" && param.properties) {
|
|
12
|
+
schema.properties = {};
|
|
13
|
+
const required = [];
|
|
14
|
+
for (const [key, value] of Object.entries(param.properties)) {
|
|
15
|
+
schema.properties[key] = parameterToJSONSchema(value);
|
|
16
|
+
if (value.required) required.push(key);
|
|
17
|
+
}
|
|
18
|
+
if (required.length > 0) schema.required = required;
|
|
19
|
+
}
|
|
20
|
+
return schema;
|
|
21
|
+
}
|
|
22
|
+
function toolToSchema(tool) {
|
|
23
|
+
const properties = {};
|
|
24
|
+
const required = [];
|
|
25
|
+
if (tool.parameters) for (const [key, param] of Object.entries(tool.parameters)) {
|
|
26
|
+
properties[key] = parameterToJSONSchema(param);
|
|
27
|
+
if (param.required) required.push(key);
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
name: tool.name,
|
|
31
|
+
description: tool.description,
|
|
32
|
+
input_schema: {
|
|
33
|
+
type: "object",
|
|
34
|
+
properties,
|
|
35
|
+
...required.length > 0 ? { required } : {},
|
|
36
|
+
additionalProperties: false
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function toolsToSchema(tools) {
|
|
41
|
+
return tools.map(toolToSchema);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { toolToSchema as n, toolsToSchema as r, defineTool as t };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
//#region src/usage/index.ts
|
|
2
|
+
function calculateCost(usage, rates) {
|
|
3
|
+
let cost = 0;
|
|
4
|
+
cost += usage.inputTokens / 1e6 * rates.inputCostPerMillionTokens;
|
|
5
|
+
cost += usage.outputTokens / 1e6 * rates.outputCostPerMillionTokens;
|
|
6
|
+
if (usage.cacheReadTokens && rates.cacheReadCostPerMillionTokens) cost += usage.cacheReadTokens / 1e6 * rates.cacheReadCostPerMillionTokens;
|
|
7
|
+
if (usage.cacheWriteTokens && rates.cacheWriteCostPerMillionTokens) cost += usage.cacheWriteTokens / 1e6 * rates.cacheWriteCostPerMillionTokens;
|
|
8
|
+
return cost;
|
|
9
|
+
}
|
|
10
|
+
function aggregateUsage(...usages) {
|
|
11
|
+
const result = usages.reduce((acc, usage) => ({
|
|
12
|
+
inputTokens: acc.inputTokens + usage.inputTokens,
|
|
13
|
+
outputTokens: acc.outputTokens + usage.outputTokens,
|
|
14
|
+
cacheReadTokens: (acc.cacheReadTokens ?? 0) + (usage.cacheReadTokens ?? 0),
|
|
15
|
+
cacheWriteTokens: (acc.cacheWriteTokens ?? 0) + (usage.cacheWriteTokens ?? 0)
|
|
16
|
+
}), {
|
|
17
|
+
inputTokens: 0,
|
|
18
|
+
outputTokens: 0,
|
|
19
|
+
cacheReadTokens: 0,
|
|
20
|
+
cacheWriteTokens: 0
|
|
21
|
+
});
|
|
22
|
+
const hasCacheRead = usages.some((u) => u.cacheReadTokens !== void 0);
|
|
23
|
+
const hasCacheWrite = usages.some((u) => u.cacheWriteTokens !== void 0);
|
|
24
|
+
return {
|
|
25
|
+
inputTokens: result.inputTokens,
|
|
26
|
+
outputTokens: result.outputTokens,
|
|
27
|
+
...hasCacheRead && { cacheReadTokens: result.cacheReadTokens },
|
|
28
|
+
...hasCacheWrite && { cacheWriteTokens: result.cacheWriteTokens }
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const MODEL_PRICING = {
|
|
32
|
+
"claude-opus-4-20250514": {
|
|
33
|
+
inputCostPerMillionTokens: 15,
|
|
34
|
+
outputCostPerMillionTokens: 75,
|
|
35
|
+
cacheReadCostPerMillionTokens: 1.5,
|
|
36
|
+
cacheWriteCostPerMillionTokens: 18.75
|
|
37
|
+
},
|
|
38
|
+
"claude-sonnet-4-20250514": {
|
|
39
|
+
inputCostPerMillionTokens: 3,
|
|
40
|
+
outputCostPerMillionTokens: 15,
|
|
41
|
+
cacheReadCostPerMillionTokens: .3,
|
|
42
|
+
cacheWriteCostPerMillionTokens: 3.75
|
|
43
|
+
},
|
|
44
|
+
"claude-3-7-sonnet-20250219": {
|
|
45
|
+
inputCostPerMillionTokens: 3,
|
|
46
|
+
outputCostPerMillionTokens: 15,
|
|
47
|
+
cacheReadCostPerMillionTokens: .3,
|
|
48
|
+
cacheWriteCostPerMillionTokens: 3.75
|
|
49
|
+
},
|
|
50
|
+
"claude-3-5-sonnet-20241022": {
|
|
51
|
+
inputCostPerMillionTokens: 3,
|
|
52
|
+
outputCostPerMillionTokens: 15,
|
|
53
|
+
cacheReadCostPerMillionTokens: .3,
|
|
54
|
+
cacheWriteCostPerMillionTokens: 3.75
|
|
55
|
+
},
|
|
56
|
+
"claude-3-5-haiku-20241022": {
|
|
57
|
+
inputCostPerMillionTokens: .8,
|
|
58
|
+
outputCostPerMillionTokens: 4,
|
|
59
|
+
cacheReadCostPerMillionTokens: .08,
|
|
60
|
+
cacheWriteCostPerMillionTokens: 1
|
|
61
|
+
},
|
|
62
|
+
"claude-3-opus-20240229": {
|
|
63
|
+
inputCostPerMillionTokens: 15,
|
|
64
|
+
outputCostPerMillionTokens: 75,
|
|
65
|
+
cacheReadCostPerMillionTokens: 1.5,
|
|
66
|
+
cacheWriteCostPerMillionTokens: 18.75
|
|
67
|
+
},
|
|
68
|
+
"claude-3-haiku-20240307": {
|
|
69
|
+
inputCostPerMillionTokens: .25,
|
|
70
|
+
outputCostPerMillionTokens: 1.25,
|
|
71
|
+
cacheReadCostPerMillionTokens: .03,
|
|
72
|
+
cacheWriteCostPerMillionTokens: .3
|
|
73
|
+
},
|
|
74
|
+
"gpt-4o": {
|
|
75
|
+
inputCostPerMillionTokens: 2.5,
|
|
76
|
+
outputCostPerMillionTokens: 10
|
|
77
|
+
},
|
|
78
|
+
"gpt-4o-mini": {
|
|
79
|
+
inputCostPerMillionTokens: .15,
|
|
80
|
+
outputCostPerMillionTokens: .6
|
|
81
|
+
},
|
|
82
|
+
"gpt-4-turbo": {
|
|
83
|
+
inputCostPerMillionTokens: 10,
|
|
84
|
+
outputCostPerMillionTokens: 30
|
|
85
|
+
},
|
|
86
|
+
"gpt-4": {
|
|
87
|
+
inputCostPerMillionTokens: 30,
|
|
88
|
+
outputCostPerMillionTokens: 60
|
|
89
|
+
},
|
|
90
|
+
"gpt-3.5-turbo": {
|
|
91
|
+
inputCostPerMillionTokens: .5,
|
|
92
|
+
outputCostPerMillionTokens: 1.5
|
|
93
|
+
},
|
|
94
|
+
"o1": {
|
|
95
|
+
inputCostPerMillionTokens: 15,
|
|
96
|
+
outputCostPerMillionTokens: 60
|
|
97
|
+
},
|
|
98
|
+
"o1-mini": {
|
|
99
|
+
inputCostPerMillionTokens: 3,
|
|
100
|
+
outputCostPerMillionTokens: 12
|
|
101
|
+
},
|
|
102
|
+
"o3-mini": {
|
|
103
|
+
inputCostPerMillionTokens: 1.1,
|
|
104
|
+
outputCostPerMillionTokens: 4.4
|
|
105
|
+
},
|
|
106
|
+
"gemini-2.0-flash": {
|
|
107
|
+
inputCostPerMillionTokens: .1,
|
|
108
|
+
outputCostPerMillionTokens: .4
|
|
109
|
+
},
|
|
110
|
+
"gemini-1.5-pro": {
|
|
111
|
+
inputCostPerMillionTokens: 1.25,
|
|
112
|
+
outputCostPerMillionTokens: 5
|
|
113
|
+
},
|
|
114
|
+
"gemini-1.5-flash": {
|
|
115
|
+
inputCostPerMillionTokens: .075,
|
|
116
|
+
outputCostPerMillionTokens: .3
|
|
117
|
+
},
|
|
118
|
+
"mistral-large": {
|
|
119
|
+
inputCostPerMillionTokens: 2,
|
|
120
|
+
outputCostPerMillionTokens: 6
|
|
121
|
+
},
|
|
122
|
+
"mistral-small": {
|
|
123
|
+
inputCostPerMillionTokens: .2,
|
|
124
|
+
outputCostPerMillionTokens: .6
|
|
125
|
+
},
|
|
126
|
+
"codestral": {
|
|
127
|
+
inputCostPerMillionTokens: .3,
|
|
128
|
+
outputCostPerMillionTokens: .9
|
|
129
|
+
},
|
|
130
|
+
"command-r-plus": {
|
|
131
|
+
inputCostPerMillionTokens: 2.5,
|
|
132
|
+
outputCostPerMillionTokens: 10
|
|
133
|
+
},
|
|
134
|
+
"command-r": {
|
|
135
|
+
inputCostPerMillionTokens: .15,
|
|
136
|
+
outputCostPerMillionTokens: .6
|
|
137
|
+
},
|
|
138
|
+
"llama-3.1-405b": {
|
|
139
|
+
inputCostPerMillionTokens: 3,
|
|
140
|
+
outputCostPerMillionTokens: 3
|
|
141
|
+
},
|
|
142
|
+
"llama-3.1-70b": {
|
|
143
|
+
inputCostPerMillionTokens: .88,
|
|
144
|
+
outputCostPerMillionTokens: .88
|
|
145
|
+
},
|
|
146
|
+
"llama-3.1-8b": {
|
|
147
|
+
inputCostPerMillionTokens: .055,
|
|
148
|
+
outputCostPerMillionTokens: .055
|
|
149
|
+
},
|
|
150
|
+
"deepseek-chat": {
|
|
151
|
+
inputCostPerMillionTokens: .14,
|
|
152
|
+
outputCostPerMillionTokens: .28
|
|
153
|
+
},
|
|
154
|
+
"deepseek-reasoner": {
|
|
155
|
+
inputCostPerMillionTokens: .55,
|
|
156
|
+
outputCostPerMillionTokens: 2.19
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
function getRatesForModel(modelId) {
|
|
160
|
+
if (MODEL_PRICING[modelId]) return MODEL_PRICING[modelId];
|
|
161
|
+
for (const [key, rates] of Object.entries(MODEL_PRICING)) if (modelId.includes(key) || key.includes(modelId)) return rates;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
//#endregion
|
|
165
|
+
export { getRatesForModel as i, aggregateUsage as n, calculateCost as r, MODEL_PRICING as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as truncate, c as bold, d as gray, f as green, h as yellow, i as pluralize, l as cyan, m as stripAnsi, n as shortenPath, o as ANSI, p as red, r as formatList, s as blue, t as expandPath, u as dim } from "../index-
|
|
1
|
+
import { a as truncate, c as bold, d as gray, f as green, h as yellow, i as pluralize, l as cyan, m as stripAnsi, n as shortenPath, o as ANSI, p as red, r as formatList, s as blue, t as expandPath, u as dim } from "../index-CbYchDwg.mjs";
|
|
2
2
|
export { ANSI, blue, bold, cyan, dim, expandPath, formatList, gray, green, pluralize, red, shortenPath, stripAnsi, truncate, yellow };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as shortenPath, t as expandPath } from "../path-
|
|
2
|
-
import { a as blue, c as dim, d as red, f as stripAnsi, i as ANSI, l as gray, n as pluralize, o as bold, p as yellow, r as truncate, s as cyan, t as formatList, u as green } from "../utils-
|
|
1
|
+
import { n as shortenPath, t as expandPath } from "../path-Dm-URQvz.mjs";
|
|
2
|
+
import { a as blue, c as dim, d as red, f as stripAnsi, i as ANSI, l as gray, n as pluralize, o as bold, p as yellow, r as truncate, s as cyan, t as formatList, u as green } from "../utils-bP3i6rq3.mjs";
|
|
3
3
|
|
|
4
4
|
export { ANSI, blue, bold, cyan, dim, expandPath, formatList, gray, green, pluralize, red, shortenPath, stripAnsi, truncate, yellow };
|
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unagent",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.4",
|
|
5
5
|
"description": "Unified agent primitives for AI coding agents",
|
|
6
|
-
"author": "",
|
|
6
|
+
"author": "Maximilian Conradt <https://github.com/onmax>",
|
|
7
7
|
"license": "MIT",
|
|
8
|
+
"funding": "https://github.com/sponsors/onmax",
|
|
8
9
|
"homepage": "https://unagent.onmax.me",
|
|
9
|
-
"repository":
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/onmax/unagent"
|
|
13
|
+
},
|
|
10
14
|
"keywords": [
|
|
11
15
|
"unjs",
|
|
12
16
|
"agent",
|
|
@@ -19,64 +23,130 @@
|
|
|
19
23
|
"sideEffects": false,
|
|
20
24
|
"exports": {
|
|
21
25
|
".": {
|
|
22
|
-
"types": "./dist/index.d.
|
|
23
|
-
"
|
|
26
|
+
"types": "./dist/index.d.mts",
|
|
27
|
+
"default": "./dist/index.mjs"
|
|
28
|
+
},
|
|
29
|
+
"./context": {
|
|
30
|
+
"types": "./dist/context/index.d.mts",
|
|
31
|
+
"default": "./dist/context/index.mjs"
|
|
24
32
|
},
|
|
25
33
|
"./env": {
|
|
26
|
-
"types": "./dist/env/index.d.
|
|
27
|
-
"
|
|
34
|
+
"types": "./dist/env/index.d.mts",
|
|
35
|
+
"default": "./dist/env/index.mjs"
|
|
28
36
|
},
|
|
29
|
-
"./
|
|
30
|
-
"types": "./dist/
|
|
31
|
-
"
|
|
37
|
+
"./exec": {
|
|
38
|
+
"types": "./dist/exec/index.d.mts",
|
|
39
|
+
"default": "./dist/exec/index.mjs"
|
|
40
|
+
},
|
|
41
|
+
"./fs": {
|
|
42
|
+
"types": "./dist/fs/index.d.mts",
|
|
43
|
+
"default": "./dist/fs/index.mjs"
|
|
44
|
+
},
|
|
45
|
+
"./git": {
|
|
46
|
+
"types": "./dist/git/index.d.mts",
|
|
47
|
+
"default": "./dist/git/index.mjs"
|
|
48
|
+
},
|
|
49
|
+
"./hooks": {
|
|
50
|
+
"types": "./dist/hooks/index.d.mts",
|
|
51
|
+
"default": "./dist/hooks/index.mjs"
|
|
32
52
|
},
|
|
33
53
|
"./link": {
|
|
34
|
-
"types": "./dist/link/index.d.
|
|
35
|
-
"
|
|
54
|
+
"types": "./dist/link/index.d.mts",
|
|
55
|
+
"default": "./dist/link/index.mjs"
|
|
36
56
|
},
|
|
37
57
|
"./lock": {
|
|
38
|
-
"types": "./dist/lock/index.d.
|
|
39
|
-
"
|
|
58
|
+
"types": "./dist/lock/index.d.mts",
|
|
59
|
+
"default": "./dist/lock/index.mjs"
|
|
60
|
+
},
|
|
61
|
+
"./registry": {
|
|
62
|
+
"types": "./dist/registry/index.d.mts",
|
|
63
|
+
"default": "./dist/registry/index.mjs"
|
|
64
|
+
},
|
|
65
|
+
"./sandbox": {
|
|
66
|
+
"types": "./dist/sandbox/index.d.mts",
|
|
67
|
+
"default": "./dist/sandbox/index.mjs"
|
|
68
|
+
},
|
|
69
|
+
"./skill": {
|
|
70
|
+
"types": "./dist/skill/index.d.mts",
|
|
71
|
+
"default": "./dist/skill/index.mjs"
|
|
40
72
|
},
|
|
41
73
|
"./source": {
|
|
42
|
-
"types": "./dist/source/index.d.
|
|
43
|
-
"
|
|
74
|
+
"types": "./dist/source/index.d.mts",
|
|
75
|
+
"default": "./dist/source/index.mjs"
|
|
44
76
|
},
|
|
45
|
-
"./
|
|
46
|
-
"types": "./dist/
|
|
47
|
-
"
|
|
77
|
+
"./stop": {
|
|
78
|
+
"types": "./dist/stop/index.d.mts",
|
|
79
|
+
"default": "./dist/stop/index.mjs"
|
|
80
|
+
},
|
|
81
|
+
"./stream": {
|
|
82
|
+
"types": "./dist/stream/index.d.mts",
|
|
83
|
+
"default": "./dist/stream/index.mjs"
|
|
84
|
+
},
|
|
85
|
+
"./tool": {
|
|
86
|
+
"types": "./dist/tool/index.d.mts",
|
|
87
|
+
"default": "./dist/tool/index.mjs"
|
|
88
|
+
},
|
|
89
|
+
"./usage": {
|
|
90
|
+
"types": "./dist/usage/index.d.mts",
|
|
91
|
+
"default": "./dist/usage/index.mjs"
|
|
48
92
|
},
|
|
49
93
|
"./utils": {
|
|
50
|
-
"types": "./dist/utils/index.d.
|
|
51
|
-
"
|
|
94
|
+
"types": "./dist/utils/index.d.mts",
|
|
95
|
+
"default": "./dist/utils/index.mjs"
|
|
52
96
|
}
|
|
53
97
|
},
|
|
98
|
+
"main": "./dist/index.mjs",
|
|
99
|
+
"module": "./dist/index.mjs",
|
|
100
|
+
"types": "./dist/index.d.mts",
|
|
54
101
|
"files": [
|
|
55
102
|
"dist"
|
|
56
103
|
],
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
104
|
+
"peerDependencies": {
|
|
105
|
+
"@cloudflare/sandbox": ">=0.1.0",
|
|
106
|
+
"@vercel/sandbox": ">=0.1.0",
|
|
107
|
+
"unstorage": ">=1.10.0"
|
|
108
|
+
},
|
|
109
|
+
"peerDependenciesMeta": {
|
|
110
|
+
"@cloudflare/sandbox": {
|
|
111
|
+
"optional": true
|
|
112
|
+
},
|
|
113
|
+
"@vercel/sandbox": {
|
|
114
|
+
"optional": true
|
|
115
|
+
},
|
|
116
|
+
"unstorage": {
|
|
117
|
+
"optional": true
|
|
118
|
+
}
|
|
66
119
|
},
|
|
67
120
|
"dependencies": {
|
|
68
|
-
"
|
|
121
|
+
"hookable": "^5.5.3",
|
|
69
122
|
"pathe": "^2.0.3",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
123
|
+
"std-env": "^3.10.0",
|
|
124
|
+
"yaml": "^2.7.0"
|
|
72
125
|
},
|
|
73
126
|
"devDependencies": {
|
|
74
127
|
"@antfu/eslint-config": "^4.0.0",
|
|
75
128
|
"@types/node": "^25.1.0",
|
|
76
129
|
"bumpp": "^9.0.0",
|
|
77
130
|
"eslint": "^9.0.0",
|
|
131
|
+
"lint-staged": "^16.2.7",
|
|
132
|
+
"simple-git-hooks": "^2.13.1",
|
|
78
133
|
"tsdown": "^0.15.0",
|
|
79
134
|
"typescript": "^5.7.0",
|
|
80
135
|
"vitest": "^3.0.0"
|
|
136
|
+
},
|
|
137
|
+
"simple-git-hooks": {
|
|
138
|
+
"pre-commit": "pnpm lint-staged"
|
|
139
|
+
},
|
|
140
|
+
"lint-staged": {
|
|
141
|
+
"*": "eslint --fix"
|
|
142
|
+
},
|
|
143
|
+
"scripts": {
|
|
144
|
+
"build": "tsdown",
|
|
145
|
+
"dev": "tsdown --watch",
|
|
146
|
+
"lint": "eslint .",
|
|
147
|
+
"lint:fix": "eslint . --fix",
|
|
148
|
+
"typecheck": "tsc --noEmit",
|
|
149
|
+
"test": "vitest",
|
|
150
|
+
"release": "bumpp"
|
|
81
151
|
}
|
|
82
|
-
}
|
|
152
|
+
}
|
package/dist/git/index.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { a as getLatestCommitHash, c as pull, d as cloneRepo, f as cloneToTemp, i as getGitStatus, l as GitCloneError, n as fetch, o as getRemoteUrl, p as isTempDir, r as getCurrentBranch, s as hasUncommittedChanges, t as checkout, u as cleanupTempDir } from "../git-D4ZclaF6.js";
|
|
2
|
-
|
|
3
|
-
export { GitCloneError, checkout, cleanupTempDir, cloneRepo, cloneToTemp, fetch, getCurrentBranch, getGitStatus, getLatestCommitHash, getRemoteUrl, hasUncommittedChanges, isTempDir, pull };
|