ur-agent 1.57.5 → 1.58.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.
- package/CHANGELOG.md +36 -0
- package/dist/cli.js +724 -516
- package/docs/USAGE.md +8 -0
- package/docs/providers.md +8 -1
- package/documentation/index.html +1 -1
- package/extensions/jetbrains-ur/build.gradle.kts +1 -1
- package/extensions/vscode-ur-inline-diffs/package.json +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -16738,6 +16738,48 @@ var init_git = __esm(() => {
|
|
|
16738
16738
|
});
|
|
16739
16739
|
});
|
|
16740
16740
|
|
|
16741
|
+
// src/utils/model/visionCapability.ts
|
|
16742
|
+
function nameSuggestsVision(model) {
|
|
16743
|
+
const lowered = model.toLowerCase();
|
|
16744
|
+
return VISION_NAME_HINTS.some((hint) => lowered.includes(hint));
|
|
16745
|
+
}
|
|
16746
|
+
function resolveVisionSupport(model, capabilities) {
|
|
16747
|
+
if (capabilities && capabilities.size > 0) {
|
|
16748
|
+
return capabilities.has("vision") ? "supported" : "unsupported";
|
|
16749
|
+
}
|
|
16750
|
+
return nameSuggestsVision(model) ? "supported" : "unknown";
|
|
16751
|
+
}
|
|
16752
|
+
function shouldSendImages(support) {
|
|
16753
|
+
return support !== "unsupported";
|
|
16754
|
+
}
|
|
16755
|
+
function describeVisionSupport(support, model, imageCount) {
|
|
16756
|
+
if (imageCount === 0 || support === "supported")
|
|
16757
|
+
return null;
|
|
16758
|
+
const plural = imageCount === 1 ? "1 image" : `${imageCount} images`;
|
|
16759
|
+
const named = model ? `"${model}"` : "the selected model";
|
|
16760
|
+
if (support === "unsupported") {
|
|
16761
|
+
return `[${plural} could not be sent: ${named} advertises its capabilities and ` + `vision is not among them, so it cannot see images. Tell the user this ` + `directly and suggest switching to a vision model with /model.]`;
|
|
16762
|
+
}
|
|
16763
|
+
return `[${plural} sent, but ${named} does not advertise its capabilities, so ` + `vision support could not be confirmed. If you cannot see the image, say ` + `so plainly rather than guessing at its contents.]`;
|
|
16764
|
+
}
|
|
16765
|
+
var VISION_NAME_HINTS;
|
|
16766
|
+
var init_visionCapability = __esm(() => {
|
|
16767
|
+
VISION_NAME_HINTS = [
|
|
16768
|
+
"vision",
|
|
16769
|
+
"llava",
|
|
16770
|
+
"moondream",
|
|
16771
|
+
"minicpm-v",
|
|
16772
|
+
"bakllava",
|
|
16773
|
+
"llama3.2-vision",
|
|
16774
|
+
"qwen2-vl",
|
|
16775
|
+
"qwen2.5vl",
|
|
16776
|
+
"gemma3",
|
|
16777
|
+
"pixtral",
|
|
16778
|
+
"internvl",
|
|
16779
|
+
"cogvlm"
|
|
16780
|
+
];
|
|
16781
|
+
});
|
|
16782
|
+
|
|
16741
16783
|
// node_modules/shell-quote/quote.js
|
|
16742
16784
|
var require_quote = __commonJS((exports, module) => {
|
|
16743
16785
|
var OPS = [
|
|
@@ -57512,7 +57554,7 @@ function toOllamaChatRequest(params, stream4, capabilities) {
|
|
|
57512
57554
|
model: params.model,
|
|
57513
57555
|
messages: [
|
|
57514
57556
|
systemMessage,
|
|
57515
|
-
...messagesToOllama(params.messages,
|
|
57557
|
+
...messagesToOllama(params.messages, resolveVisionSupport(params.model, capabilities), params.model)
|
|
57516
57558
|
].filter((message) => message.role === "tool" || message.content.trim() !== "" || (message.images?.length ?? 0) > 0 || (message.tool_calls?.length ?? 0) > 0),
|
|
57517
57559
|
stream: stream4,
|
|
57518
57560
|
...tools.length > 0 ? { tools } : {},
|
|
@@ -57558,7 +57600,8 @@ function systemToText(system) {
|
|
|
57558
57600
|
|
|
57559
57601
|
`);
|
|
57560
57602
|
}
|
|
57561
|
-
function messagesToOllama(messages,
|
|
57603
|
+
function messagesToOllama(messages, visionSupport, model = "") {
|
|
57604
|
+
const supportsVision = shouldSendImages(visionSupport);
|
|
57562
57605
|
const result = [];
|
|
57563
57606
|
const toolNamesById = new Map;
|
|
57564
57607
|
for (const message of messages) {
|
|
@@ -57608,7 +57651,7 @@ function messagesToOllama(messages, supportsVision, model = "") {
|
|
|
57608
57651
|
case "tool_result": {
|
|
57609
57652
|
const toolName = toolNamesById.get(block.tool_use_id) ?? block.tool_use_id;
|
|
57610
57653
|
const split = splitToolResultContent(block.content);
|
|
57611
|
-
const note = describeToolResultImages(split.images.length, toolName,
|
|
57654
|
+
const note = describeToolResultImages(split.images.length, toolName, visionSupport, model);
|
|
57612
57655
|
toolMessages.push({
|
|
57613
57656
|
role: "tool",
|
|
57614
57657
|
content: [split.text, note].filter(Boolean).join(`
|
|
@@ -57626,7 +57669,7 @@ function messagesToOllama(messages, supportsVision, model = "") {
|
|
|
57626
57669
|
if (supportsVision && block.source.type === "base64") {
|
|
57627
57670
|
images.push(block.source.data);
|
|
57628
57671
|
} else if (!supportsVision) {
|
|
57629
|
-
textParts.push("[Image input omitted
|
|
57672
|
+
textParts.push(describeVisionSupport(visionSupport, model, 1) ?? "[Image input omitted]");
|
|
57630
57673
|
} else {
|
|
57631
57674
|
textParts.push("[Image input omitted: unsupported image source]");
|
|
57632
57675
|
}
|
|
@@ -58299,15 +58342,15 @@ function splitToolResultContent(content) {
|
|
|
58299
58342
|
return { text: textParts.filter(Boolean).join(`
|
|
58300
58343
|
`), images };
|
|
58301
58344
|
}
|
|
58302
|
-
function describeToolResultImages(count3, toolName,
|
|
58345
|
+
function describeToolResultImages(count3, toolName, visionSupport, model) {
|
|
58303
58346
|
if (count3 === 0)
|
|
58304
58347
|
return "";
|
|
58305
58348
|
const plural = count3 === 1 ? "image" : `${count3} images`;
|
|
58306
|
-
if (
|
|
58349
|
+
if (visionSupport === "supported") {
|
|
58307
58350
|
return `[${plural} from ${toolName} attached to the following message]`;
|
|
58308
58351
|
}
|
|
58309
|
-
const
|
|
58310
|
-
return `[
|
|
58352
|
+
const detail = describeVisionSupport(visionSupport, model, count3);
|
|
58353
|
+
return detail ? `[from ${toolName}] ${detail}` : "";
|
|
58311
58354
|
}
|
|
58312
58355
|
function contentBlockToText(content) {
|
|
58313
58356
|
if (typeof content === "string") {
|
|
@@ -58387,6 +58430,7 @@ var init_ollama = __esm(() => {
|
|
|
58387
58430
|
init_ollamaTuning();
|
|
58388
58431
|
init_kimiToolCalls();
|
|
58389
58432
|
init_json();
|
|
58433
|
+
init_visionCapability();
|
|
58390
58434
|
init_debug();
|
|
58391
58435
|
ollamaModelCapabilitiesCache = new Map;
|
|
58392
58436
|
warnedToolsUnsupportedModels = new Set;
|
|
@@ -63228,6 +63272,15 @@ function calculateUSDCost(resolvedModel, usage) {
|
|
|
63228
63272
|
const modelCosts = getModelCosts(resolvedModel, usage);
|
|
63229
63273
|
return tokensToUSDCost(modelCosts, usage);
|
|
63230
63274
|
}
|
|
63275
|
+
function calculateCostFromTokens(model, tokens) {
|
|
63276
|
+
const usage = {
|
|
63277
|
+
input_tokens: tokens.inputTokens,
|
|
63278
|
+
output_tokens: tokens.outputTokens,
|
|
63279
|
+
cache_read_input_tokens: tokens.cacheReadInputTokens,
|
|
63280
|
+
cache_creation_input_tokens: tokens.cacheCreationInputTokens
|
|
63281
|
+
};
|
|
63282
|
+
return calculateUSDCost(model, usage);
|
|
63283
|
+
}
|
|
63231
63284
|
function formatPrice(price) {
|
|
63232
63285
|
if (Number.isInteger(price)) {
|
|
63233
63286
|
return `$${price}`;
|
|
@@ -75151,7 +75204,7 @@ var init_auth = __esm(() => {
|
|
|
75151
75204
|
|
|
75152
75205
|
// src/utils/userAgent.ts
|
|
75153
75206
|
function getURCodeUserAgent() {
|
|
75154
|
-
return `ur/${"1.
|
|
75207
|
+
return `ur/${"1.58.1"}`;
|
|
75155
75208
|
}
|
|
75156
75209
|
|
|
75157
75210
|
// src/utils/workloadContext.ts
|
|
@@ -75173,7 +75226,7 @@ function getUserAgent() {
|
|
|
75173
75226
|
const clientApp = process.env.UR_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.UR_AGENT_SDK_CLIENT_APP}` : "";
|
|
75174
75227
|
const workload = getWorkload();
|
|
75175
75228
|
const workloadSuffix = workload ? `, workload/${workload}` : "";
|
|
75176
|
-
return `ur-cli/${"1.
|
|
75229
|
+
return `ur-cli/${"1.58.1"} (${process.env.USER_TYPE}, ${process.env.UR_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
|
|
75177
75230
|
}
|
|
75178
75231
|
function getMCPUserAgent() {
|
|
75179
75232
|
const parts = [];
|
|
@@ -75187,7 +75240,7 @@ function getMCPUserAgent() {
|
|
|
75187
75240
|
parts.push(`client-app/${process.env.UR_AGENT_SDK_CLIENT_APP}`);
|
|
75188
75241
|
}
|
|
75189
75242
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
75190
|
-
return `ur/${"1.
|
|
75243
|
+
return `ur/${"1.58.1"}${suffix}`;
|
|
75191
75244
|
}
|
|
75192
75245
|
function getWebFetchUserAgent() {
|
|
75193
75246
|
return `UR-User (${getURCodeUserAgent()})`;
|
|
@@ -75325,7 +75378,7 @@ var init_user = __esm(() => {
|
|
|
75325
75378
|
deviceId,
|
|
75326
75379
|
sessionId: getSessionId(),
|
|
75327
75380
|
email: getEmail(),
|
|
75328
|
-
appVersion: "1.
|
|
75381
|
+
appVersion: "1.58.1",
|
|
75329
75382
|
platform: getHostPlatformForAnalytics(),
|
|
75330
75383
|
organizationUuid,
|
|
75331
75384
|
accountUuid,
|
|
@@ -83525,7 +83578,7 @@ var init_metadata = __esm(() => {
|
|
|
83525
83578
|
COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
|
|
83526
83579
|
WHITESPACE_REGEX = /\s+/;
|
|
83527
83580
|
getVersionBase = memoize_default(() => {
|
|
83528
|
-
const match = "1.
|
|
83581
|
+
const match = "1.58.1".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
|
|
83529
83582
|
return match ? match[0] : undefined;
|
|
83530
83583
|
});
|
|
83531
83584
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -83565,7 +83618,7 @@ var init_metadata = __esm(() => {
|
|
|
83565
83618
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
83566
83619
|
isURCodeAction: isEnvTruthy(process.env.UR_CODE_ACTION),
|
|
83567
83620
|
isURAiAuth: isURAISubscriber(),
|
|
83568
|
-
version: "1.
|
|
83621
|
+
version: "1.58.1",
|
|
83569
83622
|
versionBase: getVersionBase(),
|
|
83570
83623
|
buildTime: "",
|
|
83571
83624
|
deploymentEnvironment: env2.detectDeploymentEnvironment(),
|
|
@@ -84235,7 +84288,7 @@ function initialize1PEventLogging() {
|
|
|
84235
84288
|
const platform2 = getPlatform();
|
|
84236
84289
|
const attributes = {
|
|
84237
84290
|
[import_semantic_conventions4.ATTR_SERVICE_NAME]: "ur",
|
|
84238
|
-
[import_semantic_conventions4.ATTR_SERVICE_VERSION]: "1.
|
|
84291
|
+
[import_semantic_conventions4.ATTR_SERVICE_VERSION]: "1.58.1"
|
|
84239
84292
|
};
|
|
84240
84293
|
if (platform2 === "wsl") {
|
|
84241
84294
|
const wslVersion = getWslVersion();
|
|
@@ -84263,7 +84316,7 @@ function initialize1PEventLogging() {
|
|
|
84263
84316
|
})
|
|
84264
84317
|
]
|
|
84265
84318
|
});
|
|
84266
|
-
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.urhq.ur.events", "1.
|
|
84319
|
+
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.urhq.ur.events", "1.58.1");
|
|
84267
84320
|
}
|
|
84268
84321
|
async function reinitialize1PEventLoggingIfConfigChanged() {
|
|
84269
84322
|
if (!is1PEventLoggingEnabled() || !firstPartyEventLoggerProvider) {
|
|
@@ -88092,8 +88145,7 @@ function buildOllamaShowRequestBody(name) {
|
|
|
88092
88145
|
return JSON.stringify({ model: name });
|
|
88093
88146
|
}
|
|
88094
88147
|
function inferVision(name, capabilities) {
|
|
88095
|
-
|
|
88096
|
-
return capabilities.includes("vision") || lowered.includes("vision") || lowered.includes("llava") || lowered.includes("moondream") || lowered.includes("minicpm-v");
|
|
88148
|
+
return resolveVisionSupport(name, capabilities.length > 0 ? new Set(capabilities) : null) === "supported";
|
|
88097
88149
|
}
|
|
88098
88150
|
function inferCode(name, family) {
|
|
88099
88151
|
const lowered = `${name} ${family ?? ""}`.toLowerCase();
|
|
@@ -88164,6 +88216,7 @@ var call = async (args) => {
|
|
|
88164
88216
|
};
|
|
88165
88217
|
};
|
|
88166
88218
|
var init_model_doctor = __esm(() => {
|
|
88219
|
+
init_visionCapability();
|
|
88167
88220
|
init_argumentSubstitution();
|
|
88168
88221
|
init_ollamaConfig();
|
|
88169
88222
|
});
|
|
@@ -94102,7 +94155,7 @@ function formatAgentTrendReport(report = buildAgentTrendReport()) {
|
|
|
94102
94155
|
function formatA2AAgentCard(options = {}, pretty = true) {
|
|
94103
94156
|
return JSON.stringify(buildA2AAgentCard(options), null, pretty ? 2 : 0);
|
|
94104
94157
|
}
|
|
94105
|
-
var urVersion = "1.
|
|
94158
|
+
var urVersion = "1.58.1", researchSnapshotDate = "2026-07-15", coverage, priorityRoadmap;
|
|
94106
94159
|
var init_trends = __esm(() => {
|
|
94107
94160
|
init_a2aCardSignature();
|
|
94108
94161
|
coverage = [
|
|
@@ -96903,7 +96956,7 @@ function getAttributionHeader(fingerprint) {
|
|
|
96903
96956
|
if (!isAttributionHeaderEnabled()) {
|
|
96904
96957
|
return "";
|
|
96905
96958
|
}
|
|
96906
|
-
const version2 = `${"1.
|
|
96959
|
+
const version2 = `${"1.58.1"}.${fingerprint}`;
|
|
96907
96960
|
const entrypoint = process.env.UR_CODE_ENTRYPOINT ?? "unknown";
|
|
96908
96961
|
const cch = "";
|
|
96909
96962
|
const workload = getWorkload();
|
|
@@ -154492,7 +154545,7 @@ var init_projectSafety = __esm(() => {
|
|
|
154492
154545
|
function getInstruments() {
|
|
154493
154546
|
if (instruments)
|
|
154494
154547
|
return instruments;
|
|
154495
|
-
const meter = import_api10.metrics.getMeter("ur-agent.gen_ai", "1.
|
|
154548
|
+
const meter = import_api10.metrics.getMeter("ur-agent.gen_ai", "1.58.1");
|
|
154496
154549
|
instruments = {
|
|
154497
154550
|
operationDuration: meter.createHistogram("gen_ai.client.operation.duration", {
|
|
154498
154551
|
description: "GenAI operation duration.",
|
|
@@ -154590,7 +154643,7 @@ function genAiAgentAttributes() {
|
|
|
154590
154643
|
"gen_ai.operation.name": GEN_AI_OPERATION_INVOKE_AGENT,
|
|
154591
154644
|
"gen_ai.provider.name": "ur",
|
|
154592
154645
|
"gen_ai.agent.name": "UR-Nexus",
|
|
154593
|
-
"gen_ai.agent.version": "1.
|
|
154646
|
+
"gen_ai.agent.version": "1.58.1"
|
|
154594
154647
|
};
|
|
154595
154648
|
}
|
|
154596
154649
|
function genAiWorkflowAttributes(workflowName) {
|
|
@@ -154606,7 +154659,7 @@ function genAiWorkflowAttributes(workflowName) {
|
|
|
154606
154659
|
function startGenAiWorkflowSpan(workflowName) {
|
|
154607
154660
|
const attributes = genAiWorkflowAttributes(workflowName);
|
|
154608
154661
|
const name = typeof attributes["gen_ai.workflow.name"] === "string" ? `invoke_workflow ${attributes["gen_ai.workflow.name"]}` : GEN_AI_OPERATION_INVOKE_WORKFLOW;
|
|
154609
|
-
return import_api10.trace.getTracer("ur-agent.gen_ai", "1.
|
|
154662
|
+
return import_api10.trace.getTracer("ur-agent.gen_ai", "1.58.1").startSpan(name, { kind: import_api10.SpanKind.INTERNAL, attributes });
|
|
154610
154663
|
}
|
|
154611
154664
|
function endGenAiWorkflowSpan(span, options2 = {}) {
|
|
154612
154665
|
try {
|
|
@@ -154644,7 +154697,7 @@ function startGenAiMemorySpan(operation, options2 = {}) {
|
|
|
154644
154697
|
if (options2.recordCount !== undefined && Number.isInteger(options2.recordCount) && options2.recordCount >= 0) {
|
|
154645
154698
|
attributes["gen_ai.memory.record.count"] = options2.recordCount;
|
|
154646
154699
|
}
|
|
154647
|
-
return import_api10.trace.getTracer("ur-agent.gen_ai", "1.
|
|
154700
|
+
return import_api10.trace.getTracer("ur-agent.gen_ai", "1.58.1").startSpan(operation, { kind: import_api10.SpanKind.INTERNAL, attributes });
|
|
154648
154701
|
}
|
|
154649
154702
|
function endGenAiMemorySpan(span, options2 = {}) {
|
|
154650
154703
|
try {
|
|
@@ -206163,7 +206216,7 @@ function getTelemetryAttributes() {
|
|
|
206163
206216
|
attributes["session.id"] = sessionId;
|
|
206164
206217
|
}
|
|
206165
206218
|
if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
|
|
206166
|
-
attributes["app.version"] = "1.
|
|
206219
|
+
attributes["app.version"] = "1.58.1";
|
|
206167
206220
|
}
|
|
206168
206221
|
const oauthAccount = getOauthAccountInfo();
|
|
206169
206222
|
if (oauthAccount) {
|
|
@@ -222354,6 +222407,24 @@ Usage notes:
|
|
|
222354
222407
|
- Use multiSelect: true to allow multiple answers to be selected for a question
|
|
222355
222408
|
- If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label
|
|
222356
222409
|
|
|
222410
|
+
Writing the three fields \u2014 they must each carry DIFFERENT information:
|
|
222411
|
+
- \`header\` names the dimension being decided ("Database", "Auth method"). It is not a shortened copy of the question.
|
|
222412
|
+
- \`label\` names the choice ("PostgreSQL"). It is not a restatement of the question.
|
|
222413
|
+
- \`description\` says what happens if this is picked and what it costs \u2014 the trade-off, limitation or consequence the label does not already convey. It is the only field with room to be genuinely informative, so it must not paraphrase the label back to the user.
|
|
222414
|
+
|
|
222415
|
+
A description that can be derived from reading the label is wasted space and makes the menu harder to use, not easier. Before writing one, ask: does this tell the user something they could not already see? If not, replace it with the thing that actually distinguishes this option from its neighbours.
|
|
222416
|
+
|
|
222417
|
+
Bad \u2014 description restates the label:
|
|
222418
|
+
question: "Which database should we use?"
|
|
222419
|
+
header: "Which DB" (repeats the question)
|
|
222420
|
+
label: "Use PostgreSQL" description: "Use PostgreSQL as the database."
|
|
222421
|
+
|
|
222422
|
+
Good \u2014 each field adds something:
|
|
222423
|
+
question: "Which database should we use?"
|
|
222424
|
+
header: "Database"
|
|
222425
|
+
label: "PostgreSQL" description: "Relational with strong consistency; needs a running server and a migration step."
|
|
222426
|
+
label: "SQLite" description: "Zero setup, single file; no concurrent writers, so it will not survive multiple workers."
|
|
222427
|
+
|
|
222357
222428
|
Plan mode note: In plan mode, use this tool to clarify requirements or choose between approaches BEFORE finalizing your plan. Do NOT use this tool to ask "Is my plan ready?" or "Should I proceed?" - use ${EXIT_PLAN_MODE_TOOL_NAME} for plan approval. IMPORTANT: Do not reference "the plan" in your questions (e.g., "Do you have feedback about the plan?", "Does the plan look good?") because the user cannot see the plan in the UI until you call ${EXIT_PLAN_MODE_TOOL_NAME}. If you need plan approval, use ${EXIT_PLAN_MODE_TOOL_NAME} instead.
|
|
222358
222429
|
`;
|
|
222359
222430
|
});
|
|
@@ -241837,7 +241908,7 @@ function getInstallationEnv() {
|
|
|
241837
241908
|
return;
|
|
241838
241909
|
}
|
|
241839
241910
|
function getURCodeVersion() {
|
|
241840
|
-
return "1.
|
|
241911
|
+
return "1.58.1";
|
|
241841
241912
|
}
|
|
241842
241913
|
async function getInstalledVSCodeExtensionVersion(command) {
|
|
241843
241914
|
const { stdout } = await execFileNoThrow(command, ["--list-extensions", "--show-versions"], {
|
|
@@ -249168,7 +249239,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
|
|
|
249168
249239
|
const client2 = new Client({
|
|
249169
249240
|
name: "ur",
|
|
249170
249241
|
title: "UR",
|
|
249171
|
-
version: "1.
|
|
249242
|
+
version: "1.58.1",
|
|
249172
249243
|
description: "UR-Nexus autonomous engineering workflow engine",
|
|
249173
249244
|
websiteUrl: PRODUCT_URL
|
|
249174
249245
|
}, {
|
|
@@ -249528,7 +249599,7 @@ var init_client5 = __esm(() => {
|
|
|
249528
249599
|
const client2 = new Client({
|
|
249529
249600
|
name: "ur",
|
|
249530
249601
|
title: "UR",
|
|
249531
|
-
version: "1.
|
|
249602
|
+
version: "1.58.1",
|
|
249532
249603
|
description: "UR-Nexus autonomous engineering workflow engine",
|
|
249533
249604
|
websiteUrl: PRODUCT_URL
|
|
249534
249605
|
}, {
|
|
@@ -262129,7 +262200,7 @@ async function createRuntime() {
|
|
|
262129
262200
|
bootstrapTelemetry();
|
|
262130
262201
|
const resource = defaultResource().merge(detectResources({ detectors: [envDetector] })).merge(resourceFromAttributes({
|
|
262131
262202
|
[import_semantic_conventions7.ATTR_SERVICE_NAME]: "ur-agent",
|
|
262132
|
-
[import_semantic_conventions7.ATTR_SERVICE_VERSION]: "1.
|
|
262203
|
+
[import_semantic_conventions7.ATTR_SERVICE_VERSION]: "1.58.1"
|
|
262133
262204
|
}));
|
|
262134
262205
|
const tracerProvider = exporters.traces.length > 0 ? new BasicTracerProvider({
|
|
262135
262206
|
resource,
|
|
@@ -262162,11 +262233,11 @@ async function createRuntime() {
|
|
|
262162
262233
|
setMeterProvider(meterProvider);
|
|
262163
262234
|
setLoggerProvider(loggerProvider);
|
|
262164
262235
|
if (meterProvider) {
|
|
262165
|
-
const meter = meterProvider.getMeter("ur-agent", "1.
|
|
262236
|
+
const meter = meterProvider.getMeter("ur-agent", "1.58.1");
|
|
262166
262237
|
setMeter(meter, (name, options2) => meter.createCounter(name, options2));
|
|
262167
262238
|
}
|
|
262168
262239
|
if (loggerProvider) {
|
|
262169
|
-
setEventLogger(loggerProvider.getLogger("ur-agent.events", "1.
|
|
262240
|
+
setEventLogger(loggerProvider.getLogger("ur-agent.events", "1.58.1"));
|
|
262170
262241
|
}
|
|
262171
262242
|
if (!cleanupRegistered2) {
|
|
262172
262243
|
cleanupRegistered2 = true;
|
|
@@ -262828,9 +262899,9 @@ async function assertMinVersion() {
|
|
|
262828
262899
|
if (false) {}
|
|
262829
262900
|
try {
|
|
262830
262901
|
const versionConfig = await getDynamicConfig_BLOCKS_ON_INIT("tengu_version_config", { minVersion: "0.0.0" });
|
|
262831
|
-
if (versionConfig.minVersion && lt("1.
|
|
262902
|
+
if (versionConfig.minVersion && lt("1.58.1", versionConfig.minVersion)) {
|
|
262832
262903
|
console.error(`
|
|
262833
|
-
It looks like your version of UR (${"1.
|
|
262904
|
+
It looks like your version of UR (${"1.58.1"}) needs an update.
|
|
262834
262905
|
A newer version (${versionConfig.minVersion} or higher) is required to continue.
|
|
262835
262906
|
|
|
262836
262907
|
To update, please run:
|
|
@@ -263046,7 +263117,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
263046
263117
|
logError2(new AutoUpdaterError("Another process is currently installing an update"));
|
|
263047
263118
|
logEvent("tengu_auto_updater_lock_contention", {
|
|
263048
263119
|
pid: process.pid,
|
|
263049
|
-
currentVersion: "1.
|
|
263120
|
+
currentVersion: "1.58.1"
|
|
263050
263121
|
});
|
|
263051
263122
|
return "in_progress";
|
|
263052
263123
|
}
|
|
@@ -263055,7 +263126,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
263055
263126
|
if (!env2.isRunningWithBun() && env2.isNpmFromWindowsPath()) {
|
|
263056
263127
|
logError2(new Error("Windows NPM detected in WSL environment"));
|
|
263057
263128
|
logEvent("tengu_auto_updater_windows_npm_in_wsl", {
|
|
263058
|
-
currentVersion: "1.
|
|
263129
|
+
currentVersion: "1.58.1"
|
|
263059
263130
|
});
|
|
263060
263131
|
console.error(`
|
|
263061
263132
|
Error: Windows NPM detected in WSL
|
|
@@ -263590,7 +263661,7 @@ function detectLinuxGlobPatternWarnings() {
|
|
|
263590
263661
|
}
|
|
263591
263662
|
async function getDoctorDiagnostic() {
|
|
263592
263663
|
const installationType = await getCurrentInstallationType();
|
|
263593
|
-
const version2 = typeof MACRO !== "undefined" ? "1.
|
|
263664
|
+
const version2 = typeof MACRO !== "undefined" ? "1.58.1" : "unknown";
|
|
263594
263665
|
const installationPath = await getInstallationPath();
|
|
263595
263666
|
const invokedBinary = getInvokedBinary();
|
|
263596
263667
|
const multipleInstallations = await detectMultipleInstallations();
|
|
@@ -264525,8 +264596,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
264525
264596
|
const maxVersion = await getMaxVersion();
|
|
264526
264597
|
if (maxVersion && gt(version2, maxVersion)) {
|
|
264527
264598
|
logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version2} to ${maxVersion}`);
|
|
264528
|
-
if (gte("1.
|
|
264529
|
-
logForDebugging(`Native installer: current version ${"1.
|
|
264599
|
+
if (gte("1.58.1", maxVersion)) {
|
|
264600
|
+
logForDebugging(`Native installer: current version ${"1.58.1"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
264530
264601
|
logEvent("tengu_native_update_skipped_max_version", {
|
|
264531
264602
|
latency_ms: Date.now() - startTime,
|
|
264532
264603
|
max_version: maxVersion,
|
|
@@ -264537,7 +264608,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
264537
264608
|
version2 = maxVersion;
|
|
264538
264609
|
}
|
|
264539
264610
|
}
|
|
264540
|
-
if (!forceReinstall && version2 === "1.
|
|
264611
|
+
if (!forceReinstall && version2 === "1.58.1" && await versionIsAvailable(version2) && await isPossibleURBinary(executablePath)) {
|
|
264541
264612
|
logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
|
|
264542
264613
|
logEvent("tengu_native_update_complete", {
|
|
264543
264614
|
latency_ms: Date.now() - startTime,
|
|
@@ -320499,13 +320570,13 @@ var init_AskUserQuestionTool = __esm(() => {
|
|
|
320499
320570
|
import_compiler_runtime117 = __toESM(require_compiler_runtime(), 1);
|
|
320500
320571
|
jsx_dev_runtime145 = __toESM(require_jsx_dev_runtime(), 1);
|
|
320501
320572
|
questionOptionSchema = lazySchema(() => exports_external.object({
|
|
320502
|
-
label: exports_external.string().describe(
|
|
320503
|
-
description: exports_external.string().describe(
|
|
320573
|
+
label: exports_external.string().describe('The choice itself, 1-5 words. Name the option, do not restate the question: for "Which database?" use "PostgreSQL", not "Use PostgreSQL for the database".'),
|
|
320574
|
+
description: exports_external.string().describe('What actually happens if this is chosen, and the cost of choosing it \u2014 the information the user needs that the label does not already give them. Must NOT restate the label in a full sentence. Bad: label "PostgreSQL" / description "Use PostgreSQL." Good: label "PostgreSQL" / description "Relational, strong consistency; needs a running server and a migration step." Include the trade-off, limitation, or consequence that makes this choice different from the others.'),
|
|
320504
320575
|
preview: exports_external.string().optional().describe("Optional preview content rendered when this option is focused. Use for mockups, code snippets, or visual comparisons that help users compare options. See the tool description for the expected content format.")
|
|
320505
320576
|
}));
|
|
320506
320577
|
questionSchema = lazySchema(() => exports_external.object({
|
|
320507
320578
|
question: exports_external.string().describe('The complete question to ask the user. Should be clear, specific, and end with a question mark. Example: "Which library should we use for date formatting?" If multiSelect is true, phrase it accordingly, e.g. "Which features do you want to enable?"'),
|
|
320508
|
-
header: exports_external.string().describe(`
|
|
320579
|
+
header: exports_external.string().describe(`The category being decided, as a chip/tag (max ${ASK_USER_QUESTION_TOOL_CHIP_WIDTH} chars). Name the dimension, not the question: for "Which database should we use?" the header is "Database", not "Which DB". Examples: "Auth method", "Library", "Approach".`),
|
|
320509
320580
|
options: exports_external.array(questionOptionSchema()).min(2).max(8).describe(`The available choices for this question. Must have 2-8 options. Keep options concise and distinct; there should be no 'Other' option, that will be provided automatically.`),
|
|
320510
320581
|
multiSelect: exports_external.boolean().default(false).describe("Set to true to allow the user to select multiple options instead of just one. Use when choices are not mutually exclusive.")
|
|
320511
320582
|
}));
|
|
@@ -334732,7 +334803,7 @@ function isAnyTracingEnabled() {
|
|
|
334732
334803
|
return isTelemetryEnabled() || isEnhancedTelemetryEnabled() || isBetaTracingEnabled();
|
|
334733
334804
|
}
|
|
334734
334805
|
function getTracer() {
|
|
334735
|
-
return import_api39.trace.getTracer("ur-agent.gen_ai", "1.
|
|
334806
|
+
return import_api39.trace.getTracer("ur-agent.gen_ai", "1.58.1");
|
|
334736
334807
|
}
|
|
334737
334808
|
function createSpanAttributes(spanType, customAttributes = {}) {
|
|
334738
334809
|
const baseAttributes = getTelemetryAttributes();
|
|
@@ -364235,7 +364306,7 @@ function Feedback({
|
|
|
364235
364306
|
platform: env2.platform,
|
|
364236
364307
|
gitRepo: envInfo.isGit,
|
|
364237
364308
|
terminal: env2.terminal,
|
|
364238
|
-
version: "1.
|
|
364309
|
+
version: "1.58.1",
|
|
364239
364310
|
transcript: normalizeMessagesForAPI(messages),
|
|
364240
364311
|
errors: sanitizedErrors,
|
|
364241
364312
|
lastApiRequest: getLastAPIRequest(),
|
|
@@ -364427,7 +364498,7 @@ function Feedback({
|
|
|
364427
364498
|
", ",
|
|
364428
364499
|
env2.terminal,
|
|
364429
364500
|
", v",
|
|
364430
|
-
"1.
|
|
364501
|
+
"1.58.1"
|
|
364431
364502
|
]
|
|
364432
364503
|
}, undefined, true, undefined, this)
|
|
364433
364504
|
]
|
|
@@ -364533,7 +364604,7 @@ ${sanitizedDescription}
|
|
|
364533
364604
|
` + `**Environment Info**
|
|
364534
364605
|
` + `- Platform: ${env2.platform}
|
|
364535
364606
|
` + `- Terminal: ${env2.terminal}
|
|
364536
|
-
` + `- Version: ${"1.
|
|
364607
|
+
` + `- Version: ${"1.58.1"}
|
|
364537
364608
|
` + `- Feedback ID: ${feedbackId}
|
|
364538
364609
|
` + `
|
|
364539
364610
|
**Errors**
|
|
@@ -367643,7 +367714,7 @@ function buildPrimarySection() {
|
|
|
367643
367714
|
}, undefined, false, undefined, this);
|
|
367644
367715
|
return [{
|
|
367645
367716
|
label: "Version",
|
|
367646
|
-
value: "1.
|
|
367717
|
+
value: "1.58.1"
|
|
367647
367718
|
}, {
|
|
367648
367719
|
label: "Session name",
|
|
367649
367720
|
value: nameValue
|
|
@@ -370973,7 +371044,7 @@ function Config({
|
|
|
370973
371044
|
}
|
|
370974
371045
|
}, undefined, false, undefined, this)
|
|
370975
371046
|
}, undefined, false, undefined, this) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_dev_runtime179.jsxDEV(ChannelDowngradeDialog, {
|
|
370976
|
-
currentVersion: "1.
|
|
371047
|
+
currentVersion: "1.58.1",
|
|
370977
371048
|
onChoice: (choice) => {
|
|
370978
371049
|
setShowSubmenu(null);
|
|
370979
371050
|
setTabsHidden(false);
|
|
@@ -370985,7 +371056,7 @@ function Config({
|
|
|
370985
371056
|
autoUpdatesChannel: "stable"
|
|
370986
371057
|
};
|
|
370987
371058
|
if (choice === "stay") {
|
|
370988
|
-
newSettings.minimumVersion = "1.
|
|
371059
|
+
newSettings.minimumVersion = "1.58.1";
|
|
370989
371060
|
}
|
|
370990
371061
|
updateSettingsForSource("userSettings", newSettings);
|
|
370991
371062
|
setSettingsData((prev_27) => ({
|
|
@@ -379049,7 +379120,7 @@ function HelpV2(t0) {
|
|
|
379049
379120
|
let t6;
|
|
379050
379121
|
if ($2[31] !== tabs) {
|
|
379051
379122
|
t6 = /* @__PURE__ */ jsx_dev_runtime206.jsxDEV(Tabs, {
|
|
379052
|
-
title: `UR v${"1.
|
|
379123
|
+
title: `UR v${"1.58.1"}`,
|
|
379053
379124
|
color: "professionalBlue",
|
|
379054
379125
|
defaultTab: "general",
|
|
379055
379126
|
children: tabs
|
|
@@ -379966,7 +380037,7 @@ function buildToolUseContext(tools, readFileStateCache, toolPermissionContext, a
|
|
|
379966
380037
|
async function handleInitialize(options2) {
|
|
379967
380038
|
return {
|
|
379968
380039
|
name: "UR",
|
|
379969
|
-
version: "1.
|
|
380040
|
+
version: "1.58.1",
|
|
379970
380041
|
protocolVersion: "0.1.0",
|
|
379971
380042
|
workspaceRoot: options2.cwd,
|
|
379972
380043
|
capabilities: {
|
|
@@ -397074,7 +397145,7 @@ function getAllReleaseNotes(changelogContent = getStoredChangelogFromMemory()) {
|
|
|
397074
397145
|
return [];
|
|
397075
397146
|
}
|
|
397076
397147
|
}
|
|
397077
|
-
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.
|
|
397148
|
+
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.58.1") {
|
|
397078
397149
|
if (process.env.USER_TYPE === "ant") {
|
|
397079
397150
|
const changelog = "";
|
|
397080
397151
|
if (changelog) {
|
|
@@ -397101,7 +397172,7 @@ async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.57.5")
|
|
|
397101
397172
|
releaseNotes
|
|
397102
397173
|
};
|
|
397103
397174
|
}
|
|
397104
|
-
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "1.
|
|
397175
|
+
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "1.58.1") {
|
|
397105
397176
|
if (process.env.USER_TYPE === "ant") {
|
|
397106
397177
|
const changelog = "";
|
|
397107
397178
|
if (changelog) {
|
|
@@ -399958,7 +400029,7 @@ function getRecentActivitySync() {
|
|
|
399958
400029
|
return cachedActivity;
|
|
399959
400030
|
}
|
|
399960
400031
|
function getLogoDisplayData() {
|
|
399961
|
-
const version2 = process.env.DEMO_VERSION ?? "1.
|
|
400032
|
+
const version2 = process.env.DEMO_VERSION ?? "1.58.1";
|
|
399962
400033
|
const serverUrl = getDirectConnectServerUrl();
|
|
399963
400034
|
const displayPath = process.env.DEMO_VERSION ? "/code/ur" : getDisplayPath(getCwd());
|
|
399964
400035
|
const cwd2 = serverUrl ? `${displayPath} in ${serverUrl.replace(/^https?:\/\//, "")}` : displayPath;
|
|
@@ -400842,7 +400913,7 @@ function LogoV2() {
|
|
|
400842
400913
|
if ($2[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
400843
400914
|
t2 = () => {
|
|
400844
400915
|
const currentConfig2 = getGlobalConfig();
|
|
400845
|
-
if (currentConfig2.lastReleaseNotesSeen === "1.
|
|
400916
|
+
if (currentConfig2.lastReleaseNotesSeen === "1.58.1") {
|
|
400846
400917
|
return;
|
|
400847
400918
|
}
|
|
400848
400919
|
saveGlobalConfig(_temp327);
|
|
@@ -401527,12 +401598,12 @@ function LogoV2() {
|
|
|
401527
401598
|
return t41;
|
|
401528
401599
|
}
|
|
401529
401600
|
function _temp327(current) {
|
|
401530
|
-
if (current.lastReleaseNotesSeen === "1.
|
|
401601
|
+
if (current.lastReleaseNotesSeen === "1.58.1") {
|
|
401531
401602
|
return current;
|
|
401532
401603
|
}
|
|
401533
401604
|
return {
|
|
401534
401605
|
...current,
|
|
401535
|
-
lastReleaseNotesSeen: "1.
|
|
401606
|
+
lastReleaseNotesSeen: "1.58.1"
|
|
401536
401607
|
};
|
|
401537
401608
|
}
|
|
401538
401609
|
function _temp241(s_0) {
|
|
@@ -418330,7 +418401,7 @@ function compileAgenticCiWorkflow(specName = "default", options2 = {}) {
|
|
|
418330
418401
|
if (spec.name !== specName) {
|
|
418331
418402
|
throw new Error("Agentic CI workflow spec name does not match");
|
|
418332
418403
|
}
|
|
418333
|
-
const packageVersion = options2.packageVersion ?? (typeof MACRO !== "undefined" ? "1.
|
|
418404
|
+
const packageVersion = options2.packageVersion ?? (typeof MACRO !== "undefined" ? "1.58.1" : "1.58.1");
|
|
418334
418405
|
if (!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(packageVersion)) {
|
|
418335
418406
|
throw new Error("invalid ur-agent package version");
|
|
418336
418407
|
}
|
|
@@ -419323,7 +419394,7 @@ runner; \`ur trigger\` is the inbound parser that decides what to run.
|
|
|
419323
419394
|
path: ".github/workflows/ur.yml",
|
|
419324
419395
|
root: "project",
|
|
419325
419396
|
content: compileAgenticCiWorkflow("default", {
|
|
419326
|
-
packageVersion: typeof MACRO !== "undefined" ? "1.
|
|
419397
|
+
packageVersion: typeof MACRO !== "undefined" ? "1.58.1" : "1.58.1"
|
|
419327
419398
|
})
|
|
419328
419399
|
},
|
|
419329
419400
|
{
|
|
@@ -419386,7 +419457,7 @@ function value(tokens, flag) {
|
|
|
419386
419457
|
return index2 >= 0 ? tokens[index2 + 1] : undefined;
|
|
419387
419458
|
}
|
|
419388
419459
|
function cliVersion() {
|
|
419389
|
-
return typeof MACRO !== "undefined" ? "1.
|
|
419460
|
+
return typeof MACRO !== "undefined" ? "1.58.1" : "1.58.1";
|
|
419390
419461
|
}
|
|
419391
419462
|
function workflowPath(cwd2) {
|
|
419392
419463
|
return join159(cwd2, ".github", "workflows", "ur-agentic-ci.yml");
|
|
@@ -425242,7 +425313,7 @@ function createAcpStdioApp(deps) {
|
|
|
425242
425313
|
}
|
|
425243
425314
|
},
|
|
425244
425315
|
authMethods: [],
|
|
425245
|
-
agentInfo: { name: "UR-Nexus", version: "1.
|
|
425316
|
+
agentInfo: { name: "UR-Nexus", version: "1.58.1" }
|
|
425246
425317
|
})).onRequest("authenticate", () => ({})).onRequest("session/new", async (context6) => {
|
|
425247
425318
|
const result = runtime2.newSession(context6.params.cwd, context6.params.mcpServers, context6.params.additionalDirectories);
|
|
425248
425319
|
await runtime2.announce({
|
|
@@ -425339,7 +425410,7 @@ function createAcpStdioAgent(deps) {
|
|
|
425339
425410
|
}
|
|
425340
425411
|
},
|
|
425341
425412
|
authMethods: [],
|
|
425342
|
-
agentInfo: { name: "UR-Nexus", version: "1.
|
|
425413
|
+
agentInfo: { name: "UR-Nexus", version: "1.58.1" }
|
|
425343
425414
|
});
|
|
425344
425415
|
return;
|
|
425345
425416
|
case "authenticate":
|
|
@@ -434461,7 +434532,18 @@ var init_thread2 = __esm(() => {
|
|
|
434461
434532
|
});
|
|
434462
434533
|
|
|
434463
434534
|
// src/services/agents/inspector.ts
|
|
434464
|
-
import { existsSync as existsSync64, readFileSync as readFileSync61 } from "fs";
|
|
434535
|
+
import { existsSync as existsSync64, readdirSync as readdirSync22, readFileSync as readFileSync61 } from "fs";
|
|
434536
|
+
import { join as join182 } from "path";
|
|
434537
|
+
function emptyUsage2() {
|
|
434538
|
+
return {
|
|
434539
|
+
inputTokens: 0,
|
|
434540
|
+
outputTokens: 0,
|
|
434541
|
+
cacheReadInputTokens: 0,
|
|
434542
|
+
cacheCreationInputTokens: 0,
|
|
434543
|
+
costUSD: 0,
|
|
434544
|
+
model: null
|
|
434545
|
+
};
|
|
434546
|
+
}
|
|
434465
434547
|
function preview3(value2, max2 = PREVIEW_CHARS) {
|
|
434466
434548
|
const text = value2.replace(/\s+/g, " ").trim();
|
|
434467
434549
|
if (text.length <= max2)
|
|
@@ -434489,10 +434571,13 @@ function inspectMessages(messages) {
|
|
|
434489
434571
|
errors: 0,
|
|
434490
434572
|
verdicts: { pass: 0, fail: 0, partial: 0 },
|
|
434491
434573
|
tokens: { input: 0, output: 0 },
|
|
434492
|
-
toolUsage: {}
|
|
434574
|
+
toolUsage: {},
|
|
434575
|
+
costUSD: 0,
|
|
434576
|
+
mainThreadCostUSD: 0
|
|
434493
434577
|
};
|
|
434494
434578
|
const agents = [];
|
|
434495
434579
|
const pendingById = new Map;
|
|
434580
|
+
const byAgentId = new Map;
|
|
434496
434581
|
for (const message of messages) {
|
|
434497
434582
|
const role = message.message?.role ?? message.type;
|
|
434498
434583
|
if (role === "assistant")
|
|
@@ -434501,6 +434586,26 @@ function inspectMessages(messages) {
|
|
|
434501
434586
|
if (usage11) {
|
|
434502
434587
|
summary2.tokens.input += usage11.input_tokens ?? 0;
|
|
434503
434588
|
summary2.tokens.output += usage11.output_tokens ?? 0;
|
|
434589
|
+
const tokens = {
|
|
434590
|
+
inputTokens: usage11.input_tokens ?? 0,
|
|
434591
|
+
outputTokens: usage11.output_tokens ?? 0,
|
|
434592
|
+
cacheReadInputTokens: usage11.cache_read_input_tokens ?? 0,
|
|
434593
|
+
cacheCreationInputTokens: usage11.cache_creation_input_tokens ?? 0
|
|
434594
|
+
};
|
|
434595
|
+
const model = message.message?.model ?? null;
|
|
434596
|
+
const cost2 = model ? calculateCostFromTokens(model, tokens) : 0;
|
|
434597
|
+
summary2.costUSD += cost2;
|
|
434598
|
+
const owner = message.agentId ? byAgentId.get(message.agentId) : undefined;
|
|
434599
|
+
if (owner) {
|
|
434600
|
+
owner.usage.inputTokens += tokens.inputTokens;
|
|
434601
|
+
owner.usage.outputTokens += tokens.outputTokens;
|
|
434602
|
+
owner.usage.cacheReadInputTokens += tokens.cacheReadInputTokens;
|
|
434603
|
+
owner.usage.cacheCreationInputTokens += tokens.cacheCreationInputTokens;
|
|
434604
|
+
owner.usage.costUSD += cost2;
|
|
434605
|
+
owner.usage.model ??= model;
|
|
434606
|
+
} else {
|
|
434607
|
+
summary2.mainThreadCostUSD += cost2;
|
|
434608
|
+
}
|
|
434504
434609
|
}
|
|
434505
434610
|
const content = message.message?.content;
|
|
434506
434611
|
if (!Array.isArray(content)) {
|
|
@@ -434530,7 +434635,8 @@ function inspectMessages(messages) {
|
|
|
434530
434635
|
promptPreview: preview3(String(input.prompt ?? "")),
|
|
434531
434636
|
resultPreview: "",
|
|
434532
434637
|
status: "pending",
|
|
434533
|
-
verdict: null
|
|
434638
|
+
verdict: null,
|
|
434639
|
+
usage: emptyUsage2()
|
|
434534
434640
|
};
|
|
434535
434641
|
agents.push(run3);
|
|
434536
434642
|
if (raw.id)
|
|
@@ -434619,9 +434725,87 @@ function formatInspection(report, json2) {
|
|
|
434619
434725
|
return lines.join(`
|
|
434620
434726
|
`);
|
|
434621
434727
|
}
|
|
434728
|
+
function summarizeSubagentCosts(subagentsDir) {
|
|
434729
|
+
let entries;
|
|
434730
|
+
try {
|
|
434731
|
+
entries = readdirSync22(subagentsDir);
|
|
434732
|
+
} catch {
|
|
434733
|
+
return [];
|
|
434734
|
+
}
|
|
434735
|
+
const rows = [];
|
|
434736
|
+
for (const entry of entries.sort()) {
|
|
434737
|
+
const matched = /^agent-(.+)\.jsonl$/.exec(entry);
|
|
434738
|
+
if (!matched)
|
|
434739
|
+
continue;
|
|
434740
|
+
let messages;
|
|
434741
|
+
try {
|
|
434742
|
+
messages = loadTranscript(join182(subagentsDir, entry));
|
|
434743
|
+
} catch {
|
|
434744
|
+
continue;
|
|
434745
|
+
}
|
|
434746
|
+
const row = {
|
|
434747
|
+
agentId: matched[1],
|
|
434748
|
+
model: null,
|
|
434749
|
+
messages: messages.length,
|
|
434750
|
+
inputTokens: 0,
|
|
434751
|
+
outputTokens: 0,
|
|
434752
|
+
cacheReadInputTokens: 0,
|
|
434753
|
+
cacheCreationInputTokens: 0,
|
|
434754
|
+
costUSD: 0
|
|
434755
|
+
};
|
|
434756
|
+
for (const message of messages) {
|
|
434757
|
+
const usage11 = message.message?.usage;
|
|
434758
|
+
if (!usage11)
|
|
434759
|
+
continue;
|
|
434760
|
+
const tokens = {
|
|
434761
|
+
inputTokens: usage11.input_tokens ?? 0,
|
|
434762
|
+
outputTokens: usage11.output_tokens ?? 0,
|
|
434763
|
+
cacheReadInputTokens: usage11.cache_read_input_tokens ?? 0,
|
|
434764
|
+
cacheCreationInputTokens: usage11.cache_creation_input_tokens ?? 0
|
|
434765
|
+
};
|
|
434766
|
+
row.inputTokens += tokens.inputTokens;
|
|
434767
|
+
row.outputTokens += tokens.outputTokens;
|
|
434768
|
+
row.cacheReadInputTokens += tokens.cacheReadInputTokens;
|
|
434769
|
+
row.cacheCreationInputTokens += tokens.cacheCreationInputTokens;
|
|
434770
|
+
const model = message.message?.model ?? null;
|
|
434771
|
+
row.model ??= model;
|
|
434772
|
+
if (model)
|
|
434773
|
+
row.costUSD += calculateCostFromTokens(model, tokens);
|
|
434774
|
+
}
|
|
434775
|
+
rows.push(row);
|
|
434776
|
+
}
|
|
434777
|
+
return rows.sort((a2, b) => b.costUSD - a2.costUSD);
|
|
434778
|
+
}
|
|
434779
|
+
function formatSubagentCosts(rows, json2) {
|
|
434780
|
+
if (json2)
|
|
434781
|
+
return JSON.stringify({ subagents: rows }, null, 2);
|
|
434782
|
+
if (rows.length === 0) {
|
|
434783
|
+
return "No subagent transcripts found for this session.";
|
|
434784
|
+
}
|
|
434785
|
+
const billed = rows.some((row) => row.costUSD > 0);
|
|
434786
|
+
const width = Math.max(...rows.map((row) => row.agentId.length), 5);
|
|
434787
|
+
const lines = ["Per-agent usage", ""];
|
|
434788
|
+
for (const row of rows) {
|
|
434789
|
+
const cost2 = billed ? ` ${formatUSD(row.costUSD).padStart(9)}` : "";
|
|
434790
|
+
lines.push(` ${row.agentId.padEnd(width)} ${String(row.inputTokens).padStart(9)} in ` + `${String(row.outputTokens).padStart(8)} out${cost2} ${row.model ?? "unknown model"}`);
|
|
434791
|
+
}
|
|
434792
|
+
const totalIn = rows.reduce((sum, row) => sum + row.inputTokens, 0);
|
|
434793
|
+
const totalOut = rows.reduce((sum, row) => sum + row.outputTokens, 0);
|
|
434794
|
+
const total = rows.reduce((sum, row) => sum + row.costUSD, 0);
|
|
434795
|
+
lines.push(` ${"-".repeat(width)} ${"-".repeat(12)} ${"-".repeat(12)}`, ` ${"total".padEnd(width)} ${String(totalIn).padStart(9)} in ` + `${String(totalOut).padStart(8)} out${billed ? ` ${formatUSD(total).padStart(9)}` : ""}`);
|
|
434796
|
+
if (!billed) {
|
|
434797
|
+
lines.push("", "Cost omitted: the active runtime is local and unbilled.");
|
|
434798
|
+
}
|
|
434799
|
+
return lines.join(`
|
|
434800
|
+
`);
|
|
434801
|
+
}
|
|
434802
|
+
function formatUSD(value2) {
|
|
434803
|
+
return value2 > 0 && value2 < 0.01 ? "<$0.01" : `$${value2.toFixed(2)}`;
|
|
434804
|
+
}
|
|
434622
434805
|
var AGENT_TOOL_NAMES, PREVIEW_CHARS = 160, VERDICT_RE2;
|
|
434623
434806
|
var init_inspector = __esm(() => {
|
|
434624
434807
|
init_json();
|
|
434808
|
+
init_modelCost();
|
|
434625
434809
|
AGENT_TOOL_NAMES = new Set(["Agent", "Task"]);
|
|
434626
434810
|
VERDICT_RE2 = /\bVERDICT:\s*(PASS|FAIL|PARTIAL)\b/i;
|
|
434627
434811
|
});
|
|
@@ -434631,11 +434815,33 @@ var exports_agent_inspect = {};
|
|
|
434631
434815
|
__export(exports_agent_inspect, {
|
|
434632
434816
|
call: () => call78
|
|
434633
434817
|
});
|
|
434818
|
+
import { dirname as dirname72 } from "path";
|
|
434819
|
+
function resolveSessionSubagentsDir() {
|
|
434820
|
+
try {
|
|
434821
|
+
return dirname72(getAgentTranscriptPath("probe"));
|
|
434822
|
+
} catch {
|
|
434823
|
+
return null;
|
|
434824
|
+
}
|
|
434825
|
+
}
|
|
434634
434826
|
var call78 = async (args, context6) => {
|
|
434635
434827
|
const tokens = parseArguments2(args);
|
|
434636
434828
|
const json2 = tokens.includes("--json");
|
|
434637
434829
|
const fileIndex2 = tokens.indexOf("--file");
|
|
434638
434830
|
const filePath = fileIndex2 >= 0 ? tokens[fileIndex2 + 1] : undefined;
|
|
434831
|
+
const costsIndex = tokens.indexOf("--costs");
|
|
434832
|
+
if (costsIndex >= 0) {
|
|
434833
|
+
const dir = tokens[costsIndex + 1] ?? resolveSessionSubagentsDir();
|
|
434834
|
+
if (!dir) {
|
|
434835
|
+
return {
|
|
434836
|
+
type: "text",
|
|
434837
|
+
value: "Could not locate a session directory. Pass one: ur agent-inspect --costs <sessionDir>/subagents"
|
|
434838
|
+
};
|
|
434839
|
+
}
|
|
434840
|
+
return {
|
|
434841
|
+
type: "text",
|
|
434842
|
+
value: formatSubagentCosts(summarizeSubagentCosts(dir), json2)
|
|
434843
|
+
};
|
|
434844
|
+
}
|
|
434639
434845
|
let messages;
|
|
434640
434846
|
if (filePath) {
|
|
434641
434847
|
try {
|
|
@@ -434661,6 +434867,7 @@ var call78 = async (args, context6) => {
|
|
|
434661
434867
|
};
|
|
434662
434868
|
var init_agent_inspect = __esm(() => {
|
|
434663
434869
|
init_inspector();
|
|
434870
|
+
init_sessionStorage();
|
|
434664
434871
|
init_argumentSubstitution();
|
|
434665
434872
|
});
|
|
434666
434873
|
|
|
@@ -434672,7 +434879,7 @@ var init_agent_inspect2 = __esm(() => {
|
|
|
434672
434879
|
name: "agent-inspect",
|
|
434673
434880
|
aliases: ["inspect-agents"],
|
|
434674
434881
|
description: "Reconstruct a per-subagent timeline (spawns, prompts, results, verdicts, tools, tokens) from this session or a transcript file",
|
|
434675
|
-
argumentHint: "[--file <path>] [--json]",
|
|
434882
|
+
argumentHint: "[--file <path>] [--costs [subagentsDir]] [--json]",
|
|
434676
434883
|
supportsNonInteractive: true,
|
|
434677
434884
|
load: () => Promise.resolve().then(() => (init_agent_inspect(), exports_agent_inspect))
|
|
434678
434885
|
};
|
|
@@ -434844,19 +435051,19 @@ import {
|
|
|
434844
435051
|
existsSync as existsSync65,
|
|
434845
435052
|
mkdirSync as mkdirSync46,
|
|
434846
435053
|
readFileSync as readFileSync62,
|
|
434847
|
-
readdirSync as
|
|
435054
|
+
readdirSync as readdirSync23,
|
|
434848
435055
|
statSync as statSync23,
|
|
434849
435056
|
writeFileSync as writeFileSync46
|
|
434850
435057
|
} from "fs";
|
|
434851
|
-
import { basename as basename46, join as
|
|
435058
|
+
import { basename as basename46, join as join183, relative as relative42, resolve as resolve59 } from "path";
|
|
434852
435059
|
function knowledgeDir(cwd2) {
|
|
434853
|
-
return
|
|
435060
|
+
return join183(cwd2, ".ur", "knowledge");
|
|
434854
435061
|
}
|
|
434855
435062
|
function sourcesPath(cwd2) {
|
|
434856
|
-
return
|
|
435063
|
+
return join183(knowledgeDir(cwd2), "sources.json");
|
|
434857
435064
|
}
|
|
434858
435065
|
function indexPath2(cwd2) {
|
|
434859
|
-
return
|
|
435066
|
+
return join183(knowledgeDir(cwd2), "index", "index.json");
|
|
434860
435067
|
}
|
|
434861
435068
|
function tokenize7(value2) {
|
|
434862
435069
|
return [...new Set(value2.toLowerCase().match(/[a-z0-9_]{3,}/g) ?? [])];
|
|
@@ -434926,14 +435133,14 @@ function collectFiles(cwd2, source) {
|
|
|
434926
435133
|
return;
|
|
434927
435134
|
let entries;
|
|
434928
435135
|
try {
|
|
434929
|
-
entries =
|
|
435136
|
+
entries = readdirSync23(dir);
|
|
434930
435137
|
} catch {
|
|
434931
435138
|
return;
|
|
434932
435139
|
}
|
|
434933
435140
|
for (const entry of entries) {
|
|
434934
435141
|
if (entry.startsWith(".") || entry === "node_modules")
|
|
434935
435142
|
continue;
|
|
434936
|
-
const full =
|
|
435143
|
+
const full = join183(dir, entry);
|
|
434937
435144
|
const stat42 = statSync23(full);
|
|
434938
435145
|
if (stat42.isDirectory())
|
|
434939
435146
|
walk2(full);
|
|
@@ -435043,7 +435250,7 @@ async function buildIndex(cwd2, options2 = {}) {
|
|
|
435043
435250
|
embedModel,
|
|
435044
435251
|
chunks
|
|
435045
435252
|
};
|
|
435046
|
-
mkdirSync46(
|
|
435253
|
+
mkdirSync46(join183(knowledgeDir(cwd2), "index"), { recursive: true });
|
|
435047
435254
|
writeFileSync46(indexPath2(cwd2), `${JSON.stringify(index2, null, 2)}
|
|
435048
435255
|
`);
|
|
435049
435256
|
return index2;
|
|
@@ -435092,7 +435299,7 @@ function pruneKnowledge(cwd2, options2) {
|
|
|
435092
435299
|
index2.chunks = index2.chunks.filter((chunk) => keptIds.has(chunk.sourceId));
|
|
435093
435300
|
removedChunks = before - index2.chunks.length;
|
|
435094
435301
|
index2.builtAt = new Date().toISOString();
|
|
435095
|
-
mkdirSync46(
|
|
435302
|
+
mkdirSync46(join183(knowledgeDir(cwd2), "index"), { recursive: true });
|
|
435096
435303
|
writeFileSync46(indexPath2(cwd2), `${JSON.stringify(index2, null, 2)}
|
|
435097
435304
|
`);
|
|
435098
435305
|
}
|
|
@@ -435281,16 +435488,16 @@ var init_knowledge3 = __esm(() => {
|
|
|
435281
435488
|
});
|
|
435282
435489
|
|
|
435283
435490
|
// src/services/agents/crew.ts
|
|
435284
|
-
import { existsSync as existsSync66, mkdirSync as mkdirSync47, readdirSync as
|
|
435285
|
-
import { join as
|
|
435491
|
+
import { existsSync as existsSync66, mkdirSync as mkdirSync47, readdirSync as readdirSync24, readFileSync as readFileSync63, unlinkSync as unlinkSync12, writeFileSync as writeFileSync47 } from "fs";
|
|
435492
|
+
import { join as join184 } from "path";
|
|
435286
435493
|
function crewDir(cwd2) {
|
|
435287
|
-
return
|
|
435494
|
+
return join184(cwd2, ".ur", "crew");
|
|
435288
435495
|
}
|
|
435289
435496
|
function sanitizeCrewName(name) {
|
|
435290
435497
|
return name.trim().replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
435291
435498
|
}
|
|
435292
435499
|
function crewPath(cwd2, name) {
|
|
435293
|
-
return
|
|
435500
|
+
return join184(crewDir(cwd2), `${sanitizeCrewName(name)}.json`);
|
|
435294
435501
|
}
|
|
435295
435502
|
function isCrewSpec(value2) {
|
|
435296
435503
|
return !!value2 && typeof value2 === "object" && Array.isArray(value2.tasks) && typeof value2.goal === "string";
|
|
@@ -435299,7 +435506,7 @@ function listCrews(cwd2) {
|
|
|
435299
435506
|
const dir = crewDir(cwd2);
|
|
435300
435507
|
if (!existsSync66(dir))
|
|
435301
435508
|
return [];
|
|
435302
|
-
return
|
|
435509
|
+
return readdirSync24(dir).filter((file2) => file2.endsWith(".json")).map((file2) => safeParseJSON(readFileSync63(join184(dir, file2), "utf-8"), false)).filter(isCrewSpec);
|
|
435303
435510
|
}
|
|
435304
435511
|
function loadCrew(cwd2, name) {
|
|
435305
435512
|
const path22 = crewPath(cwd2, name);
|
|
@@ -435476,11 +435683,11 @@ function taskToStep(task, lead) {
|
|
|
435476
435683
|
return { id: task.id, name: task.title, agent: lead, prompt: task.prompt };
|
|
435477
435684
|
}
|
|
435478
435685
|
async function ensureWorktree(cwd2, crew, worker) {
|
|
435479
|
-
const path22 =
|
|
435686
|
+
const path22 = join184(crewDir(cwd2), ".worktrees", `${crew}-${worker}`);
|
|
435480
435687
|
const branch = `ur/crew/${crew}/${worker}`;
|
|
435481
435688
|
if (existsSync66(path22))
|
|
435482
435689
|
return path22;
|
|
435483
|
-
mkdirSync47(
|
|
435690
|
+
mkdirSync47(join184(crewDir(cwd2), ".worktrees"), { recursive: true });
|
|
435484
435691
|
const result = await execFileNoThrowWithCwd("git", ["worktree", "add", "-b", branch, path22], { cwd: cwd2, timeout: 60000, preserveOutputOnError: true });
|
|
435485
435692
|
return result.code === 0 ? path22 : null;
|
|
435486
435693
|
}
|
|
@@ -435914,22 +436121,22 @@ var init_crew3 = __esm(() => {
|
|
|
435914
436121
|
});
|
|
435915
436122
|
|
|
435916
436123
|
// src/services/agents/goals.ts
|
|
435917
|
-
import { existsSync as existsSync67, mkdirSync as mkdirSync48, readdirSync as
|
|
435918
|
-
import { join as
|
|
436124
|
+
import { existsSync as existsSync67, mkdirSync as mkdirSync48, readdirSync as readdirSync25, readFileSync as readFileSync64, unlinkSync as unlinkSync13, writeFileSync as writeFileSync48 } from "fs";
|
|
436125
|
+
import { join as join185 } from "path";
|
|
435919
436126
|
function goalsDir(cwd2) {
|
|
435920
|
-
return
|
|
436127
|
+
return join185(cwd2, ".ur", "goals");
|
|
435921
436128
|
}
|
|
435922
436129
|
function sanitizeGoalName(name) {
|
|
435923
436130
|
return name.trim().replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
435924
436131
|
}
|
|
435925
436132
|
function goalPath(cwd2, name) {
|
|
435926
|
-
return
|
|
436133
|
+
return join185(goalsDir(cwd2), `${sanitizeGoalName(name)}.json`);
|
|
435927
436134
|
}
|
|
435928
436135
|
function listGoals(cwd2) {
|
|
435929
436136
|
const dir = goalsDir(cwd2);
|
|
435930
436137
|
if (!existsSync67(dir))
|
|
435931
436138
|
return [];
|
|
435932
|
-
return
|
|
436139
|
+
return readdirSync25(dir).filter((file2) => file2.endsWith(".json")).map((file2) => safeParseJSON(readFileSync64(join185(dir, file2), "utf-8"), false)).filter((spec) => isGoalSpec(spec)).sort((a2, b) => a2.updatedAt < b.updatedAt ? 1 : -1);
|
|
435933
436140
|
}
|
|
435934
436141
|
function isGoalSpec(value2) {
|
|
435935
436142
|
return !!value2 && typeof value2 === "object" && typeof value2.name === "string" && typeof value2.objective === "string";
|
|
@@ -436258,7 +436465,7 @@ var init_verificationProofs = __esm(() => {
|
|
|
436258
436465
|
|
|
436259
436466
|
// src/services/agents/kernel.ts
|
|
436260
436467
|
import { existsSync as existsSync68, readFileSync as readFileSync65 } from "fs";
|
|
436261
|
-
import { join as
|
|
436468
|
+
import { join as join186 } from "path";
|
|
436262
436469
|
function defaultGuard(skipPermissions) {
|
|
436263
436470
|
return {
|
|
436264
436471
|
canUseTool: (_toolName, _input) => ({
|
|
@@ -436276,8 +436483,8 @@ function defaultRouter() {
|
|
|
436276
436483
|
function defaultMemory(cwd2) {
|
|
436277
436484
|
return {
|
|
436278
436485
|
loadMemorySnippet: (scope, agentType) => {
|
|
436279
|
-
const base2 = scope === "project" ?
|
|
436280
|
-
const path22 =
|
|
436486
|
+
const base2 = scope === "project" ? join186(cwd2, ".ur", "memory") : join186(cwd2, ".ur", "memory");
|
|
436487
|
+
const path22 = join186(base2, `${agentType}.md`);
|
|
436281
436488
|
const legacy = existsSync68(path22) ? readFileSync65(path22, "utf-8") : "";
|
|
436282
436489
|
if (scope !== "project")
|
|
436283
436490
|
return legacy || null;
|
|
@@ -436683,23 +436890,23 @@ __export(exports_spec, {
|
|
|
436683
436890
|
import {
|
|
436684
436891
|
existsSync as existsSync69,
|
|
436685
436892
|
mkdirSync as mkdirSync49,
|
|
436686
|
-
readdirSync as
|
|
436893
|
+
readdirSync as readdirSync26,
|
|
436687
436894
|
readFileSync as readFileSync66,
|
|
436688
436895
|
rmSync as rmSync14,
|
|
436689
436896
|
writeFileSync as writeFileSync49
|
|
436690
436897
|
} from "fs";
|
|
436691
|
-
import { join as
|
|
436898
|
+
import { join as join187 } from "path";
|
|
436692
436899
|
function specsDir(cwd2) {
|
|
436693
|
-
return
|
|
436900
|
+
return join187(cwd2, ".ur", "specs");
|
|
436694
436901
|
}
|
|
436695
436902
|
function slugifySpecName(name) {
|
|
436696
436903
|
return name.trim().toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || "spec";
|
|
436697
436904
|
}
|
|
436698
436905
|
function specDir(cwd2, name) {
|
|
436699
|
-
return
|
|
436906
|
+
return join187(specsDir(cwd2), slugifySpecName(name));
|
|
436700
436907
|
}
|
|
436701
436908
|
function metaPath(cwd2, name) {
|
|
436702
|
-
return
|
|
436909
|
+
return join187(specDir(cwd2, name), "spec.json");
|
|
436703
436910
|
}
|
|
436704
436911
|
function phaseFile(phase) {
|
|
436705
436912
|
return `${phase}.md`;
|
|
@@ -436708,7 +436915,7 @@ function listSpecs2(cwd2) {
|
|
|
436708
436915
|
const dir = specsDir(cwd2);
|
|
436709
436916
|
if (!existsSync69(dir))
|
|
436710
436917
|
return [];
|
|
436711
|
-
return
|
|
436918
|
+
return readdirSync26(dir).filter((entry) => existsSync69(join187(dir, entry, "spec.json"))).map((entry) => safeParseJSON(readFileSync66(join187(dir, entry, "spec.json"), "utf-8"), false)).filter((m) => !!m && typeof m === "object" && ("goal" in m));
|
|
436712
436919
|
}
|
|
436713
436920
|
function loadSpec(cwd2, name) {
|
|
436714
436921
|
const path22 = metaPath(cwd2, name);
|
|
@@ -436723,12 +436930,12 @@ function saveMeta(cwd2, meta) {
|
|
|
436723
436930
|
`);
|
|
436724
436931
|
}
|
|
436725
436932
|
function readPhase(cwd2, name, phase) {
|
|
436726
|
-
const path22 =
|
|
436933
|
+
const path22 = join187(specDir(cwd2, name), phaseFile(phase));
|
|
436727
436934
|
return existsSync69(path22) ? readFileSync66(path22, "utf-8") : null;
|
|
436728
436935
|
}
|
|
436729
436936
|
function writePhase(cwd2, name, phase, body) {
|
|
436730
436937
|
mkdirSync49(specDir(cwd2, name), { recursive: true });
|
|
436731
|
-
writeFileSync49(
|
|
436938
|
+
writeFileSync49(join187(specDir(cwd2, name), phaseFile(phase)), body.endsWith(`
|
|
436732
436939
|
`) ? body : `${body}
|
|
436733
436940
|
`);
|
|
436734
436941
|
}
|
|
@@ -436986,12 +437193,12 @@ var init_spec = __esm(() => {
|
|
|
436986
437193
|
|
|
436987
437194
|
// src/services/agents/specVerifier.ts
|
|
436988
437195
|
import { existsSync as existsSync70, mkdirSync as mkdirSync50, readFileSync as readFileSync67, writeFileSync as writeFileSync50 } from "fs";
|
|
436989
|
-
import { join as
|
|
437196
|
+
import { join as join188 } from "path";
|
|
436990
437197
|
function recordPath(cwd2, name) {
|
|
436991
|
-
return
|
|
437198
|
+
return join188(cwd2, ".ur", "specs", name, RECORD_FILE);
|
|
436992
437199
|
}
|
|
436993
437200
|
function reportPath(cwd2, name) {
|
|
436994
|
-
return
|
|
437201
|
+
return join188(cwd2, ".ur", "specs", name, REPORT_FILE);
|
|
436995
437202
|
}
|
|
436996
437203
|
function loadVerificationRecord(cwd2, name) {
|
|
436997
437204
|
const path22 = recordPath(cwd2, name);
|
|
@@ -437011,7 +437218,7 @@ function listVerificationRecords(cwd2, name) {
|
|
|
437011
437218
|
}
|
|
437012
437219
|
function saveVerificationRecord(cwd2, name, record3) {
|
|
437013
437220
|
const path22 = recordPath(cwd2, name);
|
|
437014
|
-
mkdirSync50(
|
|
437221
|
+
mkdirSync50(join188(cwd2, ".ur", "specs", name), { recursive: true });
|
|
437015
437222
|
writeFileSync50(path22, `${JSON.stringify(record3, null, 2)}
|
|
437016
437223
|
`);
|
|
437017
437224
|
}
|
|
@@ -437465,7 +437672,7 @@ var init_spec3 = __esm(() => {
|
|
|
437465
437672
|
|
|
437466
437673
|
// src/services/agents/escalation.ts
|
|
437467
437674
|
import { existsSync as existsSync71, mkdirSync as mkdirSync51, readFileSync as readFileSync68, writeFileSync as writeFileSync51 } from "fs";
|
|
437468
|
-
import { join as
|
|
437675
|
+
import { join as join189 } from "path";
|
|
437469
437676
|
function scoreOracle(model) {
|
|
437470
437677
|
let score = (model.contextLength ?? 0) / 1000;
|
|
437471
437678
|
if (model.likelyCode)
|
|
@@ -437647,7 +437854,7 @@ ${question}`,
|
|
|
437647
437854
|
return { model: tiers.oracle, output: out.output, verdict: out.verdict ?? null };
|
|
437648
437855
|
}
|
|
437649
437856
|
function policyPath(cwd2) {
|
|
437650
|
-
return
|
|
437857
|
+
return join189(cwd2, ".ur", "escalation.json");
|
|
437651
437858
|
}
|
|
437652
437859
|
function loadPolicy(cwd2) {
|
|
437653
437860
|
const path22 = policyPath(cwd2);
|
|
@@ -437657,7 +437864,7 @@ function loadPolicy(cwd2) {
|
|
|
437657
437864
|
return parsed && typeof parsed === "object" ? parsed : {};
|
|
437658
437865
|
}
|
|
437659
437866
|
function savePolicy(cwd2, policy) {
|
|
437660
|
-
mkdirSync51(
|
|
437867
|
+
mkdirSync51(join189(cwd2, ".ur"), { recursive: true });
|
|
437661
437868
|
writeFileSync51(policyPath(cwd2), `${JSON.stringify(policy, null, 2)}
|
|
437662
437869
|
`);
|
|
437663
437870
|
}
|
|
@@ -437838,12 +438045,12 @@ import {
|
|
|
437838
438045
|
lstatSync as lstatSync15,
|
|
437839
438046
|
renameSync as renameSync13
|
|
437840
438047
|
} from "fs";
|
|
437841
|
-
import { join as
|
|
438048
|
+
import { join as join190 } from "path";
|
|
437842
438049
|
function learningDir2(cwd2) {
|
|
437843
|
-
return
|
|
438050
|
+
return join190(cwd2, ".ur", "learning");
|
|
437844
438051
|
}
|
|
437845
438052
|
function storePath(cwd2) {
|
|
437846
|
-
return
|
|
438053
|
+
return join190(learningDir2(cwd2), "playbooks.json");
|
|
437847
438054
|
}
|
|
437848
438055
|
function digest3(value2) {
|
|
437849
438056
|
return `sha256:${createHash41("sha256").update(JSON.stringify(value2)).digest("hex")}`;
|
|
@@ -437887,10 +438094,10 @@ function getLearnedPlaybook(cwd2, idOrName) {
|
|
|
437887
438094
|
return item ? structuredClone(item) : null;
|
|
437888
438095
|
}
|
|
437889
438096
|
function planTask(cwd2, runId) {
|
|
437890
|
-
const path22 =
|
|
438097
|
+
const path22 = join190(cwd2, ".ur", "runs", runId, "plan.json");
|
|
437891
438098
|
if (!existsSync72(path22))
|
|
437892
438099
|
return runId;
|
|
437893
|
-
const raw = readPrivateText(
|
|
438100
|
+
const raw = readPrivateText(join190(cwd2, ".ur", "runs", runId), path22, 1024 * 1024);
|
|
437894
438101
|
if (!raw)
|
|
437895
438102
|
return runId;
|
|
437896
438103
|
const parsed = safeParseJSON(raw, false);
|
|
@@ -438199,8 +438406,8 @@ function disableLearnedPlaybook(cwd2, id, options2 = {}) {
|
|
|
438199
438406
|
if (!stat42.isFile() || stat42.isSymbolicLink() || !workflow2 || JSON.stringify(workflow2) !== JSON.stringify(candidate.workflow)) {
|
|
438200
438407
|
throw new Error("Learned workflow changed after promotion; refusing to move it");
|
|
438201
438408
|
}
|
|
438202
|
-
const archiveDir =
|
|
438203
|
-
const archivePath =
|
|
438409
|
+
const archiveDir = join190(learningDir2(cwd2), "disabled");
|
|
438410
|
+
const archivePath = join190(archiveDir, `${candidate.id}-${digest3(candidate.workflow).slice(7, 23)}.yaml.disabled`);
|
|
438204
438411
|
if (existsSync72(archivePath)) {
|
|
438205
438412
|
throw new Error("Disabled workflow archive already exists");
|
|
438206
438413
|
}
|
|
@@ -438614,7 +438821,7 @@ var init_guardrails3 = __esm(() => {
|
|
|
438614
438821
|
|
|
438615
438822
|
// src/services/agents/execTarget.ts
|
|
438616
438823
|
import { existsSync as existsSync74, mkdirSync as mkdirSync52, readFileSync as readFileSync70, writeFileSync as writeFileSync52 } from "fs";
|
|
438617
|
-
import { join as
|
|
438824
|
+
import { join as join191 } from "path";
|
|
438618
438825
|
function isContainerized(config3) {
|
|
438619
438826
|
return config3.kind !== "local";
|
|
438620
438827
|
}
|
|
@@ -438638,10 +438845,10 @@ function wrapCommand(config3, command5, cwd2) {
|
|
|
438638
438845
|
return { file: "docker", args: buildDockerArgs(config3, command5, cwd2) };
|
|
438639
438846
|
}
|
|
438640
438847
|
function configPath(cwd2) {
|
|
438641
|
-
return
|
|
438848
|
+
return join191(cwd2, ".ur", "devcontainer.json");
|
|
438642
438849
|
}
|
|
438643
438850
|
function readDevcontainerImage(cwd2) {
|
|
438644
|
-
const path22 =
|
|
438851
|
+
const path22 = join191(cwd2, ".devcontainer", "devcontainer.json");
|
|
438645
438852
|
if (!existsSync74(path22))
|
|
438646
438853
|
return;
|
|
438647
438854
|
const parsed = safeParseJSON(readFileSync70(path22, "utf-8"), false);
|
|
@@ -438681,7 +438888,7 @@ function defaultExecTargetConfig(image = "node:22-bookworm") {
|
|
|
438681
438888
|
}
|
|
438682
438889
|
function scaffoldExecTarget(cwd2, options2 = {}) {
|
|
438683
438890
|
const path22 = configPath(cwd2);
|
|
438684
|
-
mkdirSync52(
|
|
438891
|
+
mkdirSync52(join191(cwd2, ".ur"), { recursive: true });
|
|
438685
438892
|
if (existsSync74(path22) && options2.force !== true)
|
|
438686
438893
|
return { path: path22, created: false };
|
|
438687
438894
|
writeFileSync52(path22, `${JSON.stringify(defaultExecTargetConfig(options2.image), null, 2)}
|
|
@@ -439111,7 +439318,7 @@ var init_desktopQaSchema = __esm(() => {
|
|
|
439111
439318
|
|
|
439112
439319
|
// src/services/qa/electronDesktopQaDriver.ts
|
|
439113
439320
|
import { mkdirSync as mkdirSync53 } from "fs";
|
|
439114
|
-
import { isAbsolute as isAbsolute40, join as
|
|
439321
|
+
import { isAbsolute as isAbsolute40, join as join192, resolve as resolve60 } from "path";
|
|
439115
439322
|
function buildDesktopQaEnvironment(source = process.env, explicit = {}) {
|
|
439116
439323
|
const safe = {};
|
|
439117
439324
|
for (const [name, value2] of Object.entries(source)) {
|
|
@@ -439267,7 +439474,7 @@ var init_electronDesktopQaDriver = __esm(() => {
|
|
|
439267
439474
|
if (privacyError)
|
|
439268
439475
|
throw new Error(privacyError);
|
|
439269
439476
|
const { _electron } = await import("playwright-core");
|
|
439270
|
-
const videoDir =
|
|
439477
|
+
const videoDir = join192(options2.runDir, "video");
|
|
439271
439478
|
mkdirSync53(options2.runDir, { recursive: true, mode: 448 });
|
|
439272
439479
|
if (fixture.recording.video) {
|
|
439273
439480
|
mkdirSync53(videoDir, { recursive: true, mode: 448 });
|
|
@@ -439289,7 +439496,7 @@ var init_electronDesktopQaDriver = __esm(() => {
|
|
|
439289
439496
|
});
|
|
439290
439497
|
page3.setDefaultTimeout(Math.min(fixture.timeoutMs, 120000));
|
|
439291
439498
|
const context6 = page3.context();
|
|
439292
|
-
const tracePath = fixture.recording.trace ?
|
|
439499
|
+
const tracePath = fixture.recording.trace ? join192(options2.runDir, "trace.zip") : null;
|
|
439293
439500
|
if (tracePath) {
|
|
439294
439501
|
await context6.tracing.start({
|
|
439295
439502
|
screenshots: true,
|
|
@@ -439315,7 +439522,7 @@ import {
|
|
|
439315
439522
|
lstatSync as lstatSync16,
|
|
439316
439523
|
readFileSync as readFileSync71,
|
|
439317
439524
|
realpathSync as realpathSync13,
|
|
439318
|
-
readdirSync as
|
|
439525
|
+
readdirSync as readdirSync27,
|
|
439319
439526
|
rmSync as rmSync15,
|
|
439320
439527
|
statSync as statSync24,
|
|
439321
439528
|
unlinkSync as unlinkSync14,
|
|
@@ -439326,7 +439533,7 @@ import {
|
|
|
439326
439533
|
basename as basename47,
|
|
439327
439534
|
extname as extname17,
|
|
439328
439535
|
isAbsolute as isAbsolute41,
|
|
439329
|
-
join as
|
|
439536
|
+
join as join193,
|
|
439330
439537
|
relative as relative43,
|
|
439331
439538
|
resolve as resolve61,
|
|
439332
439539
|
sep as sep40
|
|
@@ -439454,7 +439661,7 @@ async function executeStep(session2, step, options2) {
|
|
|
439454
439661
|
return;
|
|
439455
439662
|
case "screenshot": {
|
|
439456
439663
|
const name = safeEvidenceName(step.name ?? `step-${options2.index + 1}`);
|
|
439457
|
-
const path22 =
|
|
439664
|
+
const path22 = join193(options2.runDir, `${String(options2.index + 1).padStart(3, "0")}-${name}.png`);
|
|
439458
439665
|
await session2.screenshot(path22, {
|
|
439459
439666
|
fullPage: step.fullPage,
|
|
439460
439667
|
timeoutMs: timeout,
|
|
@@ -439469,8 +439676,8 @@ function walkFiles2(root2) {
|
|
|
439469
439676
|
return [];
|
|
439470
439677
|
const files = [];
|
|
439471
439678
|
const visit2 = (directory) => {
|
|
439472
|
-
for (const entry of
|
|
439473
|
-
const path22 =
|
|
439679
|
+
for (const entry of readdirSync27(directory, { withFileTypes: true })) {
|
|
439680
|
+
const path22 = join193(directory, entry.name);
|
|
439474
439681
|
if (entry.isDirectory())
|
|
439475
439682
|
visit2(path22);
|
|
439476
439683
|
else if (entry.isFile() && !entry.isSymbolicLink())
|
|
@@ -439528,11 +439735,11 @@ async function runDesktopQaFixture(cwd2, input, options2 = {}) {
|
|
|
439528
439735
|
}
|
|
439529
439736
|
validateDesktopQaLaunchPolicy(cwd2, fixture, options2.allowOutsideWorkspace ?? false);
|
|
439530
439737
|
const id = safeRunId(options2.runId ?? randomUUID52());
|
|
439531
|
-
const runDir =
|
|
439738
|
+
const runDir = join193(cwd2, ".ur", "desktop-qa", "runs", id);
|
|
439532
439739
|
if (existsSync75(runDir)) {
|
|
439533
439740
|
throw new Error(`Desktop QA run directory already exists: ${runDir}`);
|
|
439534
439741
|
}
|
|
439535
|
-
ensurePrivateDirectory(
|
|
439742
|
+
ensurePrivateDirectory(join193(cwd2, ".ur"), runDir);
|
|
439536
439743
|
try {
|
|
439537
439744
|
const started = Date.now();
|
|
439538
439745
|
const startedAt = new Date(started).toISOString();
|
|
@@ -439576,7 +439783,7 @@ async function runDesktopQaFixture(cwd2, input, options2 = {}) {
|
|
|
439576
439783
|
}
|
|
439577
439784
|
}
|
|
439578
439785
|
if (fixture.recording.screenshots) {
|
|
439579
|
-
await session2.screenshot(
|
|
439786
|
+
await session2.screenshot(join193(runDir, "final.png"), {
|
|
439580
439787
|
fullPage: false,
|
|
439581
439788
|
timeoutMs: remainingTimeout(deadline, 15000),
|
|
439582
439789
|
redactSelectors: fixture.recording.redactSelectors
|
|
@@ -439586,7 +439793,7 @@ async function runDesktopQaFixture(cwd2, input, options2 = {}) {
|
|
|
439586
439793
|
failed = error40;
|
|
439587
439794
|
if (session2 && fixture.recording.screenshotOnFailure) {
|
|
439588
439795
|
try {
|
|
439589
|
-
await session2.screenshot(
|
|
439796
|
+
await session2.screenshot(join193(runDir, "failure.png"), {
|
|
439590
439797
|
fullPage: false,
|
|
439591
439798
|
timeoutMs: Math.max(1, Math.min(1e4, deadline - Date.now())),
|
|
439592
439799
|
redactSelectors: fixture.recording.redactSelectors
|
|
@@ -439640,7 +439847,7 @@ async function runDesktopQaFixture(cwd2, input, options2 = {}) {
|
|
|
439640
439847
|
warnings,
|
|
439641
439848
|
...failed ? { error: errorText2(failed, redact2) } : {}
|
|
439642
439849
|
};
|
|
439643
|
-
const reportPath2 =
|
|
439850
|
+
const reportPath2 = join193(runDir, "report.json");
|
|
439644
439851
|
writeFileSync53(reportPath2, `${JSON.stringify(report, null, 2)}
|
|
439645
439852
|
`, {
|
|
439646
439853
|
mode: 384
|
|
@@ -439690,13 +439897,13 @@ import {
|
|
|
439690
439897
|
lstatSync as lstatSync17,
|
|
439691
439898
|
mkdirSync as mkdirSync54,
|
|
439692
439899
|
realpathSync as realpathSync14,
|
|
439693
|
-
readdirSync as
|
|
439900
|
+
readdirSync as readdirSync28,
|
|
439694
439901
|
writeFileSync as writeFileSync54
|
|
439695
439902
|
} from "fs";
|
|
439696
439903
|
import {
|
|
439697
|
-
dirname as
|
|
439904
|
+
dirname as dirname73,
|
|
439698
439905
|
isAbsolute as isAbsolute42,
|
|
439699
|
-
join as
|
|
439906
|
+
join as join194,
|
|
439700
439907
|
relative as relative44,
|
|
439701
439908
|
resolve as resolve62,
|
|
439702
439909
|
sep as sep41
|
|
@@ -439739,7 +439946,7 @@ function existingAncestor(path22) {
|
|
|
439739
439946
|
for (;; ) {
|
|
439740
439947
|
if (existsSync76(current))
|
|
439741
439948
|
return realpathSync14(current);
|
|
439742
|
-
const parent2 =
|
|
439949
|
+
const parent2 = dirname73(current);
|
|
439743
439950
|
if (parent2 === current)
|
|
439744
439951
|
return current;
|
|
439745
439952
|
current = parent2;
|
|
@@ -439749,7 +439956,7 @@ function initTargetAllowed(cwd2, path22, allowExternal) {
|
|
|
439749
439956
|
if (allowExternal)
|
|
439750
439957
|
return true;
|
|
439751
439958
|
const workspace = realpathSync14(cwd2);
|
|
439752
|
-
return pathIsWithin4(workspace, resolve62(path22)) && pathIsWithin4(workspace, existingAncestor(
|
|
439959
|
+
return pathIsWithin4(workspace, resolve62(path22)) && pathIsWithin4(workspace, existingAncestor(dirname73(path22)));
|
|
439753
439960
|
}
|
|
439754
439961
|
async function runDesktopQaCommand(args, cwd2, dependencies = {}) {
|
|
439755
439962
|
const runFixture = dependencies.runFixture ?? runDesktopQaFixture;
|
|
@@ -439839,7 +440046,7 @@ async function runDesktopQaCommand(args, cwd2, dependencies = {}) {
|
|
|
439839
440046
|
value: `Fixture already exists: ${path22} (use --force to replace it).`
|
|
439840
440047
|
};
|
|
439841
440048
|
}
|
|
439842
|
-
mkdirSync54(
|
|
440049
|
+
mkdirSync54(dirname73(path22), { recursive: true, mode: 448 });
|
|
439843
440050
|
writeFileSync54(path22, `${JSON.stringify(EXAMPLE_FIXTURE, null, 2)}
|
|
439844
440051
|
`, {
|
|
439845
440052
|
mode: 384
|
|
@@ -439847,10 +440054,10 @@ async function runDesktopQaCommand(args, cwd2, dependencies = {}) {
|
|
|
439847
440054
|
return { type: "text", value: `Created desktop QA fixture: ${path22}` };
|
|
439848
440055
|
}
|
|
439849
440056
|
if (action3 === "list" || action3 === "ls") {
|
|
439850
|
-
const directory =
|
|
439851
|
-
const fixtures2 = existsSync76(directory) ?
|
|
440057
|
+
const directory = join194(cwd2, ".ur", "desktop-qa", "fixtures");
|
|
440058
|
+
const fixtures2 = existsSync76(directory) ? readdirSync28(directory).filter((name) => name.endsWith(".json")).sort().map((name) => {
|
|
439852
440059
|
try {
|
|
439853
|
-
const fixture = loadFixture(
|
|
440060
|
+
const fixture = loadFixture(join194(directory, name));
|
|
439854
440061
|
return {
|
|
439855
440062
|
file: name,
|
|
439856
440063
|
valid: true,
|
|
@@ -440641,9 +440848,9 @@ import {
|
|
|
440641
440848
|
readFileSync as readFileSync73,
|
|
440642
440849
|
writeFileSync as writeFileSync55
|
|
440643
440850
|
} from "fs";
|
|
440644
|
-
import { dirname as
|
|
440851
|
+
import { dirname as dirname74, join as join195, relative as relative45 } from "path";
|
|
440645
440852
|
function defaultTraceDir(cwd2) {
|
|
440646
|
-
return
|
|
440853
|
+
return join195(cwd2, ".ur", "test-first", "traces");
|
|
440647
440854
|
}
|
|
440648
440855
|
function slug4(value2) {
|
|
440649
440856
|
return value2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 72) || "command";
|
|
@@ -440651,7 +440858,7 @@ function slug4(value2) {
|
|
|
440651
440858
|
function writeFailureTrace(cwd2, traceDir, run3, result, now8) {
|
|
440652
440859
|
mkdirSync55(traceDir, { recursive: true });
|
|
440653
440860
|
const stamp = now8.toISOString().replace(/[:.]/g, "-");
|
|
440654
|
-
const file2 =
|
|
440861
|
+
const file2 = join195(traceDir, `${stamp}-attempt-${run3.attempt}-${run3.phase}-${slug4(run3.command)}.log`);
|
|
440655
440862
|
const body = [
|
|
440656
440863
|
"# UR test-first failure trace",
|
|
440657
440864
|
"",
|
|
@@ -440693,8 +440900,8 @@ function mergeStringArray(existing2, additions) {
|
|
|
440693
440900
|
return [...out];
|
|
440694
440901
|
}
|
|
440695
440902
|
function installTestFirstGates(cwd2, stack = detectTestFirstStack(cwd2)) {
|
|
440696
|
-
const path22 =
|
|
440697
|
-
mkdirSync55(
|
|
440903
|
+
const path22 = join195(cwd2, ".ur", "verify.json");
|
|
440904
|
+
mkdirSync55(dirname74(path22), { recursive: true });
|
|
440698
440905
|
const commands = stack.commands.map((command5) => command5.command);
|
|
440699
440906
|
const existing2 = readExistingVerifyConfig(path22);
|
|
440700
440907
|
const next = {
|
|
@@ -441890,7 +442097,7 @@ __export(exports_sdk, {
|
|
|
441890
442097
|
call: () => call97
|
|
441891
442098
|
});
|
|
441892
442099
|
import { existsSync as existsSync79, mkdirSync as mkdirSync56, writeFileSync as writeFileSync56 } from "fs";
|
|
441893
|
-
import { join as
|
|
442100
|
+
import { join as join196 } from "path";
|
|
441894
442101
|
function infoText() {
|
|
441895
442102
|
return [
|
|
441896
442103
|
"UR SDK \u2014 drive UR programmatically (headless).",
|
|
@@ -441970,7 +442177,7 @@ A2A server: \`ur a2a serve\`.
|
|
|
441970
442177
|
const force = tokens.includes("--force");
|
|
441971
442178
|
const action3 = tokens.find((token) => !token.startsWith("--")) ?? "info";
|
|
441972
442179
|
if (action3 === "init") {
|
|
441973
|
-
const root2 =
|
|
442180
|
+
const root2 = join196(getCwd(), ".ur", "sdk");
|
|
441974
442181
|
mkdirSync56(root2, { recursive: true });
|
|
441975
442182
|
const files = [
|
|
441976
442183
|
["example.ts", TS_EXAMPLE],
|
|
@@ -441980,7 +442187,7 @@ A2A server: \`ur a2a serve\`.
|
|
|
441980
442187
|
const created = [];
|
|
441981
442188
|
const skipped = [];
|
|
441982
442189
|
for (const [name, content] of files) {
|
|
441983
|
-
const path22 =
|
|
442190
|
+
const path22 = join196(root2, name);
|
|
441984
442191
|
if (!force && existsSync79(path22)) {
|
|
441985
442192
|
skipped.push(name);
|
|
441986
442193
|
continue;
|
|
@@ -442323,12 +442530,12 @@ import {
|
|
|
442323
442530
|
existsSync as existsSync80,
|
|
442324
442531
|
mkdirSync as mkdirSync57,
|
|
442325
442532
|
readFileSync as readFileSync75,
|
|
442326
|
-
readdirSync as
|
|
442533
|
+
readdirSync as readdirSync29,
|
|
442327
442534
|
rmSync as rmSync16,
|
|
442328
442535
|
writeFileSync as writeFileSync57
|
|
442329
442536
|
} from "fs";
|
|
442330
442537
|
import { randomUUID as randomUUID53 } from "crypto";
|
|
442331
|
-
import { join as
|
|
442538
|
+
import { join as join197 } from "path";
|
|
442332
442539
|
function evaluateEvalGate(report, thresholds, baseline) {
|
|
442333
442540
|
const checks4 = [];
|
|
442334
442541
|
const minimum = (name, actual, expected) => {
|
|
@@ -442798,7 +443005,7 @@ async function runSuiteReliability(suite, runner2, options3) {
|
|
|
442798
443005
|
};
|
|
442799
443006
|
}
|
|
442800
443007
|
function metricsFile() {
|
|
442801
|
-
return
|
|
443008
|
+
return join197(process.env.UR_EVAL_METRICS_DIR ?? process.cwd(), `.ur-eval-metrics-${process.pid}.json`);
|
|
442802
443009
|
}
|
|
442803
443010
|
function readChildMetricsFile(path22) {
|
|
442804
443011
|
if (!existsSync80(path22))
|
|
@@ -442931,9 +443138,9 @@ async function createEvalWorktree(cwd2, caseId) {
|
|
|
442931
443138
|
throw new Error("isolated eval cases require a git repository with a valid HEAD");
|
|
442932
443139
|
}
|
|
442933
443140
|
const safeId2 = caseId.replace(/[^a-z0-9_-]/gi, "-").slice(0, 40);
|
|
442934
|
-
const root2 =
|
|
442935
|
-
const path22 =
|
|
442936
|
-
ensurePrivateDirectory(
|
|
443141
|
+
const root2 = join197(cwd2, ".ur", "evals", ".worktrees");
|
|
443142
|
+
const path22 = join197(root2, `${safeId2}-${randomUUID53().slice(0, 8)}`);
|
|
443143
|
+
ensurePrivateDirectory(join197(cwd2, ".ur"), root2);
|
|
442937
443144
|
const created = await execFileNoThrowWithCwd("git", [
|
|
442938
443145
|
...SAFE_EVAL_GIT_ARGS,
|
|
442939
443146
|
"worktree",
|
|
@@ -443195,10 +443402,10 @@ function loadAllReports(cwd2) {
|
|
|
443195
443402
|
if (!existsSync80(dir))
|
|
443196
443403
|
return [];
|
|
443197
443404
|
const reports = [];
|
|
443198
|
-
for (const file2 of
|
|
443405
|
+
for (const file2 of readdirSync29(dir)) {
|
|
443199
443406
|
if (!file2.endsWith(".json") || file2.startsWith("reliability-"))
|
|
443200
443407
|
continue;
|
|
443201
|
-
const parsed = safeParseJSON(readFileSync75(
|
|
443408
|
+
const parsed = safeParseJSON(readFileSync75(join197(dir, file2), "utf-8"), false);
|
|
443202
443409
|
if (parsed && typeof parsed === "object")
|
|
443203
443410
|
reports.push(parsed);
|
|
443204
443411
|
}
|
|
@@ -443209,10 +443416,10 @@ function loadAllReliability(cwd2) {
|
|
|
443209
443416
|
if (!existsSync80(dir))
|
|
443210
443417
|
return [];
|
|
443211
443418
|
const reports = [];
|
|
443212
|
-
for (const file2 of
|
|
443419
|
+
for (const file2 of readdirSync29(dir)) {
|
|
443213
443420
|
if (!file2.startsWith("reliability-") || !file2.endsWith(".json"))
|
|
443214
443421
|
continue;
|
|
443215
|
-
const parsed = safeParseJSON(readFileSync75(
|
|
443422
|
+
const parsed = safeParseJSON(readFileSync75(join197(dir, file2), "utf-8"), false);
|
|
443216
443423
|
if (parsed && typeof parsed === "object")
|
|
443217
443424
|
reports.push(parsed);
|
|
443218
443425
|
}
|
|
@@ -443220,7 +443427,7 @@ function loadAllReliability(cwd2) {
|
|
|
443220
443427
|
}
|
|
443221
443428
|
function saveReliabilityReport(cwd2, report) {
|
|
443222
443429
|
mkdirSync57(resultsDir(cwd2), { recursive: true });
|
|
443223
|
-
const path22 =
|
|
443430
|
+
const path22 = join197(resultsDir(cwd2), `reliability-${suiteSlug(report.name)}.json`);
|
|
443224
443431
|
writeFileSync57(path22, `${JSON.stringify(report, null, 2)}
|
|
443225
443432
|
`);
|
|
443226
443433
|
return path22;
|
|
@@ -443228,7 +443435,7 @@ function saveReliabilityReport(cwd2, report) {
|
|
|
443228
443435
|
function writeDashboard(cwd2) {
|
|
443229
443436
|
const html3 = buildDashboardHtml(loadAllReports(cwd2), loadAllReliability(cwd2));
|
|
443230
443437
|
mkdirSync57(evalsDir(cwd2), { recursive: true });
|
|
443231
|
-
const path22 =
|
|
443438
|
+
const path22 = join197(evalsDir(cwd2), "dashboard.html");
|
|
443232
443439
|
writeFileSync57(path22, html3);
|
|
443233
443440
|
return path22;
|
|
443234
443441
|
}
|
|
@@ -443239,7 +443446,7 @@ function buildLeaderboard(cwd2, reports, options3 = {}) {
|
|
|
443239
443446
|
if (format6 === "json") {
|
|
443240
443447
|
const dir2 = resultsDir(cwd2);
|
|
443241
443448
|
mkdirSync57(dir2, { recursive: true });
|
|
443242
|
-
const path23 =
|
|
443449
|
+
const path23 = join197(dir2, "leaderboard.json");
|
|
443243
443450
|
writeFileSync57(path23, JSON.stringify({ title, generatedAt: new Date().toISOString(), reports }, null, 2) + `
|
|
443244
443451
|
`);
|
|
443245
443452
|
if (runId) {
|
|
@@ -443250,7 +443457,7 @@ function buildLeaderboard(cwd2, reports, options3 = {}) {
|
|
|
443250
443457
|
if (format6 === "md") {
|
|
443251
443458
|
const dir2 = resultsDir(cwd2);
|
|
443252
443459
|
mkdirSync57(dir2, { recursive: true });
|
|
443253
|
-
const path23 =
|
|
443460
|
+
const path23 = join197(dir2, "leaderboard.md");
|
|
443254
443461
|
writeFileSync57(path23, formatLeaderboardMarkdown(title, reports));
|
|
443255
443462
|
if (runId) {
|
|
443256
443463
|
addRunArtifact(cwd2, runId, { kind: "leaderboard", path: path23, title });
|
|
@@ -443259,7 +443466,7 @@ function buildLeaderboard(cwd2, reports, options3 = {}) {
|
|
|
443259
443466
|
}
|
|
443260
443467
|
const dir = evalsDir(cwd2);
|
|
443261
443468
|
mkdirSync57(dir, { recursive: true });
|
|
443262
|
-
const path22 =
|
|
443469
|
+
const path22 = join197(dir, "leaderboard.html");
|
|
443263
443470
|
const html3 = buildDashboardHtml(reports, []);
|
|
443264
443471
|
writeFileSync57(path22, html3.replace("<title>UR Eval Dashboard</title>", `<title>${escapeHtml(title)}</title>`).replace("<h1>UR Eval Dashboard</h1>", `<h1>${escapeHtml(title)}</h1>`));
|
|
443265
443472
|
if (runId) {
|
|
@@ -443283,18 +443490,18 @@ function formatLeaderboardMarkdown(title, reports) {
|
|
|
443283
443490
|
`;
|
|
443284
443491
|
}
|
|
443285
443492
|
function runsDir(cwd2, suiteName) {
|
|
443286
|
-
return
|
|
443493
|
+
return join197(evalsDir(cwd2), ".runs", suiteSlug(suiteName));
|
|
443287
443494
|
}
|
|
443288
443495
|
function writeRunMetrics(cwd2, suiteName, caseId, metrics3) {
|
|
443289
443496
|
const dir = runsDir(cwd2, suiteName);
|
|
443290
443497
|
mkdirSync57(dir, { recursive: true });
|
|
443291
|
-
const path22 =
|
|
443498
|
+
const path22 = join197(dir, `${caseId}.json`);
|
|
443292
443499
|
writeFileSync57(path22, `${JSON.stringify(metrics3, null, 2)}
|
|
443293
443500
|
`);
|
|
443294
443501
|
return path22;
|
|
443295
443502
|
}
|
|
443296
443503
|
function loadRunMetrics(cwd2, suiteName, caseId) {
|
|
443297
|
-
const path22 =
|
|
443504
|
+
const path22 = join197(runsDir(cwd2, suiteName), `${caseId}.json`);
|
|
443298
443505
|
if (!existsSync80(path22))
|
|
443299
443506
|
return null;
|
|
443300
443507
|
const parsed = safeParseJSON(readFileSync75(path22, "utf-8"), false);
|
|
@@ -443319,10 +443526,10 @@ function formatReliabilityReport(report, json2) {
|
|
|
443319
443526
|
`);
|
|
443320
443527
|
}
|
|
443321
443528
|
function evalsDir(cwd2) {
|
|
443322
|
-
return
|
|
443529
|
+
return join197(cwd2, ".ur", "evals");
|
|
443323
443530
|
}
|
|
443324
443531
|
function resultsDir(cwd2) {
|
|
443325
|
-
return
|
|
443532
|
+
return join197(evalsDir(cwd2), ".results");
|
|
443326
443533
|
}
|
|
443327
443534
|
function suiteSlug(name) {
|
|
443328
443535
|
return name.trim().toLowerCase().replace(/[^a-z0-9-_]+/g, "-").slice(0, 64);
|
|
@@ -443355,10 +443562,10 @@ function listSuites(cwd2) {
|
|
|
443355
443562
|
const dir = evalsDir(cwd2);
|
|
443356
443563
|
if (!existsSync80(dir))
|
|
443357
443564
|
return [];
|
|
443358
|
-
return
|
|
443565
|
+
return readdirSync29(dir).filter((file2) => file2.endsWith(".json")).map((file2) => file2.replace(/\.json$/, "")).sort();
|
|
443359
443566
|
}
|
|
443360
443567
|
function loadSuite(cwd2, name) {
|
|
443361
|
-
const path22 =
|
|
443568
|
+
const path22 = join197(evalsDir(cwd2), `${suiteSlug(name)}.json`);
|
|
443362
443569
|
if (!existsSync80(path22))
|
|
443363
443570
|
return null;
|
|
443364
443571
|
try {
|
|
@@ -443368,7 +443575,7 @@ function loadSuite(cwd2, name) {
|
|
|
443368
443575
|
}
|
|
443369
443576
|
}
|
|
443370
443577
|
function saveSuite(cwd2, suite, options3 = {}) {
|
|
443371
|
-
const path22 =
|
|
443578
|
+
const path22 = join197(evalsDir(cwd2), `${suiteSlug(suite.name)}.json`);
|
|
443372
443579
|
mkdirSync57(evalsDir(cwd2), { recursive: true });
|
|
443373
443580
|
if (existsSync80(path22) && options3.force !== true) {
|
|
443374
443581
|
return { path: path22, created: false };
|
|
@@ -443530,7 +443737,7 @@ function importBenchmarkSuite(cwd2, adapter2, file2, options3 = {}) {
|
|
|
443530
443737
|
}
|
|
443531
443738
|
function saveReport(cwd2, report, options3 = {}) {
|
|
443532
443739
|
mkdirSync57(resultsDir(cwd2), { recursive: true });
|
|
443533
|
-
const path22 =
|
|
443740
|
+
const path22 = join197(resultsDir(cwd2), `${suiteSlug(report.name)}.json`);
|
|
443534
443741
|
writeFileSync57(path22, `${JSON.stringify(report, null, 2)}
|
|
443535
443742
|
`);
|
|
443536
443743
|
if (options3.runId) {
|
|
@@ -443543,7 +443750,7 @@ function saveReport(cwd2, report, options3 = {}) {
|
|
|
443543
443750
|
return path22;
|
|
443544
443751
|
}
|
|
443545
443752
|
function loadReport(cwd2, name) {
|
|
443546
|
-
const path22 =
|
|
443753
|
+
const path22 = join197(resultsDir(cwd2), `${suiteSlug(name)}.json`);
|
|
443547
443754
|
if (!existsSync80(path22))
|
|
443548
443755
|
return null;
|
|
443549
443756
|
const parsed = safeParseJSON(readFileSync75(path22, "utf-8"), false);
|
|
@@ -443598,7 +443805,7 @@ function scaffoldEvals(cwd2, options3 = {}) {
|
|
|
443598
443805
|
const root2 = evalsDir(cwd2);
|
|
443599
443806
|
const result = { root: root2, created: [], skipped: [] };
|
|
443600
443807
|
mkdirSync57(root2, { recursive: true });
|
|
443601
|
-
const readmePath =
|
|
443808
|
+
const readmePath = join197(root2, "README.md");
|
|
443602
443809
|
if (existsSync80(readmePath) && options3.force !== true) {
|
|
443603
443810
|
result.skipped.push("evals/README.md");
|
|
443604
443811
|
} else {
|
|
@@ -443746,7 +443953,7 @@ var init_evals = __esm(() => {
|
|
|
443746
443953
|
});
|
|
443747
443954
|
|
|
443748
443955
|
// src/services/agents/benchmarkSuites.ts
|
|
443749
|
-
import { join as
|
|
443956
|
+
import { join as join198 } from "path";
|
|
443750
443957
|
function listBuiltinSuiteIds() {
|
|
443751
443958
|
return [...BUILTIN_SUITE_IDS];
|
|
443752
443959
|
}
|
|
@@ -443756,7 +443963,7 @@ function getBuiltinSuite(id) {
|
|
|
443756
443963
|
function installBuiltinSuite(cwd2, id, options3 = {}) {
|
|
443757
443964
|
const suite = getBuiltinSuite(id);
|
|
443758
443965
|
if (!suite) {
|
|
443759
|
-
return { path:
|
|
443966
|
+
return { path: join198(evalsDir(cwd2), `${id}.json`), created: false };
|
|
443760
443967
|
}
|
|
443761
443968
|
const saved = saveSuite(cwd2, suite, { force: options3.force });
|
|
443762
443969
|
return { path: saved.path, created: saved.created, suite };
|
|
@@ -443986,7 +444193,7 @@ __export(exports_eval, {
|
|
|
443986
444193
|
call: () => call98
|
|
443987
444194
|
});
|
|
443988
444195
|
import { mkdirSync as mkdirSync58, writeFileSync as writeFileSync58 } from "fs";
|
|
443989
|
-
import { join as
|
|
444196
|
+
import { join as join199 } from "path";
|
|
443990
444197
|
function optionValue7(tokens, flag) {
|
|
443991
444198
|
const index2 = tokens.indexOf(flag);
|
|
443992
444199
|
return index2 >= 0 ? tokens[index2 + 1] : undefined;
|
|
@@ -444198,9 +444405,9 @@ Run: ur eval run ${suite2.name}`
|
|
|
444198
444405
|
if (tokens.includes("--dashboard")) {
|
|
444199
444406
|
const { buildDashboardHtml: buildDashboardHtml2 } = await Promise.resolve().then(() => (init_evals(), exports_evals));
|
|
444200
444407
|
const html3 = buildDashboardHtml2([report], []);
|
|
444201
|
-
const dir =
|
|
444408
|
+
const dir = join199(evalsDir(cwd2), ".dashboards");
|
|
444202
444409
|
mkdirSync58(dir, { recursive: true });
|
|
444203
|
-
const path22 =
|
|
444410
|
+
const path22 = join199(dir, `${suiteSlug(report.name)}.html`);
|
|
444204
444411
|
writeFileSync58(path22, html3);
|
|
444205
444412
|
return { type: "text", value: `Wrote single-suite dashboard to ${path22}` };
|
|
444206
444413
|
}
|
|
@@ -444975,17 +445182,17 @@ var init_os2 = __esm(() => {
|
|
|
444975
445182
|
import { createHash as createHash43, randomUUID as randomUUID54 } from "crypto";
|
|
444976
445183
|
import { existsSync as existsSync82, lstatSync as lstatSync18, realpathSync as realpathSync15, rmSync as rmSync17 } from "fs";
|
|
444977
445184
|
import { tmpdir as tmpdir15 } from "os";
|
|
444978
|
-
import { dirname as
|
|
445185
|
+
import { dirname as dirname75, isAbsolute as isAbsolute43, join as join200, relative as relative46, resolve as resolve64 } from "path";
|
|
444979
445186
|
function workspaceDir(cwd2) {
|
|
444980
|
-
return
|
|
445187
|
+
return join200(cwd2, ".ur", "workspaces");
|
|
444981
445188
|
}
|
|
444982
445189
|
function workspaceSpecPath(cwd2, name) {
|
|
444983
445190
|
assertId(name, "workspace name");
|
|
444984
|
-
return
|
|
445191
|
+
return join200(workspaceDir(cwd2), `${name}.json`);
|
|
444985
445192
|
}
|
|
444986
445193
|
function workspaceStatePath(cwd2, name) {
|
|
444987
445194
|
assertId(name, "workspace name");
|
|
444988
|
-
return
|
|
445195
|
+
return join200(workspaceDir(cwd2), ".state", `${name}.json`);
|
|
444989
445196
|
}
|
|
444990
445197
|
function assertId(value2, label) {
|
|
444991
445198
|
if (!ID_RE5.test(value2))
|
|
@@ -445374,7 +445581,7 @@ async function prepareRepositoryState(cwd2, spec2, validation, runId, options3)
|
|
|
445374
445581
|
throw new Error(`Cannot resolve ${repo.id} base ref ${repo.baseRef}`);
|
|
445375
445582
|
}
|
|
445376
445583
|
const branch = branchName(spec2.name, runId, repo.id);
|
|
445377
|
-
const worktree2 =
|
|
445584
|
+
const worktree2 = join200(workspaceDir(cwd2), ".worktrees", spec2.name, runId, repo.id);
|
|
445378
445585
|
const shouldPrepare = !options3.dryRun && options3.prepareWorktrees !== false;
|
|
445379
445586
|
if (shouldPrepare) {
|
|
445380
445587
|
const filters = await git7(details.root, ["config", "--get-regexp", "^filter\\..*\\.(clean|process)$"], options3.commandRunner);
|
|
@@ -445384,7 +445591,7 @@ async function prepareRepositoryState(cwd2, spec2, validation, runId, options3)
|
|
|
445384
445591
|
if (filters.code !== 0 && filters.code !== 1) {
|
|
445385
445592
|
throw new Error(`Could not inspect ${repo.id} Git filters`);
|
|
445386
445593
|
}
|
|
445387
|
-
ensurePrivateDirectory(workspaceDir(cwd2),
|
|
445594
|
+
ensurePrivateDirectory(workspaceDir(cwd2), dirname75(worktree2));
|
|
445388
445595
|
const created = await git7(details.root, ["worktree", "add", "-b", branch, worktree2, repo.baseRef], options3.commandRunner);
|
|
445389
445596
|
if (created.code !== 0) {
|
|
445390
445597
|
throw new Error(`Could not create ${repo.id} worktree: ${created.stderr || created.error || created.stdout}`);
|
|
@@ -445481,7 +445688,7 @@ async function runWorkspace(cwd2, name, options3 = {}) {
|
|
|
445481
445688
|
const persist = () => {
|
|
445482
445689
|
state.updatedAt = new Date().toISOString();
|
|
445483
445690
|
if (!options3.dryRun) {
|
|
445484
|
-
ensurePrivateDirectory(workspaceDir(cwd2),
|
|
445691
|
+
ensurePrivateDirectory(workspaceDir(cwd2), dirname75(workspaceStatePath(cwd2, name)));
|
|
445485
445692
|
withPrivateStateLock(workspaceDir(cwd2), `state-${name}`, () => saveState(cwd2, state));
|
|
445486
445693
|
}
|
|
445487
445694
|
};
|
|
@@ -445580,7 +445787,7 @@ async function runVerificationCommand(command5, cwd2, runner2 = defaultCommandRu
|
|
|
445580
445787
|
return process.platform === "win32" ? runner2("cmd.exe", ["/d", "/s", "/c", command5], cwd2) : runner2("/bin/sh", ["-lc", command5], cwd2);
|
|
445581
445788
|
}
|
|
445582
445789
|
async function workspaceTreeDigest(worktree2) {
|
|
445583
|
-
const temporaryIndex =
|
|
445790
|
+
const temporaryIndex = join200(tmpdir15(), `ur-workspace-index-${process.pid}-${randomUUID54()}`);
|
|
445584
445791
|
const env4 = {
|
|
445585
445792
|
...strictSubprocessEnv(),
|
|
445586
445793
|
GIT_INDEX_FILE: temporaryIndex
|
|
@@ -446119,15 +446326,15 @@ import {
|
|
|
446119
446326
|
existsSync as existsSync83,
|
|
446120
446327
|
mkdirSync as mkdirSync59,
|
|
446121
446328
|
readFileSync as readFileSync77,
|
|
446122
|
-
readdirSync as
|
|
446329
|
+
readdirSync as readdirSync30,
|
|
446123
446330
|
writeFileSync as writeFileSync59
|
|
446124
446331
|
} from "fs";
|
|
446125
|
-
import { dirname as
|
|
446332
|
+
import { dirname as dirname76, join as join201 } from "path";
|
|
446126
446333
|
function memoryDir(cwd2) {
|
|
446127
|
-
return
|
|
446334
|
+
return join201(cwd2, ".ur", "memory");
|
|
446128
446335
|
}
|
|
446129
446336
|
function policyPath2(cwd2) {
|
|
446130
|
-
return
|
|
446337
|
+
return join201(memoryDir(cwd2), "retention.json");
|
|
446131
446338
|
}
|
|
446132
446339
|
function defaultMemoryRetentionPolicy() {
|
|
446133
446340
|
return { version: 1, maxEntries: 1000, updatedAt: new Date().toISOString() };
|
|
@@ -446157,7 +446364,7 @@ function saveMemoryRetentionPolicy(cwd2, patch) {
|
|
|
446157
446364
|
decayDays: patch.decayDays === undefined ? current.decayDays : validPositive(patch.decayDays),
|
|
446158
446365
|
updatedAt: new Date().toISOString()
|
|
446159
446366
|
};
|
|
446160
|
-
mkdirSync59(
|
|
446367
|
+
mkdirSync59(dirname76(policyPath2(cwd2)), { recursive: true });
|
|
446161
446368
|
writeFileSync59(policyPath2(cwd2), `${JSON.stringify(next, null, 2)}
|
|
446162
446369
|
`);
|
|
446163
446370
|
return next;
|
|
@@ -446218,7 +446425,7 @@ function memoryJsonlFiles(cwd2) {
|
|
|
446218
446425
|
const dir = memoryDir(cwd2);
|
|
446219
446426
|
if (!existsSync83(dir))
|
|
446220
446427
|
return [];
|
|
446221
|
-
return
|
|
446428
|
+
return readdirSync30(dir).filter((name) => name.endsWith(".jsonl")).map((name) => join201(dir, name));
|
|
446222
446429
|
}
|
|
446223
446430
|
function pruneMemoryRetention(cwd2, policy = loadMemoryRetentionPolicy(cwd2), nowMs = Date.now()) {
|
|
446224
446431
|
const files = memoryJsonlFiles(cwd2).map((file2) => {
|
|
@@ -446339,10 +446546,10 @@ var exports_semantic_memory = {};
|
|
|
446339
446546
|
__export(exports_semantic_memory, {
|
|
446340
446547
|
call: () => call106
|
|
446341
446548
|
});
|
|
446342
|
-
import { existsSync as existsSync84, mkdirSync as mkdirSync60, readdirSync as
|
|
446343
|
-
import { basename as basename48, join as
|
|
446549
|
+
import { existsSync as existsSync84, mkdirSync as mkdirSync60, readdirSync as readdirSync31, readFileSync as readFileSync78, statSync as statSync26, writeFileSync as writeFileSync60 } from "fs";
|
|
446550
|
+
import { basename as basename48, join as join202 } from "path";
|
|
446344
446551
|
function indexPath3() {
|
|
446345
|
-
return
|
|
446552
|
+
return join202(getCwd(), ".ur", "semantic-memory", "index", "index.json");
|
|
446346
446553
|
}
|
|
446347
446554
|
function tokenize8(value2) {
|
|
446348
446555
|
return [...new Set(value2.toLowerCase().match(/[a-z0-9_]{3,}/g) ?? [])];
|
|
@@ -446351,15 +446558,15 @@ function sourceFiles() {
|
|
|
446351
446558
|
const cwd2 = getCwd();
|
|
446352
446559
|
const files = [];
|
|
446353
446560
|
for (const file2 of ["UR.md", "README.md"]) {
|
|
446354
|
-
const path22 =
|
|
446561
|
+
const path22 = join202(cwd2, file2);
|
|
446355
446562
|
if (existsSync84(path22))
|
|
446356
446563
|
files.push(path22);
|
|
446357
446564
|
}
|
|
446358
|
-
for (const dir of [
|
|
446565
|
+
for (const dir of [join202(cwd2, ".ur", "memory"), join202(cwd2, ".ur", "docs")]) {
|
|
446359
446566
|
if (!existsSync84(dir))
|
|
446360
446567
|
continue;
|
|
446361
|
-
for (const file2 of
|
|
446362
|
-
const path22 =
|
|
446568
|
+
for (const file2 of readdirSync31(dir)) {
|
|
446569
|
+
const path22 = join202(dir, file2);
|
|
446363
446570
|
if (statSync26(path22).isFile() && /\.(md|txt|jsonl)$/i.test(file2)) {
|
|
446364
446571
|
files.push(path22);
|
|
446365
446572
|
}
|
|
@@ -446383,7 +446590,7 @@ function buildIndex2() {
|
|
|
446383
446590
|
builtAt: new Date().toISOString(),
|
|
446384
446591
|
entries
|
|
446385
446592
|
};
|
|
446386
|
-
mkdirSync60(
|
|
446593
|
+
mkdirSync60(join202(getCwd(), ".ur", "semantic-memory", "index"), { recursive: true });
|
|
446387
446594
|
writeFileSync60(indexPath3(), `${JSON.stringify(index2, null, 2)}
|
|
446388
446595
|
`);
|
|
446389
446596
|
return index2;
|
|
@@ -615731,14 +615938,14 @@ import {
|
|
|
615731
615938
|
existsSync as existsSync85,
|
|
615732
615939
|
mkdirSync as mkdirSync61,
|
|
615733
615940
|
readFileSync as readFileSync79,
|
|
615734
|
-
readdirSync as
|
|
615941
|
+
readdirSync as readdirSync32,
|
|
615735
615942
|
statSync as statSync27,
|
|
615736
615943
|
writeFileSync as writeFileSync61
|
|
615737
615944
|
} from "fs";
|
|
615738
|
-
import { dirname as
|
|
615945
|
+
import { dirname as dirname77, extname as extname19, isAbsolute as isAbsolute44, join as join203, relative as relative48, resolve as resolve65 } from "path";
|
|
615739
615946
|
import { promisify as promisify4 } from "util";
|
|
615740
615947
|
function repoEditIndexPath(root2) {
|
|
615741
|
-
return
|
|
615948
|
+
return join203(root2, ".ur", "repo-edit", "index.json");
|
|
615742
615949
|
}
|
|
615743
615950
|
function isSkippedDir(pathFromRoot, name) {
|
|
615744
615951
|
if (SKIP_DIRS2.has(name))
|
|
@@ -615762,14 +615969,14 @@ function listRepoFiles(root2, maxFiles = 25000) {
|
|
|
615762
615969
|
return;
|
|
615763
615970
|
let entries;
|
|
615764
615971
|
try {
|
|
615765
|
-
entries =
|
|
615972
|
+
entries = readdirSync32(dir, { withFileTypes: true });
|
|
615766
615973
|
} catch {
|
|
615767
615974
|
return;
|
|
615768
615975
|
}
|
|
615769
615976
|
for (const entry of entries) {
|
|
615770
615977
|
if (files.length >= maxFiles)
|
|
615771
615978
|
return;
|
|
615772
|
-
const full =
|
|
615979
|
+
const full = join203(dir, entry.name);
|
|
615773
615980
|
const rel = normalizeRelPath(relative48(root2, full));
|
|
615774
615981
|
if (entry.isDirectory()) {
|
|
615775
615982
|
if (entry.name.startsWith(".") && entry.name !== ".ur")
|
|
@@ -615845,7 +616052,7 @@ function collectSymbols(file2, content) {
|
|
|
615845
616052
|
}
|
|
615846
616053
|
function buildRepoEditIndex(root2) {
|
|
615847
616054
|
const files = listRepoFiles(root2).map((path22) => {
|
|
615848
|
-
const abs =
|
|
616055
|
+
const abs = join203(root2, path22);
|
|
615849
616056
|
const stat42 = statSync27(abs);
|
|
615850
616057
|
const ext = extname19(path22).toLowerCase();
|
|
615851
616058
|
const text = isTextPath(path22);
|
|
@@ -615875,7 +616082,7 @@ ${content}`),
|
|
|
615875
616082
|
builtAt: new Date().toISOString(),
|
|
615876
616083
|
files
|
|
615877
616084
|
};
|
|
615878
|
-
mkdirSync61(
|
|
616085
|
+
mkdirSync61(dirname77(repoEditIndexPath(root2)), { recursive: true });
|
|
615879
616086
|
writeFileSync61(repoEditIndexPath(root2), `${JSON.stringify(index2, null, 2)}
|
|
615880
616087
|
`);
|
|
615881
616088
|
return index2;
|
|
@@ -615910,7 +616117,7 @@ function searchRepoEditIndex(root2, query2, index2 = loadRepoEditIndex(root2) ??
|
|
|
615910
616117
|
const lines = [];
|
|
615911
616118
|
if (file2.text && score > 0) {
|
|
615912
616119
|
try {
|
|
615913
|
-
const content = readFileSync79(
|
|
616120
|
+
const content = readFileSync79(join203(root2, file2.path), "utf-8");
|
|
615914
616121
|
const split = content.split(`
|
|
615915
616122
|
`);
|
|
615916
616123
|
for (let i3 = 0;i3 < split.length && lines.length < 4; i3++) {
|
|
@@ -615964,7 +616171,7 @@ function planRename(root2, from, to) {
|
|
|
615964
616171
|
if (from === to)
|
|
615965
616172
|
throw new Error("from and to must be different identifiers");
|
|
615966
616173
|
const files = listRepoFiles(root2).filter(isCodePath).flatMap((file2) => {
|
|
615967
|
-
const abs =
|
|
616174
|
+
const abs = join203(root2, file2);
|
|
615968
616175
|
let oldContent;
|
|
615969
616176
|
try {
|
|
615970
616177
|
oldContent = readFileSync79(abs, "utf-8");
|
|
@@ -616024,7 +616231,7 @@ async function runCheck(command5, cwd2) {
|
|
|
616024
616231
|
}
|
|
616025
616232
|
function rollback(root2, snapshots) {
|
|
616026
616233
|
for (const [file2, content] of snapshots) {
|
|
616027
|
-
writeFileSync61(
|
|
616234
|
+
writeFileSync61(join203(root2, file2), content);
|
|
616028
616235
|
}
|
|
616029
616236
|
}
|
|
616030
616237
|
async function applyRename(root2, from, to, options4 = {}) {
|
|
@@ -616037,7 +616244,7 @@ async function applyRename(root2, from, to, options4 = {}) {
|
|
|
616037
616244
|
try {
|
|
616038
616245
|
for (const file2 of plan.files) {
|
|
616039
616246
|
snapshots.set(file2.file, file2.oldContent);
|
|
616040
|
-
writeFileSync61(
|
|
616247
|
+
writeFileSync61(join203(root2, file2.file), file2.newContent);
|
|
616041
616248
|
writtenFiles.push(file2.file);
|
|
616042
616249
|
}
|
|
616043
616250
|
const syntax = plan.files.flatMap((file2) => syntaxErrors(file2.file, file2.newContent));
|
|
@@ -616271,7 +616478,7 @@ var init_engineRouter = __esm(() => {
|
|
|
616271
616478
|
|
|
616272
616479
|
// src/services/repoEditing/ast/diagnostics.ts
|
|
616273
616480
|
import { exec as exec9 } from "child_process";
|
|
616274
|
-
import { join as
|
|
616481
|
+
import { join as join204 } from "path";
|
|
616275
616482
|
import { promisify as promisify5 } from "util";
|
|
616276
616483
|
function emptySnapshot(source = "none") {
|
|
616277
616484
|
return { files: {}, collectedAt: new Date().toISOString(), source };
|
|
@@ -616356,7 +616563,7 @@ function createSyntheticProgram(root2, files) {
|
|
|
616356
616563
|
strict: false
|
|
616357
616564
|
};
|
|
616358
616565
|
const host = import_typescript2.default.createCompilerHost(compilerOptions);
|
|
616359
|
-
const fileNames = files.map((f) =>
|
|
616566
|
+
const fileNames = files.map((f) => join204(root2, f));
|
|
616360
616567
|
return import_typescript2.default.createProgram(fileNames, compilerOptions, host);
|
|
616361
616568
|
}
|
|
616362
616569
|
function collectTsDiagnostics(root2, files) {
|
|
@@ -616552,7 +616759,7 @@ var init_diagnostics = __esm(() => {
|
|
|
616552
616759
|
});
|
|
616553
616760
|
|
|
616554
616761
|
// src/services/repoEditing/ast/workspaceEdit.ts
|
|
616555
|
-
import { dirname as
|
|
616762
|
+
import { dirname as dirname78, isAbsolute as isAbsolute45, relative as relative49, resolve as resolve66, sep as sep43 } from "path";
|
|
616556
616763
|
import {
|
|
616557
616764
|
chmodSync as chmodSync11,
|
|
616558
616765
|
existsSync as existsSync86,
|
|
@@ -616603,7 +616810,7 @@ function realpathForMissing(path22) {
|
|
|
616603
616810
|
const suffix = [];
|
|
616604
616811
|
let cursor = path22;
|
|
616605
616812
|
while (!existsSync86(cursor)) {
|
|
616606
|
-
const parent2 =
|
|
616813
|
+
const parent2 = dirname78(cursor);
|
|
616607
616814
|
if (parent2 === cursor)
|
|
616608
616815
|
return path22;
|
|
616609
616816
|
suffix.unshift(cursor.slice(parent2.length + (parent2.endsWith(sep43) ? 0 : 1)));
|
|
@@ -616633,8 +616840,8 @@ function workspaceRelativePath(root2, file2) {
|
|
|
616633
616840
|
return relative49(realpathSync16(root2), resolveWorkspaceFile(root2, file2)).split(sep43).join("/");
|
|
616634
616841
|
}
|
|
616635
616842
|
function atomicWrite(path22, content, mode) {
|
|
616636
|
-
mkdirSync62(
|
|
616637
|
-
const temp = resolve66(
|
|
616843
|
+
mkdirSync62(dirname78(path22), { recursive: true });
|
|
616844
|
+
const temp = resolve66(dirname78(path22), `.${randomUUID55()}.ur-repo-edit.tmp`);
|
|
616638
616845
|
try {
|
|
616639
616846
|
writeFileSync62(temp, content, { flag: "wx", ...mode !== undefined ? { mode } : {} });
|
|
616640
616847
|
renameSync14(temp, path22);
|
|
@@ -616683,14 +616890,14 @@ function rollbackWorkspaceEdit(root2, snapshots) {
|
|
|
616683
616890
|
continue;
|
|
616684
616891
|
}
|
|
616685
616892
|
rmSync18(abs, { force: true, recursive: true });
|
|
616686
|
-
let parent2 =
|
|
616893
|
+
let parent2 = dirname78(abs);
|
|
616687
616894
|
while (parent2 !== realRoot && isWithin(realRoot, parent2)) {
|
|
616688
616895
|
try {
|
|
616689
616896
|
rmdirSync2(parent2);
|
|
616690
616897
|
} catch {
|
|
616691
616898
|
break;
|
|
616692
616899
|
}
|
|
616693
|
-
parent2 =
|
|
616900
|
+
parent2 = dirname78(parent2);
|
|
616694
616901
|
}
|
|
616695
616902
|
}
|
|
616696
616903
|
}
|
|
@@ -616838,7 +617045,7 @@ var init_lspEditEngine = __esm(() => {
|
|
|
616838
617045
|
});
|
|
616839
617046
|
|
|
616840
617047
|
// src/services/repoEditing/ast/typescriptEngine.ts
|
|
616841
|
-
import { dirname as
|
|
617048
|
+
import { dirname as dirname79, join as join205, relative as relative50 } from "path";
|
|
616842
617049
|
import { existsSync as existsSync87, readFileSync as readFileSync82 } from "fs";
|
|
616843
617050
|
function loadProgram(root2, files) {
|
|
616844
617051
|
const configPath2 = import_typescript3.default.findConfigFile(root2, import_typescript3.default.sys.fileExists, "tsconfig.json");
|
|
@@ -616862,7 +617069,7 @@ function loadProgram(root2, files) {
|
|
|
616862
617069
|
jsx: import_typescript3.default.JsxEmit.React
|
|
616863
617070
|
};
|
|
616864
617071
|
const host = import_typescript3.default.createCompilerHost(compilerOptions);
|
|
616865
|
-
const fileNames = files?.length ? files.map((f) =>
|
|
617072
|
+
const fileNames = files?.length ? files.map((f) => join205(root2, f)) : [];
|
|
616866
617073
|
program = import_typescript3.default.createProgram(fileNames, compilerOptions, host);
|
|
616867
617074
|
}
|
|
616868
617075
|
return { program, checker: program.getTypeChecker() };
|
|
@@ -616887,7 +617094,7 @@ function findNodeAtPosition(sourceFile, pos) {
|
|
|
616887
617094
|
return visit2(sourceFile);
|
|
616888
617095
|
}
|
|
616889
617096
|
function symbolAtPosition(ctx, file2, line, column) {
|
|
616890
|
-
const abs =
|
|
617097
|
+
const abs = join205(ctx.program.getCurrentDirectory(), file2);
|
|
616891
617098
|
const sourceFile = ctx.program.getSourceFile(abs);
|
|
616892
617099
|
if (!sourceFile)
|
|
616893
617100
|
return;
|
|
@@ -616950,7 +617157,7 @@ function addOldText(root2, edits) {
|
|
|
616950
617157
|
}
|
|
616951
617158
|
function tsRenameSymbol(ctx, options4) {
|
|
616952
617159
|
const { root: root2, from, to, file: maybeFile, line, column } = options4;
|
|
616953
|
-
const targetFile = maybeFile ?
|
|
617160
|
+
const targetFile = maybeFile ? join205(root2, maybeFile) : undefined;
|
|
616954
617161
|
let targetSymbols;
|
|
616955
617162
|
if (maybeFile && line !== undefined && column !== undefined) {
|
|
616956
617163
|
const symbol2 = symbolAtPosition(ctx, maybeFile, line, column);
|
|
@@ -616997,8 +617204,8 @@ function tsMoveFunction(ctx, options4) {
|
|
|
616997
617204
|
if (!sourceFileRel) {
|
|
616998
617205
|
throw new Error("TS move requires --file to identify the source file");
|
|
616999
617206
|
}
|
|
617000
|
-
const sourceAbs =
|
|
617001
|
-
const targetAbs =
|
|
617207
|
+
const sourceAbs = join205(root2, sourceFileRel);
|
|
617208
|
+
const targetAbs = join205(root2, targetFileRel);
|
|
617002
617209
|
const sourceSf = ctx.program.getSourceFile(sourceAbs);
|
|
617003
617210
|
const targetSf = ctx.program.getSourceFile(targetAbs) ?? ctx.program.getSourceFile(targetFileRel);
|
|
617004
617211
|
if (!sourceSf)
|
|
@@ -617099,11 +617306,11 @@ function normalizePath4(value2) {
|
|
|
617099
617306
|
function resolveRelativeImport(importingFileRel, specifier) {
|
|
617100
617307
|
if (!specifier.startsWith("."))
|
|
617101
617308
|
return;
|
|
617102
|
-
const base2 = normalizePath4(
|
|
617309
|
+
const base2 = normalizePath4(join205(dirname79(importingFileRel), specifier));
|
|
617103
617310
|
return stripKnownExtension(base2);
|
|
617104
617311
|
}
|
|
617105
617312
|
function moduleSpecifierBetween(importingFileRel, targetFileRel) {
|
|
617106
|
-
let specifier = normalizePath4(relative50(
|
|
617313
|
+
let specifier = normalizePath4(relative50(dirname79(importingFileRel), stripKnownExtension(targetFileRel)));
|
|
617107
617314
|
if (!specifier.startsWith("."))
|
|
617108
617315
|
specifier = `./${specifier}`;
|
|
617109
617316
|
return specifier;
|
|
@@ -618118,8 +618325,8 @@ var init_cite2 = __esm(() => {
|
|
|
618118
618325
|
});
|
|
618119
618326
|
|
|
618120
618327
|
// src/ur/fileops.ts
|
|
618121
|
-
import { existsSync as existsSync89, mkdirSync as mkdirSync63, readdirSync as
|
|
618122
|
-
import { extname as extname21, isAbsolute as isAbsolute46, join as
|
|
618328
|
+
import { existsSync as existsSync89, mkdirSync as mkdirSync63, readdirSync as readdirSync33, readFileSync as readFileSync84, statSync as statSync29, writeFileSync as writeFileSync63 } from "fs";
|
|
618329
|
+
import { extname as extname21, isAbsolute as isAbsolute46, join as join206, relative as relative51, resolve as resolve67 } from "path";
|
|
618123
618330
|
function readFileSafe2(cwd2, target, maxBytes = 64000) {
|
|
618124
618331
|
const abs = isAbsolute46(target) ? target : resolve67(cwd2, target);
|
|
618125
618332
|
if (!existsSync89(abs))
|
|
@@ -618144,7 +618351,7 @@ function* walk2(dir, root2, budget = { n: 0 }, max2 = 8000) {
|
|
|
618144
618351
|
return;
|
|
618145
618352
|
let entries;
|
|
618146
618353
|
try {
|
|
618147
|
-
entries =
|
|
618354
|
+
entries = readdirSync33(dir, { withFileTypes: true });
|
|
618148
618355
|
} catch {
|
|
618149
618356
|
return;
|
|
618150
618357
|
}
|
|
@@ -618153,7 +618360,7 @@ function* walk2(dir, root2, budget = { n: 0 }, max2 = 8000) {
|
|
|
618153
618360
|
return;
|
|
618154
618361
|
if (e.name.startsWith(".") && e.name !== ".ur")
|
|
618155
618362
|
continue;
|
|
618156
|
-
const full =
|
|
618363
|
+
const full = join206(dir, e.name);
|
|
618157
618364
|
if (e.isDirectory()) {
|
|
618158
618365
|
if (SKIP_DIRS3.has(e.name))
|
|
618159
618366
|
continue;
|
|
@@ -618172,7 +618379,7 @@ function searchFiles(cwd2, query2, maxResults = 60) {
|
|
|
618172
618379
|
continue;
|
|
618173
618380
|
let lines;
|
|
618174
618381
|
try {
|
|
618175
|
-
lines = readFileSync84(
|
|
618382
|
+
lines = readFileSync84(join206(cwd2, rel), "utf8").split(`
|
|
618176
618383
|
`);
|
|
618177
618384
|
} catch {
|
|
618178
618385
|
continue;
|
|
@@ -618190,8 +618397,8 @@ function searchFiles(cwd2, query2, maxResults = 60) {
|
|
|
618190
618397
|
function indexWorkspace(cwd2) {
|
|
618191
618398
|
const files = [...walk2(cwd2, cwd2)];
|
|
618192
618399
|
try {
|
|
618193
|
-
mkdirSync63(
|
|
618194
|
-
writeFileSync63(
|
|
618400
|
+
mkdirSync63(join206(cwd2, ".ur", "index"), { recursive: true });
|
|
618401
|
+
writeFileSync63(join206(cwd2, ".ur", "index", "files.txt"), files.join(`
|
|
618195
618402
|
`) + `
|
|
618196
618403
|
`);
|
|
618197
618404
|
} catch {}
|
|
@@ -618617,8 +618824,8 @@ __export(exports_mode, {
|
|
|
618617
618824
|
call: () => call122
|
|
618618
618825
|
});
|
|
618619
618826
|
import { existsSync as existsSync92, mkdirSync as mkdirSync64, readFileSync as readFileSync85, writeFileSync as writeFileSync64 } from "fs";
|
|
618620
|
-
import { join as
|
|
618621
|
-
var MODES2, SECURITY_MODES2, file2 = (cwd2) =>
|
|
618827
|
+
import { join as join207 } from "path";
|
|
618828
|
+
var MODES2, SECURITY_MODES2, file2 = (cwd2) => join207(cwd2, ".ur", "mode"), call122 = async (args) => {
|
|
618622
618829
|
const want = (args ?? "").trim().toLowerCase();
|
|
618623
618830
|
const f = file2(getCwd());
|
|
618624
618831
|
if (!want) {
|
|
@@ -618636,7 +618843,7 @@ available: ${MODES2.join(", ")}
|
|
|
618636
618843
|
security: ${SECURITY_MODES2.join(", ")}` };
|
|
618637
618844
|
}
|
|
618638
618845
|
try {
|
|
618639
|
-
mkdirSync64(
|
|
618846
|
+
mkdirSync64(join207(getCwd(), ".ur"), { recursive: true });
|
|
618640
618847
|
writeFileSync64(f, want + `
|
|
618641
618848
|
`);
|
|
618642
618849
|
} catch {}
|
|
@@ -618760,7 +618967,7 @@ __export(exports_role_mode, {
|
|
|
618760
618967
|
call: () => call123
|
|
618761
618968
|
});
|
|
618762
618969
|
import { existsSync as existsSync93, mkdirSync as mkdirSync65, writeFileSync as writeFileSync65 } from "fs";
|
|
618763
|
-
import { join as
|
|
618970
|
+
import { join as join208 } from "path";
|
|
618764
618971
|
function formatList2() {
|
|
618765
618972
|
const lines = ["Built-in role modes:", ""];
|
|
618766
618973
|
for (const mode2 of ROLE_MODES) {
|
|
@@ -618814,12 +619021,12 @@ var call123 = async (args) => {
|
|
|
618814
619021
|
value: `Unknown role mode "${target}". Available: ${listModeNames().join(", ")}, or "all".`
|
|
618815
619022
|
};
|
|
618816
619023
|
}
|
|
618817
|
-
const agentsDir =
|
|
619024
|
+
const agentsDir = join208(getCwd(), ".ur", "agents");
|
|
618818
619025
|
mkdirSync65(agentsDir, { recursive: true });
|
|
618819
619026
|
const created = [];
|
|
618820
619027
|
const skipped = [];
|
|
618821
619028
|
for (const mode2 of modes) {
|
|
618822
|
-
const path22 =
|
|
619029
|
+
const path22 = join208(agentsDir, `${mode2.name}.md`);
|
|
618823
619030
|
if (existsSync93(path22) && !force) {
|
|
618824
619031
|
skipped.push(`${mode2.name} (exists; use --force to overwrite)`);
|
|
618825
619032
|
continue;
|
|
@@ -618871,14 +619078,14 @@ var init_role_mode2 = __esm(() => {
|
|
|
618871
619078
|
|
|
618872
619079
|
// src/ur/researchGraph.ts
|
|
618873
619080
|
import { appendFileSync as appendFileSync8, existsSync as existsSync94, mkdirSync as mkdirSync66, readFileSync as readFileSync86 } from "fs";
|
|
618874
|
-
import { dirname as
|
|
619081
|
+
import { dirname as dirname80, join as join209 } from "path";
|
|
618875
619082
|
function isEntity(s) {
|
|
618876
619083
|
return ENTITIES.includes(s);
|
|
618877
619084
|
}
|
|
618878
619085
|
function addEntity(cwd2, entity, text) {
|
|
618879
619086
|
try {
|
|
618880
619087
|
const f = file3(cwd2, entity);
|
|
618881
|
-
mkdirSync66(
|
|
619088
|
+
mkdirSync66(dirname80(f), { recursive: true });
|
|
618882
619089
|
appendFileSync8(f, JSON.stringify({ ts: new Date().toISOString(), text }) + `
|
|
618883
619090
|
`);
|
|
618884
619091
|
} catch {}
|
|
@@ -618902,7 +619109,7 @@ function graphSummary(cwd2) {
|
|
|
618902
619109
|
out[e] = listEntity(cwd2, e).length;
|
|
618903
619110
|
return out;
|
|
618904
619111
|
}
|
|
618905
|
-
var ENTITIES, file3 = (cwd2, entity) =>
|
|
619112
|
+
var ENTITIES, file3 = (cwd2, entity) => join209(cwd2, ".ur", "graph", `${entity}.jsonl`);
|
|
618906
619113
|
var init_researchGraph = __esm(() => {
|
|
618907
619114
|
ENTITIES = [
|
|
618908
619115
|
"sources",
|
|
@@ -618971,15 +619178,15 @@ var exports_toolsmith = {};
|
|
|
618971
619178
|
__export(exports_toolsmith, {
|
|
618972
619179
|
call: () => call125
|
|
618973
619180
|
});
|
|
618974
|
-
import { existsSync as existsSync95, mkdirSync as mkdirSync67, readdirSync as
|
|
618975
|
-
import { join as
|
|
619181
|
+
import { existsSync as existsSync95, mkdirSync as mkdirSync67, readdirSync as readdirSync34, writeFileSync as writeFileSync66 } from "fs";
|
|
619182
|
+
import { join as join210 } from "path";
|
|
618976
619183
|
var TEMPLATES, call125 = async (args) => {
|
|
618977
619184
|
const [name, langArg] = (args ?? "").trim().split(/\s+/).filter(Boolean);
|
|
618978
619185
|
const auto = [["python3", "python"], ["node", "node"], ["bash", "bash"], ["go", "go"], ["cargo", "rust"]].find(([bin]) => commandExists(bin))?.[1] ?? "python";
|
|
618979
619186
|
const lang = langArg ?? auto;
|
|
618980
|
-
const dir =
|
|
619187
|
+
const dir = join210(getCwd(), ".ur", "tools");
|
|
618981
619188
|
if (!name) {
|
|
618982
|
-
const files = existsSync95(dir) ?
|
|
619189
|
+
const files = existsSync95(dir) ? readdirSync34(dir) : [];
|
|
618983
619190
|
return { type: "text", value: files.length ? `tools:
|
|
618984
619191
|
` + files.map((f) => " " + f).join(`
|
|
618985
619192
|
`) : "no tools yet. usage: /toolsmith <name> <python|bash|node|go|rust>" };
|
|
@@ -618988,7 +619195,7 @@ var TEMPLATES, call125 = async (args) => {
|
|
|
618988
619195
|
if (!tpl)
|
|
618989
619196
|
return { type: "text", value: `unknown lang "${lang}". choose: ${Object.keys(TEMPLATES).join(", ")}` };
|
|
618990
619197
|
mkdirSync67(dir, { recursive: true });
|
|
618991
|
-
const file4 =
|
|
619198
|
+
const file4 = join210(dir, `${name}.${tpl.ext}`);
|
|
618992
619199
|
if (existsSync95(file4))
|
|
618993
619200
|
return { type: "text", value: `already exists: .ur/tools/${name}.${tpl.ext}` };
|
|
618994
619201
|
writeFileSync66(file4, tpl.body);
|
|
@@ -619052,12 +619259,12 @@ __export(exports_browser, {
|
|
|
619052
619259
|
call: () => call126
|
|
619053
619260
|
});
|
|
619054
619261
|
import { existsSync as existsSync96 } from "fs";
|
|
619055
|
-
import { join as
|
|
619262
|
+
import { join as join211 } from "path";
|
|
619056
619263
|
var call126 = async (args) => {
|
|
619057
619264
|
const task2 = (args ?? "").trim();
|
|
619058
619265
|
if (!task2)
|
|
619059
619266
|
return { type: "text", value: "usage: /browser <url|task>" };
|
|
619060
|
-
const hasPlaywright = existsSync96(
|
|
619267
|
+
const hasPlaywright = existsSync96(join211(getCwd(), "node_modules", "playwright")) || existsSync96(join211(getCwd(), "node_modules", "playwright-core"));
|
|
619061
619268
|
if (hasPlaywright) {
|
|
619062
619269
|
return { type: "text", value: `Playwright detected \u2014 ask UR to drive the browser for: ${task2}
|
|
619063
619270
|
Risky actions (form submit, downloads, login) require your approval.` };
|
|
@@ -619115,16 +619322,16 @@ var init_ur_doctor2 = __esm(() => {
|
|
|
619115
619322
|
|
|
619116
619323
|
// src/utils/urAssets.ts
|
|
619117
619324
|
import { existsSync as existsSync97, mkdirSync as mkdirSync68, writeFileSync as writeFileSync67 } from "fs";
|
|
619118
|
-
import { join as
|
|
619325
|
+
import { join as join212 } from "path";
|
|
619119
619326
|
function scaffoldUrAssets(cwd2) {
|
|
619120
|
-
const root2 =
|
|
619327
|
+
const root2 = join212(cwd2, ".ur");
|
|
619121
619328
|
const created = [];
|
|
619122
619329
|
const skipped = [];
|
|
619123
619330
|
mkdirSync68(root2, { recursive: true });
|
|
619124
619331
|
for (const d3 of DIRS)
|
|
619125
|
-
mkdirSync68(
|
|
619332
|
+
mkdirSync68(join212(root2, d3), { recursive: true });
|
|
619126
619333
|
for (const file4 of SEED_FILES) {
|
|
619127
|
-
const full =
|
|
619334
|
+
const full = join212(root2, file4.path);
|
|
619128
619335
|
if (existsSync97(full)) {
|
|
619129
619336
|
skipped.push(file4.path);
|
|
619130
619337
|
continue;
|
|
@@ -619415,7 +619622,7 @@ __export(exports_thinkback, {
|
|
|
619415
619622
|
call: () => call132
|
|
619416
619623
|
});
|
|
619417
619624
|
import { readFile as readFile47 } from "fs/promises";
|
|
619418
|
-
import { join as
|
|
619625
|
+
import { join as join213 } from "path";
|
|
619419
619626
|
function getMarketplaceName() {
|
|
619420
619627
|
return OFFICIAL_MARKETPLACE_NAME;
|
|
619421
619628
|
}
|
|
@@ -619433,15 +619640,15 @@ async function getThinkbackSkillDir() {
|
|
|
619433
619640
|
if (!thinkbackPlugin) {
|
|
619434
619641
|
return null;
|
|
619435
619642
|
}
|
|
619436
|
-
const skillDir =
|
|
619643
|
+
const skillDir = join213(thinkbackPlugin.path, "skills", SKILL_NAME);
|
|
619437
619644
|
if (await pathExists(skillDir)) {
|
|
619438
619645
|
return skillDir;
|
|
619439
619646
|
}
|
|
619440
619647
|
return null;
|
|
619441
619648
|
}
|
|
619442
619649
|
async function playAnimation(skillDir) {
|
|
619443
|
-
const dataPath =
|
|
619444
|
-
const playerPath =
|
|
619650
|
+
const dataPath = join213(skillDir, "year_in_review.js");
|
|
619651
|
+
const playerPath = join213(skillDir, "player.js");
|
|
619445
619652
|
try {
|
|
619446
619653
|
await readFile47(dataPath);
|
|
619447
619654
|
} catch (e) {
|
|
@@ -619489,7 +619696,7 @@ async function playAnimation(skillDir) {
|
|
|
619489
619696
|
} catch {} finally {
|
|
619490
619697
|
inkInstance.exitAlternateScreen();
|
|
619491
619698
|
}
|
|
619492
|
-
const htmlPath =
|
|
619699
|
+
const htmlPath = join213(skillDir, "year_in_review.html");
|
|
619493
619700
|
if (await pathExists(htmlPath)) {
|
|
619494
619701
|
const platform6 = getPlatform();
|
|
619495
619702
|
const openCmd = platform6 === "macos" ? "open" : platform6 === "windows" ? "start" : "xdg-open";
|
|
@@ -619825,7 +620032,7 @@ function ThinkbackFlow(t0) {
|
|
|
619825
620032
|
if (!skillDir) {
|
|
619826
620033
|
return;
|
|
619827
620034
|
}
|
|
619828
|
-
const dataPath =
|
|
620035
|
+
const dataPath = join213(skillDir, "year_in_review.js");
|
|
619829
620036
|
pathExists(dataPath).then((exists) => {
|
|
619830
620037
|
logForDebugging(`Checking for ${dataPath}: ${exists ? "found" : "not found"}`);
|
|
619831
620038
|
setHasGenerated(exists);
|
|
@@ -619999,7 +620206,7 @@ var exports_thinkback_play = {};
|
|
|
619999
620206
|
__export(exports_thinkback_play, {
|
|
620000
620207
|
call: () => call133
|
|
620001
620208
|
});
|
|
620002
|
-
import { join as
|
|
620209
|
+
import { join as join214 } from "path";
|
|
620003
620210
|
function getPluginId2() {
|
|
620004
620211
|
const marketplaceName = process.env.USER_TYPE === "ant" ? INTERNAL_MARKETPLACE_NAME : OFFICIAL_MARKETPLACE_NAME;
|
|
620005
620212
|
return `thinkback@${marketplaceName}`;
|
|
@@ -620021,7 +620228,7 @@ async function call133() {
|
|
|
620021
620228
|
value: "Thinkback plugin installation path not found."
|
|
620022
620229
|
};
|
|
620023
620230
|
}
|
|
620024
|
-
const skillDir =
|
|
620231
|
+
const skillDir = join214(firstInstall.installPath, "skills", SKILL_NAME2);
|
|
620025
620232
|
const result = await playAnimation(skillDir);
|
|
620026
620233
|
return { type: "text", value: result.message };
|
|
620027
620234
|
}
|
|
@@ -626490,7 +626697,7 @@ var init_types15 = __esm(() => {
|
|
|
626490
626697
|
|
|
626491
626698
|
// src/components/agents/agentFileUtils.ts
|
|
626492
626699
|
import { mkdir as mkdir36, open as open13, unlink as unlink20 } from "fs/promises";
|
|
626493
|
-
import { join as
|
|
626700
|
+
import { join as join215 } from "path";
|
|
626494
626701
|
function formatAgentAsMarkdown(agentType, whenToUse, tools, systemPrompt, color3, model, memory2, effort) {
|
|
626495
626702
|
const escapedWhenToUse = whenToUse.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\\\n");
|
|
626496
626703
|
const isAllTools = tools === undefined || tools.length === 1 && tools[0] === "*";
|
|
@@ -626517,26 +626724,26 @@ function getAgentDirectoryPath(location2) {
|
|
|
626517
626724
|
case "flagSettings":
|
|
626518
626725
|
throw new Error(`Cannot get directory path for ${location2} agents`);
|
|
626519
626726
|
case "userSettings":
|
|
626520
|
-
return
|
|
626727
|
+
return join215(getURConfigHomeDir(), AGENT_PATHS.AGENTS_DIR);
|
|
626521
626728
|
case "projectSettings":
|
|
626522
|
-
return
|
|
626729
|
+
return join215(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
626523
626730
|
case "policySettings":
|
|
626524
|
-
return
|
|
626731
|
+
return join215(getManagedFilePath(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
626525
626732
|
case "localSettings":
|
|
626526
|
-
return
|
|
626733
|
+
return join215(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
626527
626734
|
}
|
|
626528
626735
|
}
|
|
626529
626736
|
function getRelativeAgentDirectoryPath(location2) {
|
|
626530
626737
|
switch (location2) {
|
|
626531
626738
|
case "projectSettings":
|
|
626532
|
-
return
|
|
626739
|
+
return join215(".", AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
626533
626740
|
default:
|
|
626534
626741
|
return getAgentDirectoryPath(location2);
|
|
626535
626742
|
}
|
|
626536
626743
|
}
|
|
626537
626744
|
function getNewAgentFilePath(agent2) {
|
|
626538
626745
|
const dirPath = getAgentDirectoryPath(agent2.source);
|
|
626539
|
-
return
|
|
626746
|
+
return join215(dirPath, `${agent2.agentType}.md`);
|
|
626540
626747
|
}
|
|
626541
626748
|
function getActualAgentFilePath(agent2) {
|
|
626542
626749
|
if (agent2.source === "built-in") {
|
|
@@ -626547,14 +626754,14 @@ function getActualAgentFilePath(agent2) {
|
|
|
626547
626754
|
}
|
|
626548
626755
|
const dirPath = getAgentDirectoryPath(agent2.source);
|
|
626549
626756
|
const filename = agent2.filename || agent2.agentType;
|
|
626550
|
-
return
|
|
626757
|
+
return join215(dirPath, `${filename}.md`);
|
|
626551
626758
|
}
|
|
626552
626759
|
function getNewRelativeAgentFilePath(agent2) {
|
|
626553
626760
|
if (agent2.source === "built-in") {
|
|
626554
626761
|
return "Built-in";
|
|
626555
626762
|
}
|
|
626556
626763
|
const dirPath = getRelativeAgentDirectoryPath(agent2.source);
|
|
626557
|
-
return
|
|
626764
|
+
return join215(dirPath, `${agent2.agentType}.md`);
|
|
626558
626765
|
}
|
|
626559
626766
|
function getActualRelativeAgentFilePath(agent2) {
|
|
626560
626767
|
if (isBuiltInAgent(agent2)) {
|
|
@@ -626568,7 +626775,7 @@ function getActualRelativeAgentFilePath(agent2) {
|
|
|
626568
626775
|
}
|
|
626569
626776
|
const dirPath = getRelativeAgentDirectoryPath(agent2.source);
|
|
626570
626777
|
const filename = agent2.filename || agent2.agentType;
|
|
626571
|
-
return
|
|
626778
|
+
return join215(dirPath, `${filename}.md`);
|
|
626572
626779
|
}
|
|
626573
626780
|
async function ensureAgentDirectoryExists(source) {
|
|
626574
626781
|
const dirPath = getAgentDirectoryPath(source);
|
|
@@ -632616,7 +632823,7 @@ var init_undo3 = __esm(() => {
|
|
|
632616
632823
|
// src/utils/heapDumpService.ts
|
|
632617
632824
|
import { createWriteStream as createWriteStream3, writeFileSync as writeFileSync68 } from "fs";
|
|
632618
632825
|
import { readdir as readdir27, readFile as readFile49, writeFile as writeFile40 } from "fs/promises";
|
|
632619
|
-
import { join as
|
|
632826
|
+
import { join as join216 } from "path";
|
|
632620
632827
|
import { pipeline as pipeline2 } from "stream/promises";
|
|
632621
632828
|
import {
|
|
632622
632829
|
getHeapSnapshot,
|
|
@@ -632706,7 +632913,7 @@ async function captureMemoryDiagnostics(trigger2, dumpNumber = 0) {
|
|
|
632706
632913
|
smapsRollup,
|
|
632707
632914
|
platform: process.platform,
|
|
632708
632915
|
nodeVersion: process.version,
|
|
632709
|
-
ccVersion: "1.
|
|
632916
|
+
ccVersion: "1.58.1"
|
|
632710
632917
|
};
|
|
632711
632918
|
}
|
|
632712
632919
|
async function performHeapDump(trigger2 = "manual", dumpNumber = 0) {
|
|
@@ -632724,8 +632931,8 @@ async function performHeapDump(trigger2 = "manual", dumpNumber = 0) {
|
|
|
632724
632931
|
const suffix = dumpNumber > 0 ? `-dump${dumpNumber}` : "";
|
|
632725
632932
|
const heapFilename = `${sessionId}${suffix}.heapsnapshot`;
|
|
632726
632933
|
const diagFilename = `${sessionId}${suffix}-diagnostics.json`;
|
|
632727
|
-
const heapPath =
|
|
632728
|
-
const diagPath =
|
|
632934
|
+
const heapPath = join216(dumpDir, heapFilename);
|
|
632935
|
+
const diagPath = join216(dumpDir, diagFilename);
|
|
632729
632936
|
await writeFile40(diagPath, jsonStringify(diagnostics, null, 2), {
|
|
632730
632937
|
mode: 384
|
|
632731
632938
|
});
|
|
@@ -633286,7 +633493,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
633286
633493
|
var call149 = async () => {
|
|
633287
633494
|
return {
|
|
633288
633495
|
type: "text",
|
|
633289
|
-
value: "1.
|
|
633496
|
+
value: "1.58.1"
|
|
633290
633497
|
};
|
|
633291
633498
|
}, version2, version_default;
|
|
633292
633499
|
var init_version = __esm(() => {
|
|
@@ -634670,7 +634877,7 @@ var init_sandbox_toggle2 = __esm(() => {
|
|
|
634670
634877
|
|
|
634671
634878
|
// src/utils/urInChrome/setupPortable.ts
|
|
634672
634879
|
import { readdir as readdir28 } from "fs/promises";
|
|
634673
|
-
import { join as
|
|
634880
|
+
import { join as join217 } from "path";
|
|
634674
634881
|
function getExtensionIds() {
|
|
634675
634882
|
return process.env.USER_TYPE === "ant" ? [PROD_EXTENSION_ID, DEV_EXTENSION_ID, ANT_EXTENSION_ID] : [PROD_EXTENSION_ID];
|
|
634676
634883
|
}
|
|
@@ -634697,7 +634904,7 @@ async function detectExtensionInstallationPortable(browserPaths, log) {
|
|
|
634697
634904
|
}
|
|
634698
634905
|
for (const profile of profileDirs) {
|
|
634699
634906
|
for (const extensionId of extensionIds) {
|
|
634700
|
-
const extensionPath =
|
|
634907
|
+
const extensionPath = join217(browserBasePath, profile, "Extensions", extensionId);
|
|
634701
634908
|
try {
|
|
634702
634909
|
await readdir28(extensionPath);
|
|
634703
634910
|
log?.(`[UR in Chrome] Extension ${extensionId} found in ${browser2} ${profile}`);
|
|
@@ -634721,7 +634928,7 @@ var init_setupPortable = __esm(() => {
|
|
|
634721
634928
|
// src/utils/urInChrome/setup.ts
|
|
634722
634929
|
import { chmod as chmod10, mkdir as mkdir37, readFile as readFile50, writeFile as writeFile41 } from "fs/promises";
|
|
634723
634930
|
import { homedir as homedir34 } from "os";
|
|
634724
|
-
import { join as
|
|
634931
|
+
import { join as join218 } from "path";
|
|
634725
634932
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
634726
634933
|
function shouldEnableURInChrome(chromeFlag) {
|
|
634727
634934
|
if (getIsNonInteractiveSession() && chromeFlag !== true) {
|
|
@@ -634778,8 +634985,8 @@ function setupURInChrome() {
|
|
|
634778
634985
|
};
|
|
634779
634986
|
} else {
|
|
634780
634987
|
const __filename3 = fileURLToPath6(import.meta.url);
|
|
634781
|
-
const __dirname3 =
|
|
634782
|
-
const cliPath =
|
|
634988
|
+
const __dirname3 = join218(__filename3, "..");
|
|
634989
|
+
const cliPath = join218(__dirname3, "cli.js");
|
|
634783
634990
|
createWrapperScript(`"${process.execPath}" "${cliPath}" --chrome-native-host`).then((manifestBinaryPath) => installChromeNativeHostManifest(manifestBinaryPath)).catch((e) => logForDebugging(`[UR in Chrome] Failed to install native host: ${e}`, { level: "error" }));
|
|
634784
634991
|
const mcpConfig = {
|
|
634785
634992
|
[UR_IN_CHROME_MCP_SERVER_NAME]: {
|
|
@@ -634801,8 +635008,8 @@ function getNativeMessagingHostsDirs() {
|
|
|
634801
635008
|
const platform6 = getPlatform();
|
|
634802
635009
|
if (platform6 === "windows") {
|
|
634803
635010
|
const home = homedir34();
|
|
634804
|
-
const appData = process.env.APPDATA ||
|
|
634805
|
-
return [
|
|
635011
|
+
const appData = process.env.APPDATA || join218(home, "AppData", "Local");
|
|
635012
|
+
return [join218(appData, "UR", "ChromeNativeHost")];
|
|
634806
635013
|
}
|
|
634807
635014
|
return getAllNativeMessagingHostsDirs().map(({ path: path22 }) => path22);
|
|
634808
635015
|
}
|
|
@@ -634827,7 +635034,7 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
634827
635034
|
const manifestContent = jsonStringify(manifest, null, 2);
|
|
634828
635035
|
let anyManifestUpdated = false;
|
|
634829
635036
|
for (const manifestDir of manifestDirs) {
|
|
634830
|
-
const manifestPath6 =
|
|
635037
|
+
const manifestPath6 = join218(manifestDir, NATIVE_HOST_MANIFEST_NAME);
|
|
634831
635038
|
const existingContent = await readFile50(manifestPath6, "utf-8").catch(() => null);
|
|
634832
635039
|
if (existingContent === manifestContent) {
|
|
634833
635040
|
continue;
|
|
@@ -634842,7 +635049,7 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
634842
635049
|
}
|
|
634843
635050
|
}
|
|
634844
635051
|
if (getPlatform() === "windows") {
|
|
634845
|
-
const manifestPath6 =
|
|
635052
|
+
const manifestPath6 = join218(manifestDirs[0], NATIVE_HOST_MANIFEST_NAME);
|
|
634846
635053
|
registerWindowsNativeHosts(manifestPath6);
|
|
634847
635054
|
}
|
|
634848
635055
|
if (anyManifestUpdated) {
|
|
@@ -634880,8 +635087,8 @@ function registerWindowsNativeHosts(manifestPath6) {
|
|
|
634880
635087
|
}
|
|
634881
635088
|
async function createWrapperScript(command7) {
|
|
634882
635089
|
const platform6 = getPlatform();
|
|
634883
|
-
const chromeDir =
|
|
634884
|
-
const wrapperPath = platform6 === "windows" ?
|
|
635090
|
+
const chromeDir = join218(getURConfigHomeDir(), "chrome");
|
|
635091
|
+
const wrapperPath = platform6 === "windows" ? join218(chromeDir, "chrome-native-host.bat") : join218(chromeDir, "chrome-native-host");
|
|
634885
635092
|
const scriptContent = platform6 === "windows" ? `@echo off
|
|
634886
635093
|
REM Chrome native host wrapper script
|
|
634887
635094
|
REM Generated by UR - do not edit manually
|
|
@@ -635453,7 +635660,7 @@ var init_advisor2 = __esm(() => {
|
|
|
635453
635660
|
// src/skills/bundledSkills.ts
|
|
635454
635661
|
import { constants as fsConstants6 } from "fs";
|
|
635455
635662
|
import { mkdir as mkdir38, open as open14 } from "fs/promises";
|
|
635456
|
-
import { dirname as
|
|
635663
|
+
import { dirname as dirname81, isAbsolute as isAbsolute49, join as join219, normalize as normalize14, sep as pathSep4 } from "path";
|
|
635457
635664
|
function registerBundledSkill(definition) {
|
|
635458
635665
|
const { files: files2 } = definition;
|
|
635459
635666
|
let skillRoot;
|
|
@@ -635501,7 +635708,7 @@ function getBundledSkills() {
|
|
|
635501
635708
|
return [...bundledSkills];
|
|
635502
635709
|
}
|
|
635503
635710
|
function getBundledSkillExtractDir(skillName) {
|
|
635504
|
-
return
|
|
635711
|
+
return join219(getBundledSkillsRoot(), skillName);
|
|
635505
635712
|
}
|
|
635506
635713
|
async function extractBundledSkillFiles(skillName, files2) {
|
|
635507
635714
|
const dir = getBundledSkillExtractDir(skillName);
|
|
@@ -635517,7 +635724,7 @@ async function writeSkillFiles(dir, files2) {
|
|
|
635517
635724
|
const byParent = new Map;
|
|
635518
635725
|
for (const [relPath, content] of Object.entries(files2)) {
|
|
635519
635726
|
const target = resolveSkillFilePath(dir, relPath);
|
|
635520
|
-
const parent2 =
|
|
635727
|
+
const parent2 = dirname81(target);
|
|
635521
635728
|
const entry = [target, content];
|
|
635522
635729
|
const group = byParent.get(parent2);
|
|
635523
635730
|
if (group)
|
|
@@ -635543,7 +635750,7 @@ function resolveSkillFilePath(baseDir, relPath) {
|
|
|
635543
635750
|
if (isAbsolute49(normalized) || normalized.split(pathSep4).includes("..") || normalized.split("/").includes("..")) {
|
|
635544
635751
|
throw new Error(`bundled skill file path escapes skill dir: ${relPath}`);
|
|
635545
635752
|
}
|
|
635546
|
-
return
|
|
635753
|
+
return join219(baseDir, normalized);
|
|
635547
635754
|
}
|
|
635548
635755
|
function prependBaseDir(blocks, baseDir) {
|
|
635549
635756
|
const prefix = `Base directory for this skill: ${baseDir}
|
|
@@ -635898,7 +636105,7 @@ var init_exit2 = __esm(() => {
|
|
|
635898
636105
|
});
|
|
635899
636106
|
|
|
635900
636107
|
// src/components/ExportDialog.tsx
|
|
635901
|
-
import { join as
|
|
636108
|
+
import { join as join220 } from "path";
|
|
635902
636109
|
function ExportDialog({
|
|
635903
636110
|
content,
|
|
635904
636111
|
defaultFilename,
|
|
@@ -635931,7 +636138,7 @@ function ExportDialog({
|
|
|
635931
636138
|
};
|
|
635932
636139
|
const handleFilenameSubmit = () => {
|
|
635933
636140
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
635934
|
-
const filepath =
|
|
636141
|
+
const filepath = join220(getCwd(), finalFilename);
|
|
635935
636142
|
try {
|
|
635936
636143
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
635937
636144
|
encoding: "utf-8",
|
|
@@ -636154,7 +636361,7 @@ __export(exports_export, {
|
|
|
636154
636361
|
extractFirstPrompt: () => extractFirstPrompt,
|
|
636155
636362
|
call: () => call155
|
|
636156
636363
|
});
|
|
636157
|
-
import { join as
|
|
636364
|
+
import { join as join221 } from "path";
|
|
636158
636365
|
function formatTimestamp(date6) {
|
|
636159
636366
|
const year = date6.getFullYear();
|
|
636160
636367
|
const month = String(date6.getMonth() + 1).padStart(2, "0");
|
|
@@ -636198,7 +636405,7 @@ async function call155(onDone, context6, args) {
|
|
|
636198
636405
|
const filename = args.trim();
|
|
636199
636406
|
if (filename) {
|
|
636200
636407
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
636201
|
-
const filepath =
|
|
636408
|
+
const filepath = join221(getCwd(), finalFilename);
|
|
636202
636409
|
try {
|
|
636203
636410
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
636204
636411
|
encoding: "utf-8",
|
|
@@ -639090,7 +639297,7 @@ var require_asciichart = __commonJS((exports) => {
|
|
|
639090
639297
|
// src/utils/statsCache.ts
|
|
639091
639298
|
import { randomBytes as randomBytes19 } from "crypto";
|
|
639092
639299
|
import { open as open15 } from "fs/promises";
|
|
639093
|
-
import { join as
|
|
639300
|
+
import { join as join222 } from "path";
|
|
639094
639301
|
async function withStatsCacheLock(fn) {
|
|
639095
639302
|
while (statsCacheLockPromise) {
|
|
639096
639303
|
await statsCacheLockPromise;
|
|
@@ -639107,7 +639314,7 @@ async function withStatsCacheLock(fn) {
|
|
|
639107
639314
|
}
|
|
639108
639315
|
}
|
|
639109
639316
|
function getStatsCachePath() {
|
|
639110
|
-
return
|
|
639317
|
+
return join222(getURConfigHomeDir(), STATS_CACHE_FILENAME);
|
|
639111
639318
|
}
|
|
639112
639319
|
function getEmptyCache() {
|
|
639113
639320
|
return {
|
|
@@ -639775,12 +639982,12 @@ var init_ansiToPng = __esm(() => {
|
|
|
639775
639982
|
// src/utils/screenshotClipboard.ts
|
|
639776
639983
|
import { mkdir as mkdir39, unlink as unlink21, writeFile as writeFile42 } from "fs/promises";
|
|
639777
639984
|
import { tmpdir as tmpdir16 } from "os";
|
|
639778
|
-
import { join as
|
|
639985
|
+
import { join as join223 } from "path";
|
|
639779
639986
|
async function copyAnsiToClipboard(ansiText, options4) {
|
|
639780
639987
|
try {
|
|
639781
|
-
const tempDir =
|
|
639988
|
+
const tempDir = join223(tmpdir16(), "ur-screenshots");
|
|
639782
639989
|
await mkdir39(tempDir, { recursive: true });
|
|
639783
|
-
const pngPath =
|
|
639990
|
+
const pngPath = join223(tempDir, `screenshot-${Date.now()}.png`);
|
|
639784
639991
|
const pngBuffer = ansiToPng(ansiText, options4);
|
|
639785
639992
|
await writeFile42(pngPath, pngBuffer);
|
|
639786
639993
|
const result = await copyPngToClipboard(pngPath);
|
|
@@ -639851,7 +640058,7 @@ var init_screenshotClipboard = __esm(() => {
|
|
|
639851
640058
|
|
|
639852
640059
|
// src/utils/stats.ts
|
|
639853
640060
|
import { open as open16 } from "fs/promises";
|
|
639854
|
-
import { basename as basename49, join as
|
|
640061
|
+
import { basename as basename49, join as join224, sep as sep44 } from "path";
|
|
639855
640062
|
async function processSessionFiles(sessionFiles, options4 = {}) {
|
|
639856
640063
|
const { fromDate, toDate } = options4;
|
|
639857
640064
|
const fs12 = getFsImplementation();
|
|
@@ -640029,17 +640236,17 @@ async function getAllSessionFiles() {
|
|
|
640029
640236
|
return [];
|
|
640030
640237
|
throw e;
|
|
640031
640238
|
}
|
|
640032
|
-
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
640239
|
+
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) => join224(projectsDir, dirent.name));
|
|
640033
640240
|
const projectResults = await Promise.all(projectDirs.map(async (projectDir) => {
|
|
640034
640241
|
try {
|
|
640035
640242
|
const entries = await fs12.readdir(projectDir);
|
|
640036
|
-
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) =>
|
|
640243
|
+
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) => join224(projectDir, dirent.name));
|
|
640037
640244
|
const sessionDirs = entries.filter((dirent) => dirent.isDirectory());
|
|
640038
640245
|
const subagentResults = await Promise.all(sessionDirs.map(async (sessionDir) => {
|
|
640039
|
-
const subagentsDir =
|
|
640246
|
+
const subagentsDir = join224(projectDir, sessionDir.name, "subagents");
|
|
640040
640247
|
try {
|
|
640041
640248
|
const subagentEntries = await fs12.readdir(subagentsDir);
|
|
640042
|
-
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) =>
|
|
640249
|
+
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) => join224(subagentsDir, dirent.name));
|
|
640043
640250
|
} catch {
|
|
640044
640251
|
return [];
|
|
640045
640252
|
}
|
|
@@ -642903,7 +643110,7 @@ import {
|
|
|
642903
643110
|
writeFile as writeFile43
|
|
642904
643111
|
} from "fs/promises";
|
|
642905
643112
|
import { tmpdir as tmpdir17 } from "os";
|
|
642906
|
-
import { extname as extname23, join as
|
|
643113
|
+
import { extname as extname23, join as join225 } from "path";
|
|
642907
643114
|
function getAnalysisModel() {
|
|
642908
643115
|
return getDefaultmodelOModel();
|
|
642909
643116
|
}
|
|
@@ -642911,13 +643118,13 @@ function getInsightsModel() {
|
|
|
642911
643118
|
return getDefaultmodelOModel();
|
|
642912
643119
|
}
|
|
642913
643120
|
function getDataDir() {
|
|
642914
|
-
return
|
|
643121
|
+
return join225(getURConfigHomeDir(), "usage-data");
|
|
642915
643122
|
}
|
|
642916
643123
|
function getFacetsDir() {
|
|
642917
|
-
return
|
|
643124
|
+
return join225(getDataDir(), "facets");
|
|
642918
643125
|
}
|
|
642919
643126
|
function getSessionMetaDir() {
|
|
642920
|
-
return
|
|
643127
|
+
return join225(getDataDir(), "session-meta");
|
|
642921
643128
|
}
|
|
642922
643129
|
function getLanguageFromPath(filePath) {
|
|
642923
643130
|
const ext = extname23(filePath).toLowerCase();
|
|
@@ -643262,7 +643469,7 @@ async function formatTranscriptWithSummarization(log) {
|
|
|
643262
643469
|
`);
|
|
643263
643470
|
}
|
|
643264
643471
|
async function loadCachedFacets(sessionId) {
|
|
643265
|
-
const facetPath =
|
|
643472
|
+
const facetPath = join225(getFacetsDir(), `${sessionId}.json`);
|
|
643266
643473
|
try {
|
|
643267
643474
|
const content = await readFile51(facetPath, { encoding: "utf-8" });
|
|
643268
643475
|
const parsed = jsonParse(content);
|
|
@@ -643281,14 +643488,14 @@ async function saveFacets(facets) {
|
|
|
643281
643488
|
try {
|
|
643282
643489
|
await mkdir40(getFacetsDir(), { recursive: true });
|
|
643283
643490
|
} catch {}
|
|
643284
|
-
const facetPath =
|
|
643491
|
+
const facetPath = join225(getFacetsDir(), `${facets.session_id}.json`);
|
|
643285
643492
|
await writeFile43(facetPath, jsonStringify(facets, null, 2), {
|
|
643286
643493
|
encoding: "utf-8",
|
|
643287
643494
|
mode: 384
|
|
643288
643495
|
});
|
|
643289
643496
|
}
|
|
643290
643497
|
async function loadCachedSessionMeta(sessionId) {
|
|
643291
|
-
const metaPath2 =
|
|
643498
|
+
const metaPath2 = join225(getSessionMetaDir(), `${sessionId}.json`);
|
|
643292
643499
|
try {
|
|
643293
643500
|
const content = await readFile51(metaPath2, { encoding: "utf-8" });
|
|
643294
643501
|
return jsonParse(content);
|
|
@@ -643300,7 +643507,7 @@ async function saveSessionMeta(meta) {
|
|
|
643300
643507
|
try {
|
|
643301
643508
|
await mkdir40(getSessionMetaDir(), { recursive: true });
|
|
643302
643509
|
} catch {}
|
|
643303
|
-
const metaPath2 =
|
|
643510
|
+
const metaPath2 = join225(getSessionMetaDir(), `${meta.session_id}.json`);
|
|
643304
643511
|
await writeFile43(metaPath2, jsonStringify(meta, null, 2), {
|
|
643305
643512
|
encoding: "utf-8",
|
|
643306
643513
|
mode: 384
|
|
@@ -644357,7 +644564,7 @@ function generateHtmlReport(data, insights) {
|
|
|
644357
644564
|
</html>`;
|
|
644358
644565
|
}
|
|
644359
644566
|
function buildExportData(data, insights, facets, remoteStats) {
|
|
644360
|
-
const version3 = typeof MACRO !== "undefined" ? "1.
|
|
644567
|
+
const version3 = typeof MACRO !== "undefined" ? "1.58.1" : "unknown";
|
|
644361
644568
|
const remote_hosts_collected = remoteStats?.hosts.filter((h2) => h2.sessionCount > 0).map((h2) => h2.name);
|
|
644362
644569
|
const facets_summary = {
|
|
644363
644570
|
total: facets.size,
|
|
@@ -644408,7 +644615,7 @@ async function scanAllSessions() {
|
|
|
644408
644615
|
} catch {
|
|
644409
644616
|
return [];
|
|
644410
644617
|
}
|
|
644411
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
644618
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join225(projectsDir, dirent.name));
|
|
644412
644619
|
const allSessions = [];
|
|
644413
644620
|
for (let i3 = 0;i3 < projectDirs.length; i3++) {
|
|
644414
644621
|
const sessionFiles = await getSessionFilesWithMtime(projectDirs[i3]);
|
|
@@ -644430,7 +644637,7 @@ async function scanAllSessions() {
|
|
|
644430
644637
|
async function generateUsageReport(options4) {
|
|
644431
644638
|
let remoteStats;
|
|
644432
644639
|
if (process.env.USER_TYPE === "ant" && options4?.collectRemote) {
|
|
644433
|
-
const destDir =
|
|
644640
|
+
const destDir = join225(getURConfigHomeDir(), "projects");
|
|
644434
644641
|
const { hosts, totalCopied } = await collectAllRemoteHostData(destDir);
|
|
644435
644642
|
remoteStats = { hosts, totalCopied };
|
|
644436
644643
|
}
|
|
@@ -644569,7 +644776,7 @@ async function generateUsageReport(options4) {
|
|
|
644569
644776
|
try {
|
|
644570
644777
|
await mkdir40(getDataDir(), { recursive: true });
|
|
644571
644778
|
} catch {}
|
|
644572
|
-
const htmlPath =
|
|
644779
|
+
const htmlPath = join225(getDataDir(), "report.html");
|
|
644573
644780
|
await writeFile43(htmlPath, htmlReport, {
|
|
644574
644781
|
encoding: "utf-8",
|
|
644575
644782
|
mode: 384
|
|
@@ -644665,13 +644872,13 @@ var init_insights = __esm(() => {
|
|
|
644665
644872
|
} : async () => 0;
|
|
644666
644873
|
collectFromRemoteHost = process.env.USER_TYPE === "ant" ? async (homespace, destDir) => {
|
|
644667
644874
|
const result = { copied: 0, skipped: 0 };
|
|
644668
|
-
const tempDir = await mkdtemp(
|
|
644875
|
+
const tempDir = await mkdtemp(join225(tmpdir17(), "ur-hs-"));
|
|
644669
644876
|
try {
|
|
644670
644877
|
const scpResult = await execFileNoThrow("scp", ["-rq", `${homespace}.coder:/root/.ur/projects/`, tempDir], { timeout: 300000 });
|
|
644671
644878
|
if (scpResult.code !== 0) {
|
|
644672
644879
|
return result;
|
|
644673
644880
|
}
|
|
644674
|
-
const projectsDir =
|
|
644881
|
+
const projectsDir = join225(tempDir, "projects");
|
|
644675
644882
|
let projectDirents;
|
|
644676
644883
|
try {
|
|
644677
644884
|
projectDirents = await readdir29(projectsDir, { withFileTypes: true });
|
|
@@ -644680,11 +644887,11 @@ var init_insights = __esm(() => {
|
|
|
644680
644887
|
}
|
|
644681
644888
|
await Promise.all(projectDirents.map(async (dirent) => {
|
|
644682
644889
|
const projectName = dirent.name;
|
|
644683
|
-
const projectPath =
|
|
644890
|
+
const projectPath = join225(projectsDir, projectName);
|
|
644684
644891
|
if (!dirent.isDirectory())
|
|
644685
644892
|
return;
|
|
644686
644893
|
const destProjectName = `${projectName}__${homespace}`;
|
|
644687
|
-
const destProjectPath =
|
|
644894
|
+
const destProjectPath = join225(destDir, destProjectName);
|
|
644688
644895
|
try {
|
|
644689
644896
|
await mkdir40(destProjectPath, { recursive: true });
|
|
644690
644897
|
} catch {}
|
|
@@ -644698,8 +644905,8 @@ var init_insights = __esm(() => {
|
|
|
644698
644905
|
const fileName = fileDirent.name;
|
|
644699
644906
|
if (!fileName.endsWith(".jsonl"))
|
|
644700
644907
|
return;
|
|
644701
|
-
const srcFile =
|
|
644702
|
-
const destFile =
|
|
644908
|
+
const srcFile = join225(projectPath, fileName);
|
|
644909
|
+
const destFile = join225(destProjectPath, fileName);
|
|
644703
644910
|
try {
|
|
644704
644911
|
await copyFile9(srcFile, destFile, fsConstants7.COPYFILE_EXCL);
|
|
644705
644912
|
result.copied++;
|
|
@@ -645811,7 +646018,7 @@ import {
|
|
|
645811
646018
|
unlink as unlink23,
|
|
645812
646019
|
writeFile as writeFile44
|
|
645813
646020
|
} from "fs/promises";
|
|
645814
|
-
import { basename as basename51, dirname as
|
|
646021
|
+
import { basename as basename51, dirname as dirname83, join as join226 } from "path";
|
|
645815
646022
|
function isTranscriptMessage(entry) {
|
|
645816
646023
|
const t = entry.type;
|
|
645817
646024
|
return t === "user" || t === "assistant" || t === "attachment" || t === "system";
|
|
@@ -645826,11 +646033,11 @@ function isEphemeralToolProgress(dataType) {
|
|
|
645826
646033
|
return typeof dataType === "string" && EPHEMERAL_PROGRESS_TYPES.has(dataType);
|
|
645827
646034
|
}
|
|
645828
646035
|
function getProjectsDir2() {
|
|
645829
|
-
return
|
|
646036
|
+
return join226(getURConfigHomeDir(), "projects");
|
|
645830
646037
|
}
|
|
645831
646038
|
function getTranscriptPath() {
|
|
645832
646039
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
645833
|
-
return
|
|
646040
|
+
return join226(projectDir, `${getSessionId()}.jsonl`);
|
|
645834
646041
|
}
|
|
645835
646042
|
function getTranscriptPathForSession(sessionId) {
|
|
645836
646043
|
if (!/^[a-zA-Z0-9-]{1,128}$/u.test(sessionId)) {
|
|
@@ -645840,7 +646047,7 @@ function getTranscriptPathForSession(sessionId) {
|
|
|
645840
646047
|
return getTranscriptPath();
|
|
645841
646048
|
}
|
|
645842
646049
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
645843
|
-
return
|
|
646050
|
+
return join226(projectDir, `${sessionId}.jsonl`);
|
|
645844
646051
|
}
|
|
645845
646052
|
function setAgentTranscriptSubdir(agentId, subdir) {
|
|
645846
646053
|
agentTranscriptSubdirs.set(agentId, subdir);
|
|
@@ -645852,15 +646059,15 @@ function getAgentTranscriptPath(agentId) {
|
|
|
645852
646059
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
645853
646060
|
const sessionId = getSessionId();
|
|
645854
646061
|
const subdir = agentTranscriptSubdirs.get(agentId);
|
|
645855
|
-
const base2 = subdir ?
|
|
645856
|
-
return
|
|
646062
|
+
const base2 = subdir ? join226(projectDir, sessionId, "subagents", subdir) : join226(projectDir, sessionId, "subagents");
|
|
646063
|
+
return join226(base2, `agent-${agentId}.jsonl`);
|
|
645857
646064
|
}
|
|
645858
646065
|
function getAgentMetadataPath(agentId) {
|
|
645859
646066
|
return getAgentTranscriptPath(agentId).replace(/\.jsonl$/, ".meta.json");
|
|
645860
646067
|
}
|
|
645861
646068
|
async function writeAgentMetadata(agentId, metadata) {
|
|
645862
646069
|
const path22 = getAgentMetadataPath(agentId);
|
|
645863
|
-
await mkdir41(
|
|
646070
|
+
await mkdir41(dirname83(path22), { recursive: true });
|
|
645864
646071
|
await writeFile44(path22, JSON.stringify(metadata));
|
|
645865
646072
|
}
|
|
645866
646073
|
async function readAgentMetadata(agentId) {
|
|
@@ -645876,14 +646083,14 @@ async function readAgentMetadata(agentId) {
|
|
|
645876
646083
|
}
|
|
645877
646084
|
function getRemoteAgentsDir() {
|
|
645878
646085
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
645879
|
-
return
|
|
646086
|
+
return join226(projectDir, getSessionId(), "remote-agents");
|
|
645880
646087
|
}
|
|
645881
646088
|
function getRemoteAgentMetadataPath(taskId) {
|
|
645882
|
-
return
|
|
646089
|
+
return join226(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
|
|
645883
646090
|
}
|
|
645884
646091
|
async function writeRemoteAgentMetadata(taskId, metadata) {
|
|
645885
646092
|
const path22 = getRemoteAgentMetadataPath(taskId);
|
|
645886
|
-
await mkdir41(
|
|
646093
|
+
await mkdir41(dirname83(path22), { recursive: true });
|
|
645887
646094
|
await writeFile44(path22, JSON.stringify(metadata));
|
|
645888
646095
|
}
|
|
645889
646096
|
async function readRemoteAgentMetadata(taskId) {
|
|
@@ -645922,7 +646129,7 @@ async function listRemoteAgentMetadata() {
|
|
|
645922
646129
|
if (!entry.isFile() || !entry.name.endsWith(".meta.json"))
|
|
645923
646130
|
continue;
|
|
645924
646131
|
try {
|
|
645925
|
-
const raw = await readFile52(
|
|
646132
|
+
const raw = await readFile52(join226(dir, entry.name), "utf-8");
|
|
645926
646133
|
results.push(JSON.parse(raw));
|
|
645927
646134
|
} catch (e) {
|
|
645928
646135
|
logForDebugging(`listRemoteAgentMetadata: skipping ${entry.name}: ${String(e)}`);
|
|
@@ -645932,7 +646139,7 @@ async function listRemoteAgentMetadata() {
|
|
|
645932
646139
|
}
|
|
645933
646140
|
function sessionIdExists(sessionId) {
|
|
645934
646141
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
645935
|
-
const sessionFile =
|
|
646142
|
+
const sessionFile = join226(projectDir, `${sessionId}.jsonl`);
|
|
645936
646143
|
const fs12 = getFsImplementation();
|
|
645937
646144
|
try {
|
|
645938
646145
|
fs12.statSync(sessionFile);
|
|
@@ -646086,7 +646293,7 @@ class Project {
|
|
|
646086
646293
|
try {
|
|
646087
646294
|
await fsAppendFile(filePath, data, { mode: 384 });
|
|
646088
646295
|
} catch {
|
|
646089
|
-
await mkdir41(
|
|
646296
|
+
await mkdir41(dirname83(filePath), { recursive: true, mode: 448 });
|
|
646090
646297
|
await fsAppendFile(filePath, data, { mode: 384 });
|
|
646091
646298
|
}
|
|
646092
646299
|
}
|
|
@@ -646689,7 +646896,7 @@ async function hydrateFromCCRv2InternalEvents(sessionId) {
|
|
|
646689
646896
|
}
|
|
646690
646897
|
for (const [agentId, entries] of byAgent) {
|
|
646691
646898
|
const agentFile = getAgentTranscriptPath(asAgentId(agentId));
|
|
646692
|
-
await mkdir41(
|
|
646899
|
+
await mkdir41(dirname83(agentFile), { recursive: true, mode: 448 });
|
|
646693
646900
|
const agentContent = entries.map((p2) => jsonStringify(p2) + `
|
|
646694
646901
|
`).join("");
|
|
646695
646902
|
await writeFile44(agentFile, agentContent, {
|
|
@@ -647226,7 +647433,7 @@ function appendEntryToFile(fullPath, entry) {
|
|
|
647226
647433
|
try {
|
|
647227
647434
|
fs12.appendFileSync(fullPath, line, { mode: 384 });
|
|
647228
647435
|
} catch {
|
|
647229
|
-
fs12.mkdirSync(
|
|
647436
|
+
fs12.mkdirSync(dirname83(fullPath), { mode: 448 });
|
|
647230
647437
|
fs12.appendFileSync(fullPath, line, { mode: 384 });
|
|
647231
647438
|
}
|
|
647232
647439
|
}
|
|
@@ -647923,7 +648130,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
647923
648130
|
};
|
|
647924
648131
|
}
|
|
647925
648132
|
async function loadSessionFile(sessionId) {
|
|
647926
|
-
const sessionFile =
|
|
648133
|
+
const sessionFile = join226(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
647927
648134
|
return loadTranscriptFile(sessionFile);
|
|
647928
648135
|
}
|
|
647929
648136
|
function clearSessionMessagesCache() {
|
|
@@ -647991,7 +648198,7 @@ async function loadAllProjectsMessageLogsFull(limit) {
|
|
|
647991
648198
|
} catch {
|
|
647992
648199
|
return [];
|
|
647993
648200
|
}
|
|
647994
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
648201
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join226(projectsDir, dirent.name));
|
|
647995
648202
|
const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
|
|
647996
648203
|
const allLogs = logsPerProject.flat();
|
|
647997
648204
|
const deduped = new Map;
|
|
@@ -648016,7 +648223,7 @@ async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount =
|
|
|
648016
648223
|
} catch {
|
|
648017
648224
|
return { logs: [], allStatLogs: [], nextIndex: 0 };
|
|
648018
648225
|
}
|
|
648019
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
648226
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join226(projectsDir, dirent.name));
|
|
648020
648227
|
const rawLogs = [];
|
|
648021
648228
|
for (const projectDir of projectDirs) {
|
|
648022
648229
|
rawLogs.push(...await getSessionFilesLite(projectDir, limit));
|
|
@@ -648077,7 +648284,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
648077
648284
|
for (const { path: wtPath, prefix } of indexed) {
|
|
648078
648285
|
if (dirName === prefix || dirName.startsWith(prefix + "-")) {
|
|
648079
648286
|
seenDirs.add(dirName);
|
|
648080
|
-
allLogs.push(...await getSessionFilesLite(
|
|
648287
|
+
allLogs.push(...await getSessionFilesLite(join226(projectsDir, dirent.name), undefined, wtPath));
|
|
648081
648288
|
break;
|
|
648082
648289
|
}
|
|
648083
648290
|
}
|
|
@@ -648146,7 +648353,7 @@ async function loadSubagentTranscripts(agentIds) {
|
|
|
648146
648353
|
return transcripts;
|
|
648147
648354
|
}
|
|
648148
648355
|
async function loadAllSubagentTranscriptsFromDisk() {
|
|
648149
|
-
const subagentsDir =
|
|
648356
|
+
const subagentsDir = join226(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), getSessionId(), "subagents");
|
|
648150
648357
|
let entries;
|
|
648151
648358
|
try {
|
|
648152
648359
|
entries = await readdir30(subagentsDir, { withFileTypes: true });
|
|
@@ -648274,7 +648481,7 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
648274
648481
|
const sessionId = validateUuid2(basename51(dirent.name, ".jsonl"));
|
|
648275
648482
|
if (!sessionId)
|
|
648276
648483
|
continue;
|
|
648277
|
-
candidates2.push({ sessionId, filePath:
|
|
648484
|
+
candidates2.push({ sessionId, filePath: join226(projectDir, dirent.name) });
|
|
648278
648485
|
}
|
|
648279
648486
|
await Promise.all(candidates2.map(async ({ sessionId, filePath }) => {
|
|
648280
648487
|
try {
|
|
@@ -648660,7 +648867,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
648660
648867
|
init_settings2();
|
|
648661
648868
|
init_slowOperations();
|
|
648662
648869
|
init_uuid();
|
|
648663
|
-
VERSION7 = typeof MACRO !== "undefined" ? "1.
|
|
648870
|
+
VERSION7 = typeof MACRO !== "undefined" ? "1.58.1" : "unknown";
|
|
648664
648871
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
648665
648872
|
SKIP_FIRST_PROMPT_PATTERN = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
648666
648873
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -648672,7 +648879,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
648672
648879
|
MAX_TRANSCRIPT_READ_BYTES = 50 * 1024 * 1024;
|
|
648673
648880
|
agentTranscriptSubdirs = new Map;
|
|
648674
648881
|
getProjectDir2 = memoize_default((projectDir) => {
|
|
648675
|
-
return
|
|
648882
|
+
return join226(getProjectsDir2(), sanitizePath2(projectDir));
|
|
648676
648883
|
});
|
|
648677
648884
|
METADATA_TYPE_MARKERS = [
|
|
648678
648885
|
'"type":"summary"',
|
|
@@ -648910,41 +649117,41 @@ var init_memdir = __esm(() => {
|
|
|
648910
649117
|
});
|
|
648911
649118
|
|
|
648912
649119
|
// src/tools/AgentTool/agentMemory.ts
|
|
648913
|
-
import { join as
|
|
649120
|
+
import { join as join227, normalize as normalize15, sep as sep45 } from "path";
|
|
648914
649121
|
function sanitizeAgentTypeForPath(agentType) {
|
|
648915
649122
|
return agentType.replace(/:/g, "-");
|
|
648916
649123
|
}
|
|
648917
649124
|
function getLocalAgentMemoryDir(dirName) {
|
|
648918
649125
|
if (process.env.UR_CODE_REMOTE_MEMORY_DIR) {
|
|
648919
|
-
return
|
|
649126
|
+
return join227(process.env.UR_CODE_REMOTE_MEMORY_DIR, "projects", sanitizePath2(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep45;
|
|
648920
649127
|
}
|
|
648921
|
-
return
|
|
649128
|
+
return join227(getCwd(), ".ur", "agent-memory-local", dirName) + sep45;
|
|
648922
649129
|
}
|
|
648923
649130
|
function getAgentMemoryDir(agentType, scope) {
|
|
648924
649131
|
const dirName = sanitizeAgentTypeForPath(agentType);
|
|
648925
649132
|
switch (scope) {
|
|
648926
649133
|
case "project":
|
|
648927
|
-
return
|
|
649134
|
+
return join227(getCwd(), ".ur", "agent-memory", dirName) + sep45;
|
|
648928
649135
|
case "local":
|
|
648929
649136
|
return getLocalAgentMemoryDir(dirName);
|
|
648930
649137
|
case "user":
|
|
648931
|
-
return
|
|
649138
|
+
return join227(getMemoryBaseDir(), "agent-memory", dirName) + sep45;
|
|
648932
649139
|
}
|
|
648933
649140
|
}
|
|
648934
649141
|
function isAgentMemoryPath(absolutePath) {
|
|
648935
649142
|
const normalizedPath2 = normalize15(absolutePath);
|
|
648936
649143
|
const memoryBase = getMemoryBaseDir();
|
|
648937
|
-
if (normalizedPath2.startsWith(
|
|
649144
|
+
if (normalizedPath2.startsWith(join227(memoryBase, "agent-memory") + sep45)) {
|
|
648938
649145
|
return true;
|
|
648939
649146
|
}
|
|
648940
|
-
if (normalizedPath2.startsWith(
|
|
649147
|
+
if (normalizedPath2.startsWith(join227(getCwd(), ".ur", "agent-memory") + sep45)) {
|
|
648941
649148
|
return true;
|
|
648942
649149
|
}
|
|
648943
649150
|
if (process.env.UR_CODE_REMOTE_MEMORY_DIR) {
|
|
648944
|
-
if (normalizedPath2.includes(sep45 + "agent-memory-local" + sep45) && normalizedPath2.startsWith(
|
|
649151
|
+
if (normalizedPath2.includes(sep45 + "agent-memory-local" + sep45) && normalizedPath2.startsWith(join227(process.env.UR_CODE_REMOTE_MEMORY_DIR, "projects") + sep45)) {
|
|
648945
649152
|
return true;
|
|
648946
649153
|
}
|
|
648947
|
-
} else if (normalizedPath2.startsWith(
|
|
649154
|
+
} else if (normalizedPath2.startsWith(join227(getCwd(), ".ur", "agent-memory-local") + sep45)) {
|
|
648948
649155
|
return true;
|
|
648949
649156
|
}
|
|
648950
649157
|
return false;
|
|
@@ -648952,7 +649159,7 @@ function isAgentMemoryPath(absolutePath) {
|
|
|
648952
649159
|
function getMemoryScopeDisplay(memory2) {
|
|
648953
649160
|
switch (memory2) {
|
|
648954
649161
|
case "user":
|
|
648955
|
-
return `User (${
|
|
649162
|
+
return `User (${join227(getMemoryBaseDir(), "agent-memory")}/)`;
|
|
648956
649163
|
case "project":
|
|
648957
649164
|
return "Project (.ur/agent-memory/)";
|
|
648958
649165
|
case "local":
|
|
@@ -648995,7 +649202,7 @@ var init_agentMemory = __esm(() => {
|
|
|
648995
649202
|
// src/utils/permissions/filesystem.ts
|
|
648996
649203
|
import { randomBytes as randomBytes20 } from "crypto";
|
|
648997
649204
|
import { homedir as homedir35, tmpdir as tmpdir18 } from "os";
|
|
648998
|
-
import { join as
|
|
649205
|
+
import { join as join228, normalize as normalize16, posix as posix10, sep as sep46 } from "path";
|
|
648999
649206
|
function normalizeCaseForComparison(path22) {
|
|
649000
649207
|
return path22.toLowerCase();
|
|
649001
649208
|
}
|
|
@@ -649004,19 +649211,19 @@ function getURSkillScope(filePath) {
|
|
|
649004
649211
|
const absolutePathLower = normalizeCaseForComparison(absolutePath);
|
|
649005
649212
|
const bases = [
|
|
649006
649213
|
{
|
|
649007
|
-
dir: expandPath(
|
|
649214
|
+
dir: expandPath(join228(getOriginalCwd(), ".ur", "skills")),
|
|
649008
649215
|
prefix: "/.ur/skills/"
|
|
649009
649216
|
},
|
|
649010
649217
|
{
|
|
649011
|
-
dir: expandPath(
|
|
649218
|
+
dir: expandPath(join228(homedir35(), ".ur", "skills")),
|
|
649012
649219
|
prefix: "~/.ur/skills/"
|
|
649013
649220
|
},
|
|
649014
649221
|
{
|
|
649015
|
-
dir: expandPath(
|
|
649222
|
+
dir: expandPath(join228(getOriginalCwd(), ".agents", "skills")),
|
|
649016
649223
|
prefix: "/.agents/skills/"
|
|
649017
649224
|
},
|
|
649018
649225
|
{
|
|
649019
|
-
dir: expandPath(
|
|
649226
|
+
dir: expandPath(join228(homedir35(), ".agents", "skills")),
|
|
649020
649227
|
prefix: "~/.agents/skills/"
|
|
649021
649228
|
}
|
|
649022
649229
|
];
|
|
@@ -649071,22 +649278,22 @@ function isURConfigFilePath(filePath) {
|
|
|
649071
649278
|
if (isURSettingsPath(filePath)) {
|
|
649072
649279
|
return true;
|
|
649073
649280
|
}
|
|
649074
|
-
const commandsDir =
|
|
649075
|
-
const agentsDir =
|
|
649076
|
-
const skillsDir =
|
|
649077
|
-
const crossClientSkillsDir =
|
|
649281
|
+
const commandsDir = join228(getOriginalCwd(), ".ur", "commands");
|
|
649282
|
+
const agentsDir = join228(getOriginalCwd(), ".ur", "agents");
|
|
649283
|
+
const skillsDir = join228(getOriginalCwd(), ".ur", "skills");
|
|
649284
|
+
const crossClientSkillsDir = join228(getOriginalCwd(), ".agents", "skills");
|
|
649078
649285
|
return pathInWorkingPath(filePath, commandsDir) || pathInWorkingPath(filePath, agentsDir) || pathInWorkingPath(filePath, skillsDir) || pathInWorkingPath(filePath, crossClientSkillsDir);
|
|
649079
649286
|
}
|
|
649080
649287
|
function isSessionPlanFile(absolutePath) {
|
|
649081
|
-
const expectedPrefix =
|
|
649288
|
+
const expectedPrefix = join228(getPlansDirectory(), getPlanSlug());
|
|
649082
649289
|
const normalizedPath2 = normalize16(absolutePath);
|
|
649083
649290
|
return normalizedPath2.startsWith(expectedPrefix) && normalizedPath2.endsWith(".md");
|
|
649084
649291
|
}
|
|
649085
649292
|
function getSessionMemoryDir() {
|
|
649086
|
-
return
|
|
649293
|
+
return join228(getProjectDir2(getCwd()), getSessionId(), "session-memory") + sep46;
|
|
649087
649294
|
}
|
|
649088
649295
|
function getSessionMemoryPath() {
|
|
649089
|
-
return
|
|
649296
|
+
return join228(getSessionMemoryDir(), "summary.md");
|
|
649090
649297
|
}
|
|
649091
649298
|
function isSessionMemoryPath(absolutePath) {
|
|
649092
649299
|
const normalizedPath2 = normalize16(absolutePath);
|
|
@@ -649108,10 +649315,10 @@ function getURTempDirName() {
|
|
|
649108
649315
|
return `ur-${uid}`;
|
|
649109
649316
|
}
|
|
649110
649317
|
function getProjectTempDir() {
|
|
649111
|
-
return
|
|
649318
|
+
return join228(getURTempDir(), sanitizePath2(getOriginalCwd())) + sep46;
|
|
649112
649319
|
}
|
|
649113
649320
|
function getScratchpadDir() {
|
|
649114
|
-
return
|
|
649321
|
+
return join228(getProjectTempDir(), getSessionId(), "scratchpad");
|
|
649115
649322
|
}
|
|
649116
649323
|
async function ensureScratchpadDir() {
|
|
649117
649324
|
if (!isScratchpadEnabled()) {
|
|
@@ -649689,7 +649896,7 @@ function checkEditableInternalPath(absolutePath, input) {
|
|
|
649689
649896
|
}
|
|
649690
649897
|
};
|
|
649691
649898
|
}
|
|
649692
|
-
if (normalizeCaseForComparison(normalizedPath2) === normalizeCaseForComparison(
|
|
649899
|
+
if (normalizeCaseForComparison(normalizedPath2) === normalizeCaseForComparison(join228(getOriginalCwd(), ".ur", "launch.json"))) {
|
|
649693
649900
|
return {
|
|
649694
649901
|
behavior: "allow",
|
|
649695
649902
|
updatedInput: input,
|
|
@@ -649786,7 +649993,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
649786
649993
|
}
|
|
649787
649994
|
};
|
|
649788
649995
|
}
|
|
649789
|
-
const tasksDir =
|
|
649996
|
+
const tasksDir = join228(getURConfigHomeDir(), "tasks") + sep46;
|
|
649790
649997
|
if (normalizedPath2 === tasksDir.slice(0, -1) || normalizedPath2.startsWith(tasksDir)) {
|
|
649791
649998
|
return {
|
|
649792
649999
|
behavior: "allow",
|
|
@@ -649797,7 +650004,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
649797
650004
|
}
|
|
649798
650005
|
};
|
|
649799
650006
|
}
|
|
649800
|
-
const teamsReadDir =
|
|
650007
|
+
const teamsReadDir = join228(getURConfigHomeDir(), "teams") + sep46;
|
|
649801
650008
|
if (normalizedPath2 === teamsReadDir.slice(0, -1) || normalizedPath2.startsWith(teamsReadDir)) {
|
|
649802
650009
|
return {
|
|
649803
650010
|
behavior: "allow",
|
|
@@ -649871,11 +650078,11 @@ var init_filesystem = __esm(() => {
|
|
|
649871
650078
|
try {
|
|
649872
650079
|
resolvedBaseTmpDir = fs12.realpathSync(baseTmpDir);
|
|
649873
650080
|
} catch {}
|
|
649874
|
-
return
|
|
650081
|
+
return join228(resolvedBaseTmpDir, getURTempDirName()) + sep46;
|
|
649875
650082
|
});
|
|
649876
650083
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
649877
650084
|
const nonce = randomBytes20(16).toString("hex");
|
|
649878
|
-
return
|
|
650085
|
+
return join228(getURTempDir(), "bundled-skills", "1.58.1", nonce);
|
|
649879
650086
|
});
|
|
649880
650087
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
649881
650088
|
});
|
|
@@ -649889,10 +650096,10 @@ import {
|
|
|
649889
650096
|
symlink as symlink4,
|
|
649890
650097
|
unlink as unlink24
|
|
649891
650098
|
} from "fs/promises";
|
|
649892
|
-
import { join as
|
|
650099
|
+
import { join as join229 } from "path";
|
|
649893
650100
|
function getTaskOutputDir() {
|
|
649894
650101
|
if (_taskOutputDir === undefined) {
|
|
649895
|
-
_taskOutputDir =
|
|
650102
|
+
_taskOutputDir = join229(getProjectTempDir(), getSessionId(), "tasks");
|
|
649896
650103
|
}
|
|
649897
650104
|
return _taskOutputDir;
|
|
649898
650105
|
}
|
|
@@ -649900,7 +650107,7 @@ async function ensureOutputDir() {
|
|
|
649900
650107
|
await mkdir42(getTaskOutputDir(), { recursive: true });
|
|
649901
650108
|
}
|
|
649902
650109
|
function getTaskOutputPath(taskId) {
|
|
649903
|
-
return
|
|
650110
|
+
return join229(getTaskOutputDir(), `${taskId}.output`);
|
|
649904
650111
|
}
|
|
649905
650112
|
function track(p2) {
|
|
649906
650113
|
_pendingOps.add(p2);
|
|
@@ -654426,7 +654633,7 @@ import {
|
|
|
654426
654633
|
symlink as symlink5,
|
|
654427
654634
|
utimes as utimes2
|
|
654428
654635
|
} from "fs/promises";
|
|
654429
|
-
import { basename as basename53, dirname as
|
|
654636
|
+
import { basename as basename53, dirname as dirname84, join as join230 } from "path";
|
|
654430
654637
|
function validateWorktreeSlug(slug5) {
|
|
654431
654638
|
if (slug5.length > MAX_WORKTREE_SLUG_LENGTH) {
|
|
654432
654639
|
throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug5.length})`);
|
|
@@ -654449,8 +654656,8 @@ async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
|
|
|
654449
654656
|
logForDebugging(`Skipping symlink for "${dir}": path traversal detected`, { level: "warn" });
|
|
654450
654657
|
continue;
|
|
654451
654658
|
}
|
|
654452
|
-
const sourcePath =
|
|
654453
|
-
const destPath =
|
|
654659
|
+
const sourcePath = join230(repoRootPath, dir);
|
|
654660
|
+
const destPath = join230(worktreePath, dir);
|
|
654454
654661
|
try {
|
|
654455
654662
|
await symlink5(sourcePath, destPath, "dir");
|
|
654456
654663
|
logForDebugging(`Symlinked ${dir} from main repository to worktree to avoid disk bloat`);
|
|
@@ -654474,7 +654681,7 @@ function generateTmuxSessionName(repoPath, branch2) {
|
|
|
654474
654681
|
return combined.replace(/[/.]/g, "_");
|
|
654475
654682
|
}
|
|
654476
654683
|
function worktreesDir2(repoRoot) {
|
|
654477
|
-
return
|
|
654684
|
+
return join230(repoRoot, ".ur", "worktrees");
|
|
654478
654685
|
}
|
|
654479
654686
|
function flattenSlug(slug5) {
|
|
654480
654687
|
return slug5.replaceAll("/", "+");
|
|
@@ -654483,7 +654690,7 @@ function worktreeBranchName(slug5) {
|
|
|
654483
654690
|
return `worktree-${flattenSlug(slug5)}`;
|
|
654484
654691
|
}
|
|
654485
654692
|
function worktreePathFor(repoRoot, slug5) {
|
|
654486
|
-
return
|
|
654693
|
+
return join230(worktreesDir2(repoRoot), flattenSlug(slug5));
|
|
654487
654694
|
}
|
|
654488
654695
|
async function getOrCreateWorktree(repoRoot, slug5, options4) {
|
|
654489
654696
|
const worktreePath = worktreePathFor(repoRoot, slug5);
|
|
@@ -654564,7 +654771,7 @@ async function getOrCreateWorktree(repoRoot, slug5, options4) {
|
|
|
654564
654771
|
async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
654565
654772
|
let includeContent;
|
|
654566
654773
|
try {
|
|
654567
|
-
includeContent = await readFile53(
|
|
654774
|
+
includeContent = await readFile53(join230(repoRoot, ".worktreeinclude"), "utf-8");
|
|
654568
654775
|
} catch {
|
|
654569
654776
|
return [];
|
|
654570
654777
|
}
|
|
@@ -654619,10 +654826,10 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
654619
654826
|
}
|
|
654620
654827
|
const copied = [];
|
|
654621
654828
|
for (const relativePath3 of files2) {
|
|
654622
|
-
const srcPath =
|
|
654623
|
-
const destPath =
|
|
654829
|
+
const srcPath = join230(repoRoot, relativePath3);
|
|
654830
|
+
const destPath = join230(worktreePath, relativePath3);
|
|
654624
654831
|
try {
|
|
654625
|
-
await mkdir43(
|
|
654832
|
+
await mkdir43(dirname84(destPath), { recursive: true });
|
|
654626
654833
|
await copyFile10(srcPath, destPath);
|
|
654627
654834
|
copied.push(relativePath3);
|
|
654628
654835
|
} catch (e) {
|
|
@@ -654636,10 +654843,10 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
654636
654843
|
}
|
|
654637
654844
|
async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
654638
654845
|
const localSettingsRelativePath = getRelativeSettingsFilePathForSource("localSettings");
|
|
654639
|
-
const sourceSettingsLocal =
|
|
654846
|
+
const sourceSettingsLocal = join230(repoRoot, localSettingsRelativePath);
|
|
654640
654847
|
try {
|
|
654641
|
-
const destSettingsLocal =
|
|
654642
|
-
await mkdirRecursive(
|
|
654848
|
+
const destSettingsLocal = join230(worktreePath, localSettingsRelativePath);
|
|
654849
|
+
await mkdirRecursive(dirname84(destSettingsLocal));
|
|
654643
654850
|
await copyFile10(sourceSettingsLocal, destSettingsLocal);
|
|
654644
654851
|
logForDebugging(`Copied settings.local.json to worktree: ${destSettingsLocal}`);
|
|
654645
654852
|
} catch (e) {
|
|
@@ -654648,8 +654855,8 @@ async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
|
654648
654855
|
logForDebugging(`Failed to copy settings.local.json: ${e.message}`, { level: "warn" });
|
|
654649
654856
|
}
|
|
654650
654857
|
}
|
|
654651
|
-
const huskyPath =
|
|
654652
|
-
const gitHooksPath =
|
|
654858
|
+
const huskyPath = join230(repoRoot, ".husky");
|
|
654859
|
+
const gitHooksPath = join230(repoRoot, ".git", "hooks");
|
|
654653
654860
|
let hooksPath = null;
|
|
654654
654861
|
for (const candidatePath of [huskyPath, gitHooksPath]) {
|
|
654655
654862
|
try {
|
|
@@ -654924,7 +655131,7 @@ async function cleanupStaleAgentWorktrees(cutoffDate) {
|
|
|
654924
655131
|
if (!EPHEMERAL_WORKTREE_PATTERNS.some((p2) => p2.test(slug5))) {
|
|
654925
655132
|
continue;
|
|
654926
655133
|
}
|
|
654927
|
-
const worktreePath =
|
|
655134
|
+
const worktreePath = join230(dir, slug5);
|
|
654928
655135
|
if (currentPath === worktreePath) {
|
|
654929
655136
|
continue;
|
|
654930
655137
|
}
|
|
@@ -656170,7 +656377,7 @@ function computeFingerprint(messageText2, version3) {
|
|
|
656170
656377
|
}
|
|
656171
656378
|
function computeFingerprintFromMessages(messages) {
|
|
656172
656379
|
const firstMessageText = extractFirstMessageText(messages);
|
|
656173
|
-
return computeFingerprint(firstMessageText, "1.
|
|
656380
|
+
return computeFingerprint(firstMessageText, "1.58.1");
|
|
656174
656381
|
}
|
|
656175
656382
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
656176
656383
|
var init_fingerprint = () => {};
|
|
@@ -658066,7 +658273,7 @@ async function sideQuery(opts) {
|
|
|
658066
658273
|
betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
|
|
658067
658274
|
}
|
|
658068
658275
|
const messageText2 = extractFirstUserMessageText(messages);
|
|
658069
|
-
const fingerprint2 = computeFingerprint(messageText2, "1.
|
|
658276
|
+
const fingerprint2 = computeFingerprint(messageText2, "1.58.1");
|
|
658070
658277
|
const attributionHeader = getAttributionHeader(fingerprint2);
|
|
658071
658278
|
const systemBlocks = [
|
|
658072
658279
|
attributionHeader ? { type: "text", text: attributionHeader } : null,
|
|
@@ -658346,7 +658553,7 @@ import {
|
|
|
658346
658553
|
} from "fs/promises";
|
|
658347
658554
|
import { createServer as createServer6 } from "net";
|
|
658348
658555
|
import { homedir as homedir36, platform as platform6 } from "os";
|
|
658349
|
-
import { join as
|
|
658556
|
+
import { join as join231 } from "path";
|
|
658350
658557
|
function log(message, ...args) {
|
|
658351
658558
|
if (LOG_FILE) {
|
|
658352
658559
|
const timestamp2 = new Date().toISOString();
|
|
@@ -658413,7 +658620,7 @@ class ChromeNativeHost {
|
|
|
658413
658620
|
try {
|
|
658414
658621
|
process.kill(pid, 0);
|
|
658415
658622
|
} catch {
|
|
658416
|
-
await unlink25(
|
|
658623
|
+
await unlink25(join231(socketDir, file4)).catch(() => {});
|
|
658417
658624
|
log(`Removed stale socket for PID ${pid}`);
|
|
658418
658625
|
}
|
|
658419
658626
|
}
|
|
@@ -658684,7 +658891,7 @@ var init_chromeNativeHost = __esm(() => {
|
|
|
658684
658891
|
init_slowOperations();
|
|
658685
658892
|
init_common3();
|
|
658686
658893
|
MAX_MESSAGE_SIZE = 1024 * 1024;
|
|
658687
|
-
LOG_FILE = process.env.USER_TYPE === "ant" ?
|
|
658894
|
+
LOG_FILE = process.env.USER_TYPE === "ant" ? join231(homedir36(), ".ur", "debug", "chrome-native-host.txt") : undefined;
|
|
658688
658895
|
messageSchema = lazySchema(() => exports_external2.object({
|
|
658689
658896
|
type: exports_external2.string()
|
|
658690
658897
|
}).passthrough());
|
|
@@ -661234,7 +661441,7 @@ __export(exports_upstreamproxy, {
|
|
|
661234
661441
|
});
|
|
661235
661442
|
import { mkdir as mkdir45, readFile as readFile54, unlink as unlink26, writeFile as writeFile45 } from "fs/promises";
|
|
661236
661443
|
import { homedir as homedir37 } from "os";
|
|
661237
|
-
import { join as
|
|
661444
|
+
import { join as join232 } from "path";
|
|
661238
661445
|
async function initUpstreamProxy(opts) {
|
|
661239
661446
|
if (!isEnvTruthy(process.env.UR_CODE_REMOTE)) {
|
|
661240
661447
|
return state;
|
|
@@ -661255,7 +661462,7 @@ async function initUpstreamProxy(opts) {
|
|
|
661255
661462
|
}
|
|
661256
661463
|
setNonDumpable();
|
|
661257
661464
|
const baseUrl = opts?.ccrBaseUrl ?? "";
|
|
661258
|
-
const caBundlePath = opts?.caBundlePath ??
|
|
661465
|
+
const caBundlePath = opts?.caBundlePath ?? join232(homedir37(), ".ccr", "ca-bundle.crt");
|
|
661259
661466
|
const caOk = await downloadCaBundle(baseUrl, opts?.systemCaPath ?? SYSTEM_CA_BUNDLE, caBundlePath);
|
|
661260
661467
|
if (!caOk)
|
|
661261
661468
|
return state;
|
|
@@ -661355,7 +661562,7 @@ async function downloadCaBundle(baseUrl, systemCaPath, outPath) {
|
|
|
661355
661562
|
}
|
|
661356
661563
|
const ccrCa = await resp.text();
|
|
661357
661564
|
const systemCa = await readFile54(systemCaPath, "utf8").catch(() => "");
|
|
661358
|
-
await mkdir45(
|
|
661565
|
+
await mkdir45(join232(outPath, ".."), { recursive: true });
|
|
661359
661566
|
await writeFile45(outPath, systemCa + `
|
|
661360
661567
|
` + ccrCa, "utf8");
|
|
661361
661568
|
return true;
|
|
@@ -662837,7 +663044,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
662837
663044
|
slash_commands: inputs.commands.filter((c4) => c4.userInvocable !== false).map((c4) => c4.name),
|
|
662838
663045
|
apiKeySource: getURHQApiKeyWithSource().source,
|
|
662839
663046
|
betas: getSdkBetas(),
|
|
662840
|
-
ur_version: "1.
|
|
663047
|
+
ur_version: "1.58.1",
|
|
662841
663048
|
output_style: outputStyle2,
|
|
662842
663049
|
agents: inputs.agents.map((agent2) => agent2.agentType),
|
|
662843
663050
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill2) => skill2.name),
|
|
@@ -668443,7 +668650,7 @@ var init_ShowInIDEPrompt = __esm(() => {
|
|
|
668443
668650
|
|
|
668444
668651
|
// src/components/permissions/FilePermissionDialog/permissionOptions.tsx
|
|
668445
668652
|
import { homedir as homedir38 } from "os";
|
|
668446
|
-
import { basename as basename57, join as
|
|
668653
|
+
import { basename as basename57, join as join233, sep as sep47 } from "path";
|
|
668447
668654
|
function isInURFolder(filePath) {
|
|
668448
668655
|
const absolutePath = expandPath(filePath);
|
|
668449
668656
|
const urFolderPath = expandPath(`${getOriginalCwd()}/.ur`);
|
|
@@ -668453,7 +668660,7 @@ function isInURFolder(filePath) {
|
|
|
668453
668660
|
}
|
|
668454
668661
|
function isInGlobalURFolder(filePath) {
|
|
668455
668662
|
const absolutePath = expandPath(filePath);
|
|
668456
|
-
const globalURFolderPath =
|
|
668663
|
+
const globalURFolderPath = join233(homedir38(), ".ur");
|
|
668457
668664
|
const normalizedAbsolutePath = normalizeCaseForComparison(absolutePath);
|
|
668458
668665
|
const normalizedGlobalURFolderPath = normalizeCaseForComparison(globalURFolderPath);
|
|
668459
668666
|
return normalizedAbsolutePath.startsWith(normalizedGlobalURFolderPath + sep47.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalURFolderPath + "/");
|
|
@@ -676697,7 +676904,7 @@ var init_useVoiceEnabled = __esm(() => {
|
|
|
676697
676904
|
function getSemverPart(version3) {
|
|
676698
676905
|
return `${import_semver13.major(version3, { loose: true })}.${import_semver13.minor(version3, { loose: true })}.${import_semver13.patch(version3, { loose: true })}`;
|
|
676699
676906
|
}
|
|
676700
|
-
function useUpdateNotification(updatedVersion, initialVersion = "1.
|
|
676907
|
+
function useUpdateNotification(updatedVersion, initialVersion = "1.58.1") {
|
|
676701
676908
|
const [lastNotifiedSemver, setLastNotifiedSemver] = import_react222.useState(() => getSemverPart(initialVersion));
|
|
676702
676909
|
if (!updatedVersion) {
|
|
676703
676910
|
return null;
|
|
@@ -676746,7 +676953,7 @@ function AutoUpdater({
|
|
|
676746
676953
|
return;
|
|
676747
676954
|
}
|
|
676748
676955
|
if (false) {}
|
|
676749
|
-
const currentVersion = "1.
|
|
676956
|
+
const currentVersion = "1.58.1";
|
|
676750
676957
|
const channel = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
676751
676958
|
let latestVersion = await getLatestVersion(channel);
|
|
676752
676959
|
const isDisabled = isAutoUpdaterDisabled();
|
|
@@ -676975,12 +677182,12 @@ function NativeAutoUpdater({
|
|
|
676975
677182
|
logEvent("tengu_native_auto_updater_start", {});
|
|
676976
677183
|
try {
|
|
676977
677184
|
const maxVersion = await getMaxVersion();
|
|
676978
|
-
if (maxVersion && gt("1.
|
|
677185
|
+
if (maxVersion && gt("1.58.1", maxVersion)) {
|
|
676979
677186
|
const msg = await getMaxVersionMessage();
|
|
676980
677187
|
setMaxVersionIssue(msg ?? "affects your version");
|
|
676981
677188
|
}
|
|
676982
677189
|
const result = await installLatest(channel);
|
|
676983
|
-
const currentVersion = "1.
|
|
677190
|
+
const currentVersion = "1.58.1";
|
|
676984
677191
|
const latencyMs = Date.now() - startTime;
|
|
676985
677192
|
if (result.lockFailed) {
|
|
676986
677193
|
logEvent("tengu_native_auto_updater_lock_contention", {
|
|
@@ -677117,17 +677324,17 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
677117
677324
|
const maxVersion = await getMaxVersion();
|
|
677118
677325
|
if (maxVersion && latest && gt(latest, maxVersion)) {
|
|
677119
677326
|
logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
|
|
677120
|
-
if (gte("1.
|
|
677121
|
-
logForDebugging(`PackageManagerAutoUpdater: current version ${"1.
|
|
677327
|
+
if (gte("1.58.1", maxVersion)) {
|
|
677328
|
+
logForDebugging(`PackageManagerAutoUpdater: current version ${"1.58.1"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
677122
677329
|
setUpdateAvailable(false);
|
|
677123
677330
|
return;
|
|
677124
677331
|
}
|
|
677125
677332
|
latest = maxVersion;
|
|
677126
677333
|
}
|
|
677127
|
-
const hasUpdate = latest && !gte("1.
|
|
677334
|
+
const hasUpdate = latest && !gte("1.58.1", latest) && !shouldSkipVersion(latest);
|
|
677128
677335
|
setUpdateAvailable(!!hasUpdate);
|
|
677129
677336
|
if (hasUpdate) {
|
|
677130
|
-
logForDebugging(`PackageManagerAutoUpdater: Update available ${"1.
|
|
677337
|
+
logForDebugging(`PackageManagerAutoUpdater: Update available ${"1.58.1"} -> ${latest}`);
|
|
677131
677338
|
}
|
|
677132
677339
|
};
|
|
677133
677340
|
$2[0] = t1;
|
|
@@ -677161,7 +677368,7 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
677161
677368
|
wrap: "truncate",
|
|
677162
677369
|
children: [
|
|
677163
677370
|
"currentVersion: ",
|
|
677164
|
-
"1.
|
|
677371
|
+
"1.58.1"
|
|
677165
677372
|
]
|
|
677166
677373
|
}, undefined, true, undefined, this);
|
|
677167
677374
|
$2[3] = verbose;
|
|
@@ -687858,7 +688065,7 @@ function buildStatusLineCommandInput(permissionMode, exceeds200kTokens, settings
|
|
|
687858
688065
|
project_dir: getOriginalCwd(),
|
|
687859
688066
|
added_dirs: addedDirs
|
|
687860
688067
|
},
|
|
687861
|
-
version: "1.
|
|
688068
|
+
version: "1.58.1",
|
|
687862
688069
|
output_style: {
|
|
687863
688070
|
name: outputStyleName
|
|
687864
688071
|
},
|
|
@@ -687941,7 +688148,7 @@ function StatusLineInner({
|
|
|
687941
688148
|
const taskValues = Object.values(tasks2);
|
|
687942
688149
|
const taskRunningCount = taskValues.filter((task2) => task2.status === "running" || task2.status === "pending").length;
|
|
687943
688150
|
const defaultStatusLineText = buildDefaultStatusBar({
|
|
687944
|
-
version: "1.
|
|
688151
|
+
version: "1.58.1",
|
|
687945
688152
|
providerLabel: providerRuntime.providerLabel,
|
|
687946
688153
|
authMode: providerRuntime.authLabel,
|
|
687947
688154
|
model: providerRuntime.model ?? renderModelName(mainLoopModel),
|
|
@@ -694226,9 +694433,9 @@ function initSkillImprovement() {
|
|
|
694226
694433
|
async function applySkillImprovement(skillName, updates) {
|
|
694227
694434
|
if (!skillName)
|
|
694228
694435
|
return;
|
|
694229
|
-
const { join:
|
|
694436
|
+
const { join: join234 } = await import("path");
|
|
694230
694437
|
const fs12 = await import("fs/promises");
|
|
694231
|
-
const filePath =
|
|
694438
|
+
const filePath = join234(getCwd(), ".ur", "skills", skillName, "SKILL.md");
|
|
694232
694439
|
let currentContent;
|
|
694233
694440
|
try {
|
|
694234
694441
|
currentContent = await fs12.readFile(filePath, "utf-8");
|
|
@@ -694382,7 +694589,7 @@ function useMoreRight(_args) {
|
|
|
694382
694589
|
// src/utils/cleanup.ts
|
|
694383
694590
|
import * as fs12 from "fs/promises";
|
|
694384
694591
|
import { homedir as homedir39 } from "os";
|
|
694385
|
-
import { join as
|
|
694592
|
+
import { join as join234 } from "path";
|
|
694386
694593
|
function getCutoffDate() {
|
|
694387
694594
|
const settings = getSettings_DEPRECATED() || {};
|
|
694388
694595
|
const cleanupPeriodDays = settings.cleanupPeriodDays ?? DEFAULT_CLEANUP_PERIOD_DAYS;
|
|
@@ -694407,7 +694614,7 @@ async function cleanupOldFilesInDirectory(dirPath, cutoffDate, isMessagePath) {
|
|
|
694407
694614
|
try {
|
|
694408
694615
|
const timestamp2 = convertFileNameToDate(file4.name);
|
|
694409
694616
|
if (timestamp2 < cutoffDate) {
|
|
694410
|
-
await getFsImplementation().unlink(
|
|
694617
|
+
await getFsImplementation().unlink(join234(dirPath, file4.name));
|
|
694411
694618
|
if (isMessagePath) {
|
|
694412
694619
|
result.messages++;
|
|
694413
694620
|
} else {
|
|
@@ -694438,7 +694645,7 @@ async function cleanupOldMessageFiles() {
|
|
|
694438
694645
|
} catch {
|
|
694439
694646
|
return result;
|
|
694440
694647
|
}
|
|
694441
|
-
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) =>
|
|
694648
|
+
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) => join234(baseCachePath, dirent.name));
|
|
694442
694649
|
for (const mcpLogDir of mcpLogDirs) {
|
|
694443
694650
|
result = addCleanupResults(result, await cleanupOldFilesInDirectory(mcpLogDir, cutoffDate, true));
|
|
694444
694651
|
await tryRmdir(mcpLogDir, fsImpl);
|
|
@@ -694477,7 +694684,7 @@ async function cleanupOldSessionFiles() {
|
|
|
694477
694684
|
for (const projectDirent of projectDirents) {
|
|
694478
694685
|
if (!projectDirent.isDirectory())
|
|
694479
694686
|
continue;
|
|
694480
|
-
const projectDir =
|
|
694687
|
+
const projectDir = join234(projectsDir, projectDirent.name);
|
|
694481
694688
|
let entries;
|
|
694482
694689
|
try {
|
|
694483
694690
|
entries = await fsImpl.readdir(projectDir);
|
|
@@ -694491,15 +694698,15 @@ async function cleanupOldSessionFiles() {
|
|
|
694491
694698
|
continue;
|
|
694492
694699
|
}
|
|
694493
694700
|
try {
|
|
694494
|
-
if (await unlinkIfOld(
|
|
694701
|
+
if (await unlinkIfOld(join234(projectDir, entry.name), cutoffDate, fsImpl)) {
|
|
694495
694702
|
result.messages++;
|
|
694496
694703
|
}
|
|
694497
694704
|
} catch {
|
|
694498
694705
|
result.errors++;
|
|
694499
694706
|
}
|
|
694500
694707
|
} else if (entry.isDirectory()) {
|
|
694501
|
-
const sessionDir =
|
|
694502
|
-
const toolResultsDir =
|
|
694708
|
+
const sessionDir = join234(projectDir, entry.name);
|
|
694709
|
+
const toolResultsDir = join234(sessionDir, TOOL_RESULTS_SUBDIR);
|
|
694503
694710
|
let toolDirs;
|
|
694504
694711
|
try {
|
|
694505
694712
|
toolDirs = await fsImpl.readdir(toolResultsDir);
|
|
@@ -694510,14 +694717,14 @@ async function cleanupOldSessionFiles() {
|
|
|
694510
694717
|
for (const toolEntry of toolDirs) {
|
|
694511
694718
|
if (toolEntry.isFile()) {
|
|
694512
694719
|
try {
|
|
694513
|
-
if (await unlinkIfOld(
|
|
694720
|
+
if (await unlinkIfOld(join234(toolResultsDir, toolEntry.name), cutoffDate, fsImpl)) {
|
|
694514
694721
|
result.messages++;
|
|
694515
694722
|
}
|
|
694516
694723
|
} catch {
|
|
694517
694724
|
result.errors++;
|
|
694518
694725
|
}
|
|
694519
694726
|
} else if (toolEntry.isDirectory()) {
|
|
694520
|
-
const toolDirPath =
|
|
694727
|
+
const toolDirPath = join234(toolResultsDir, toolEntry.name);
|
|
694521
694728
|
let toolFiles;
|
|
694522
694729
|
try {
|
|
694523
694730
|
toolFiles = await fsImpl.readdir(toolDirPath);
|
|
@@ -694528,7 +694735,7 @@ async function cleanupOldSessionFiles() {
|
|
|
694528
694735
|
if (!tf.isFile())
|
|
694529
694736
|
continue;
|
|
694530
694737
|
try {
|
|
694531
|
-
if (await unlinkIfOld(
|
|
694738
|
+
if (await unlinkIfOld(join234(toolDirPath, tf.name), cutoffDate, fsImpl)) {
|
|
694532
694739
|
result.messages++;
|
|
694533
694740
|
}
|
|
694534
694741
|
} catch {
|
|
@@ -694560,7 +694767,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
694560
694767
|
if (!dirent.isFile() || !dirent.name.endsWith(extension))
|
|
694561
694768
|
continue;
|
|
694562
694769
|
try {
|
|
694563
|
-
if (await unlinkIfOld(
|
|
694770
|
+
if (await unlinkIfOld(join234(dirPath, dirent.name), cutoffDate, fsImpl)) {
|
|
694564
694771
|
result.messages++;
|
|
694565
694772
|
}
|
|
694566
694773
|
} catch {
|
|
@@ -694573,7 +694780,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
694573
694780
|
return result;
|
|
694574
694781
|
}
|
|
694575
694782
|
function cleanupOldPlanFiles() {
|
|
694576
|
-
const plansDir =
|
|
694783
|
+
const plansDir = join234(getURConfigHomeDir(), "plans");
|
|
694577
694784
|
return cleanupSingleDirectory(plansDir, ".md");
|
|
694578
694785
|
}
|
|
694579
694786
|
async function cleanupOldFileHistoryBackups() {
|
|
@@ -694582,14 +694789,14 @@ async function cleanupOldFileHistoryBackups() {
|
|
|
694582
694789
|
const fsImpl = getFsImplementation();
|
|
694583
694790
|
try {
|
|
694584
694791
|
const configDir = getURConfigHomeDir();
|
|
694585
|
-
const fileHistoryStorageDir =
|
|
694792
|
+
const fileHistoryStorageDir = join234(configDir, "file-history");
|
|
694586
694793
|
let dirents;
|
|
694587
694794
|
try {
|
|
694588
694795
|
dirents = await fsImpl.readdir(fileHistoryStorageDir);
|
|
694589
694796
|
} catch {
|
|
694590
694797
|
return result;
|
|
694591
694798
|
}
|
|
694592
|
-
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
694799
|
+
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join234(fileHistoryStorageDir, dirent.name));
|
|
694593
694800
|
await Promise.all(fileHistorySessionsDirs.map(async (fileHistorySessionDir) => {
|
|
694594
694801
|
try {
|
|
694595
694802
|
const stats2 = await fsImpl.stat(fileHistorySessionDir);
|
|
@@ -694616,14 +694823,14 @@ async function cleanupOldSessionEnvDirs() {
|
|
|
694616
694823
|
const fsImpl = getFsImplementation();
|
|
694617
694824
|
try {
|
|
694618
694825
|
const configDir = getURConfigHomeDir();
|
|
694619
|
-
const sessionEnvBaseDir =
|
|
694826
|
+
const sessionEnvBaseDir = join234(configDir, "session-env");
|
|
694620
694827
|
let dirents;
|
|
694621
694828
|
try {
|
|
694622
694829
|
dirents = await fsImpl.readdir(sessionEnvBaseDir);
|
|
694623
694830
|
} catch {
|
|
694624
694831
|
return result;
|
|
694625
694832
|
}
|
|
694626
|
-
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
694833
|
+
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join234(sessionEnvBaseDir, dirent.name));
|
|
694627
694834
|
for (const sessionEnvDir of sessionEnvDirs) {
|
|
694628
694835
|
try {
|
|
694629
694836
|
const stats2 = await fsImpl.stat(sessionEnvDir);
|
|
@@ -694645,7 +694852,7 @@ async function cleanupOldDebugLogs() {
|
|
|
694645
694852
|
const cutoffDate = getCutoffDate();
|
|
694646
694853
|
const result = { messages: 0, errors: 0 };
|
|
694647
694854
|
const fsImpl = getFsImplementation();
|
|
694648
|
-
const debugDir =
|
|
694855
|
+
const debugDir = join234(getURConfigHomeDir(), "debug");
|
|
694649
694856
|
let dirents;
|
|
694650
694857
|
try {
|
|
694651
694858
|
dirents = await fsImpl.readdir(debugDir);
|
|
@@ -694657,7 +694864,7 @@ async function cleanupOldDebugLogs() {
|
|
|
694657
694864
|
continue;
|
|
694658
694865
|
}
|
|
694659
694866
|
try {
|
|
694660
|
-
if (await unlinkIfOld(
|
|
694867
|
+
if (await unlinkIfOld(join234(debugDir, dirent.name), cutoffDate, fsImpl)) {
|
|
694661
694868
|
result.messages++;
|
|
694662
694869
|
}
|
|
694663
694870
|
} catch {
|
|
@@ -694667,7 +694874,7 @@ async function cleanupOldDebugLogs() {
|
|
|
694667
694874
|
return result;
|
|
694668
694875
|
}
|
|
694669
694876
|
async function cleanupNpmCacheForURHQPackages() {
|
|
694670
|
-
const markerPath =
|
|
694877
|
+
const markerPath = join234(getURConfigHomeDir(), ".npm-cache-cleanup");
|
|
694671
694878
|
try {
|
|
694672
694879
|
const stat48 = await fs12.stat(markerPath);
|
|
694673
694880
|
if (Date.now() - stat48.mtimeMs < ONE_DAY_MS) {
|
|
@@ -694682,7 +694889,7 @@ async function cleanupNpmCacheForURHQPackages() {
|
|
|
694682
694889
|
return;
|
|
694683
694890
|
}
|
|
694684
694891
|
logForDebugging("npm cache cleanup: starting");
|
|
694685
|
-
const npmCachePath =
|
|
694892
|
+
const npmCachePath = join234(homedir39(), ".npm", "_cacache");
|
|
694686
694893
|
const NPM_CACHE_RETENTION_COUNT = 5;
|
|
694687
694894
|
const startTime = Date.now();
|
|
694688
694895
|
try {
|
|
@@ -694737,7 +694944,7 @@ async function cleanupNpmCacheForURHQPackages() {
|
|
|
694737
694944
|
}
|
|
694738
694945
|
}
|
|
694739
694946
|
async function cleanupOldVersionsThrottled() {
|
|
694740
|
-
const markerPath =
|
|
694947
|
+
const markerPath = join234(getURConfigHomeDir(), ".version-cleanup");
|
|
694741
694948
|
try {
|
|
694742
694949
|
const stat48 = await fs12.stat(markerPath);
|
|
694743
694950
|
if (Date.now() - stat48.mtimeMs < ONE_DAY_MS) {
|
|
@@ -698438,7 +698645,7 @@ __export(exports_asciicast, {
|
|
|
698438
698645
|
_resetRecordingStateForTesting: () => _resetRecordingStateForTesting
|
|
698439
698646
|
});
|
|
698440
698647
|
import { appendFile as appendFile7, rename as rename10 } from "fs/promises";
|
|
698441
|
-
import { basename as basename66, dirname as
|
|
698648
|
+
import { basename as basename66, dirname as dirname85, join as join236 } from "path";
|
|
698442
698649
|
function getRecordFilePath() {
|
|
698443
698650
|
if (recordingState.filePath !== null) {
|
|
698444
698651
|
return recordingState.filePath;
|
|
@@ -698449,10 +698656,10 @@ function getRecordFilePath() {
|
|
|
698449
698656
|
if (!isEnvTruthy(process.env.UR_CODE_TERMINAL_RECORDING)) {
|
|
698450
698657
|
return null;
|
|
698451
698658
|
}
|
|
698452
|
-
const projectsDir =
|
|
698453
|
-
const projectDir =
|
|
698659
|
+
const projectsDir = join236(getURConfigHomeDir(), "projects");
|
|
698660
|
+
const projectDir = join236(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
698454
698661
|
recordingState.timestamp = Date.now();
|
|
698455
|
-
recordingState.filePath =
|
|
698662
|
+
recordingState.filePath = join236(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
698456
698663
|
return recordingState.filePath;
|
|
698457
698664
|
}
|
|
698458
698665
|
function _resetRecordingStateForTesting() {
|
|
@@ -698461,13 +698668,13 @@ function _resetRecordingStateForTesting() {
|
|
|
698461
698668
|
}
|
|
698462
698669
|
function getSessionRecordingPaths() {
|
|
698463
698670
|
const sessionId = getSessionId();
|
|
698464
|
-
const projectsDir =
|
|
698465
|
-
const projectDir =
|
|
698671
|
+
const projectsDir = join236(getURConfigHomeDir(), "projects");
|
|
698672
|
+
const projectDir = join236(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
698466
698673
|
try {
|
|
698467
698674
|
const entries = getFsImplementation().readdirSync(projectDir);
|
|
698468
698675
|
const names = typeof entries[0] === "string" ? entries : entries.map((e) => e.name);
|
|
698469
698676
|
const files2 = names.filter((f) => f.startsWith(sessionId) && f.endsWith(".cast")).sort();
|
|
698470
|
-
return files2.map((f) =>
|
|
698677
|
+
return files2.map((f) => join236(projectDir, f));
|
|
698471
698678
|
} catch {
|
|
698472
698679
|
return [];
|
|
698473
698680
|
}
|
|
@@ -698477,9 +698684,9 @@ async function renameRecordingForSession() {
|
|
|
698477
698684
|
if (!oldPath || recordingState.timestamp === 0) {
|
|
698478
698685
|
return;
|
|
698479
698686
|
}
|
|
698480
|
-
const projectsDir =
|
|
698481
|
-
const projectDir =
|
|
698482
|
-
const newPath =
|
|
698687
|
+
const projectsDir = join236(getURConfigHomeDir(), "projects");
|
|
698688
|
+
const projectDir = join236(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
698689
|
+
const newPath = join236(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
698483
698690
|
if (oldPath === newPath) {
|
|
698484
698691
|
return;
|
|
698485
698692
|
}
|
|
@@ -698520,7 +698727,7 @@ function installAsciicastRecorder() {
|
|
|
698520
698727
|
}
|
|
698521
698728
|
});
|
|
698522
698729
|
try {
|
|
698523
|
-
getFsImplementation().mkdirSync(
|
|
698730
|
+
getFsImplementation().mkdirSync(dirname85(filePath));
|
|
698524
698731
|
} catch {}
|
|
698525
698732
|
getFsImplementation().appendFileSync(filePath, header + `
|
|
698526
698733
|
`, { mode: 384 });
|
|
@@ -698589,7 +698796,7 @@ var init_asciicast = __esm(() => {
|
|
|
698589
698796
|
});
|
|
698590
698797
|
|
|
698591
698798
|
// src/utils/sessionRestore.ts
|
|
698592
|
-
import { dirname as
|
|
698799
|
+
import { dirname as dirname86 } from "path";
|
|
698593
698800
|
function extractTodosFromTranscript(messages) {
|
|
698594
698801
|
for (let i3 = messages.length - 1;i3 >= 0; i3--) {
|
|
698595
698802
|
const msg = messages[i3];
|
|
@@ -698714,7 +698921,7 @@ async function processResumedConversation(result, opts, context6) {
|
|
|
698714
698921
|
if (!opts.forkSession) {
|
|
698715
698922
|
const sid = opts.sessionIdOverride ?? result.sessionId;
|
|
698716
698923
|
if (sid) {
|
|
698717
|
-
switchSession(asSessionId(sid), opts.transcriptPath ?
|
|
698924
|
+
switchSession(asSessionId(sid), opts.transcriptPath ? dirname86(opts.transcriptPath) : null);
|
|
698718
698925
|
await renameRecordingForSession();
|
|
698719
698926
|
await resetSessionFilePointer();
|
|
698720
698927
|
restoreCostStateForSession(sid);
|
|
@@ -700084,7 +700291,7 @@ async function submitTranscriptShare(messages, trigger2, appearanceId) {
|
|
|
700084
700291
|
} catch {}
|
|
700085
700292
|
const data = {
|
|
700086
700293
|
trigger: trigger2,
|
|
700087
|
-
version: "1.
|
|
700294
|
+
version: "1.58.1",
|
|
700088
700295
|
platform: process.platform,
|
|
700089
700296
|
transcript,
|
|
700090
700297
|
subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
|
|
@@ -701356,7 +701563,7 @@ var init_useChromeExtensionNotification = __esm(() => {
|
|
|
701356
701563
|
});
|
|
701357
701564
|
|
|
701358
701565
|
// src/utils/plugins/officialMarketplaceStartupCheck.ts
|
|
701359
|
-
import { join as
|
|
701566
|
+
import { join as join237 } from "path";
|
|
701360
701567
|
function isOfficialMarketplaceAutoInstallDisabled() {
|
|
701361
701568
|
return isEnvTruthy(process.env.UR_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL);
|
|
701362
701569
|
}
|
|
@@ -701440,7 +701647,7 @@ async function checkAndInstallOfficialMarketplace() {
|
|
|
701440
701647
|
return { installed: false, skipped: true, reason: "policy_blocked" };
|
|
701441
701648
|
}
|
|
701442
701649
|
const cacheDir = getMarketplacesCacheDir();
|
|
701443
|
-
const installLocation =
|
|
701650
|
+
const installLocation = join237(cacheDir, OFFICIAL_MARKETPLACE_NAME);
|
|
701444
701651
|
const gcsSha = await fetchOfficialMarketplaceFromGcs(installLocation, cacheDir);
|
|
701445
701652
|
if (gcsSha !== null) {
|
|
701446
701653
|
const known = await loadKnownMarketplacesConfig();
|
|
@@ -704423,7 +704630,7 @@ var init_usePluginRecommendationBase = __esm(() => {
|
|
|
704423
704630
|
});
|
|
704424
704631
|
|
|
704425
704632
|
// src/hooks/useLspPluginRecommendation.tsx
|
|
704426
|
-
import { extname as extname25, join as
|
|
704633
|
+
import { extname as extname25, join as join238 } from "path";
|
|
704427
704634
|
function useLspPluginRecommendation() {
|
|
704428
704635
|
const $2 = import_compiler_runtime332.c(12);
|
|
704429
704636
|
const trackedFiles = useAppState(_temp203);
|
|
@@ -704508,7 +704715,7 @@ function useLspPluginRecommendation() {
|
|
|
704508
704715
|
case "yes": {
|
|
704509
704716
|
installPluginAndNotify(pluginId, pluginName, "lsp-plugin", addNotification, async (pluginData) => {
|
|
704510
704717
|
logForDebugging(`[useLspPluginRecommendation] Installing plugin: ${pluginId}`);
|
|
704511
|
-
const localSourcePath = typeof pluginData.entry.source === "string" ?
|
|
704718
|
+
const localSourcePath = typeof pluginData.entry.source === "string" ? join238(pluginData.marketplaceInstallLocation, pluginData.entry.source) : undefined;
|
|
704512
704719
|
await cacheAndRegisterPlugin(pluginId, pluginData.entry, "user", undefined, localSourcePath);
|
|
704513
704720
|
const settings = getSettingsForSource("userSettings");
|
|
704514
704721
|
updateSettingsForSource("userSettings", {
|
|
@@ -707729,7 +707936,7 @@ var exports_REPL = {};
|
|
|
707729
707936
|
__export(exports_REPL, {
|
|
707730
707937
|
REPL: () => REPL
|
|
707731
707938
|
});
|
|
707732
|
-
import { dirname as
|
|
707939
|
+
import { dirname as dirname87, join as join239 } from "path";
|
|
707733
707940
|
import { tmpdir as tmpdir19 } from "os";
|
|
707734
707941
|
import { writeFile as writeFile47 } from "fs/promises";
|
|
707735
707942
|
import { randomUUID as randomUUID76 } from "crypto";
|
|
@@ -708669,7 +708876,7 @@ function REPL({
|
|
|
708669
708876
|
const targetSessionCosts = getStoredSessionCosts(sessionId);
|
|
708670
708877
|
saveCurrentSessionCosts();
|
|
708671
708878
|
resetCostState();
|
|
708672
|
-
switchSession(asSessionId(sessionId), log2.fullPath ?
|
|
708879
|
+
switchSession(asSessionId(sessionId), log2.fullPath ? dirname87(log2.fullPath) : null);
|
|
708673
708880
|
const {
|
|
708674
708881
|
renameRecordingForSession: renameRecordingForSession2
|
|
708675
708882
|
} = await Promise.resolve().then(() => (init_asciicast(), exports_asciicast));
|
|
@@ -710300,7 +710507,7 @@ Note: ctrl + z now suspends UR, ctrl + _ undoes input.
|
|
|
710300
710507
|
const w = Math.max(80, (process.stdout.columns ?? 80) - 6);
|
|
710301
710508
|
const raw = await renderMessagesToPlainText(deferredMessages, tools, w);
|
|
710302
710509
|
const text = raw.replace(/[ \t]+$/gm, "");
|
|
710303
|
-
const path24 =
|
|
710510
|
+
const path24 = join239(tmpdir19(), `cc-transcript-${Date.now()}.txt`);
|
|
710304
710511
|
await writeFile47(path24, text);
|
|
710305
710512
|
const opened = openFileInExternalEditor(path24);
|
|
710306
710513
|
setStatus2(opened ? `opening ${path24}` : `wrote ${path24} \xB7 no $VISUAL/$EDITOR set`);
|
|
@@ -712364,7 +712571,7 @@ function WelcomeV2() {
|
|
|
712364
712571
|
dimColor: true,
|
|
712365
712572
|
children: [
|
|
712366
712573
|
"v",
|
|
712367
|
-
"1.
|
|
712574
|
+
"1.58.1"
|
|
712368
712575
|
]
|
|
712369
712576
|
}, undefined, true, undefined, this)
|
|
712370
712577
|
]
|
|
@@ -713624,7 +713831,7 @@ function completeOnboarding() {
|
|
|
713624
713831
|
saveGlobalConfig((current) => ({
|
|
713625
713832
|
...current,
|
|
713626
713833
|
hasCompletedOnboarding: true,
|
|
713627
|
-
lastOnboardingVersion: "1.
|
|
713834
|
+
lastOnboardingVersion: "1.58.1"
|
|
713628
713835
|
}));
|
|
713629
713836
|
}
|
|
713630
713837
|
function showDialog(root2, renderer) {
|
|
@@ -714768,7 +714975,7 @@ var exports_ResumeConversation = {};
|
|
|
714768
714975
|
__export(exports_ResumeConversation, {
|
|
714769
714976
|
ResumeConversation: () => ResumeConversation
|
|
714770
714977
|
});
|
|
714771
|
-
import { dirname as
|
|
714978
|
+
import { dirname as dirname88 } from "path";
|
|
714772
714979
|
function parsePrIdentifier(value2) {
|
|
714773
714980
|
const directNumber = parseInt(value2, 10);
|
|
714774
714981
|
if (!isNaN(directNumber) && directNumber > 0) {
|
|
@@ -714900,7 +715107,7 @@ function ResumeConversation({
|
|
|
714900
715107
|
}
|
|
714901
715108
|
if (false) {}
|
|
714902
715109
|
if (result_3.sessionId && !forkSession) {
|
|
714903
|
-
switchSession(asSessionId(result_3.sessionId), log_0.fullPath ?
|
|
715110
|
+
switchSession(asSessionId(result_3.sessionId), log_0.fullPath ? dirname88(log_0.fullPath) : null);
|
|
714904
715111
|
await renameRecordingForSession();
|
|
714905
715112
|
await resetSessionFilePointer();
|
|
714906
715113
|
restoreCostStateForSession(result_3.sessionId);
|
|
@@ -718619,12 +718826,12 @@ var init_createDirectConnectSession = __esm(() => {
|
|
|
718619
718826
|
});
|
|
718620
718827
|
|
|
718621
718828
|
// src/utils/errorLogSink.ts
|
|
718622
|
-
import { dirname as
|
|
718829
|
+
import { dirname as dirname89, join as join240 } from "path";
|
|
718623
718830
|
function getErrorsPath() {
|
|
718624
|
-
return
|
|
718831
|
+
return join240(CACHE_PATHS.errors(), DATE + ".jsonl");
|
|
718625
718832
|
}
|
|
718626
718833
|
function getMCPLogsPath(serverName) {
|
|
718627
|
-
return
|
|
718834
|
+
return join240(CACHE_PATHS.mcpLogs(serverName), DATE + ".jsonl");
|
|
718628
718835
|
}
|
|
718629
718836
|
function createJsonlWriter(options4) {
|
|
718630
718837
|
const writer = createBufferedWriter(options4);
|
|
@@ -718640,7 +718847,7 @@ function createJsonlWriter(options4) {
|
|
|
718640
718847
|
function getLogWriter(path24) {
|
|
718641
718848
|
let writer = logWriters.get(path24);
|
|
718642
718849
|
if (!writer) {
|
|
718643
|
-
const dir =
|
|
718850
|
+
const dir = dirname89(path24);
|
|
718644
718851
|
writer = createJsonlWriter({
|
|
718645
718852
|
writeFn: (content) => {
|
|
718646
718853
|
try {
|
|
@@ -718668,7 +718875,7 @@ function appendToLog(path24, message) {
|
|
|
718668
718875
|
cwd: getFsImplementation().cwd(),
|
|
718669
718876
|
userType: process.env.USER_TYPE,
|
|
718670
718877
|
sessionId: getSessionId(),
|
|
718671
|
-
version: "1.
|
|
718878
|
+
version: "1.58.1"
|
|
718672
718879
|
};
|
|
718673
718880
|
getLogWriter(path24).write(messageWithTimestamp);
|
|
718674
718881
|
}
|
|
@@ -718772,12 +718979,12 @@ var exports_setup = {};
|
|
|
718772
718979
|
__export(exports_setup, {
|
|
718773
718980
|
setupComputerUseMCP: () => setupComputerUseMCP
|
|
718774
718981
|
});
|
|
718775
|
-
import { join as
|
|
718982
|
+
import { join as join241 } from "path";
|
|
718776
718983
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
718777
718984
|
function setupComputerUseMCP() {
|
|
718778
718985
|
const allowedTools = buildComputerUseTools(CLI_CU_CAPABILITIES, getChicagoCoordinateMode()).map((t) => buildMcpToolName(COMPUTER_USE_MCP_SERVER_NAME, t.name));
|
|
718779
718986
|
const args = isInBundledMode() ? ["--computer-use-mcp"] : [
|
|
718780
|
-
|
|
718987
|
+
join241(fileURLToPath7(import.meta.url), "..", "cli.js"),
|
|
718781
718988
|
"--computer-use-mcp"
|
|
718782
718989
|
];
|
|
718783
718990
|
return {
|
|
@@ -718999,7 +719206,7 @@ var init_sessionMemory = __esm(() => {
|
|
|
718999
719206
|
// src/utils/iTermBackup.ts
|
|
719000
719207
|
import { copyFile as copyFile11, stat as stat50 } from "fs/promises";
|
|
719001
719208
|
import { homedir as homedir42 } from "os";
|
|
719002
|
-
import { join as
|
|
719209
|
+
import { join as join242 } from "path";
|
|
719003
719210
|
function markITerm2SetupComplete() {
|
|
719004
719211
|
saveGlobalConfig((current) => ({
|
|
719005
719212
|
...current,
|
|
@@ -719014,7 +719221,7 @@ function getIterm2RecoveryInfo() {
|
|
|
719014
719221
|
};
|
|
719015
719222
|
}
|
|
719016
719223
|
function getITerm2PlistPath() {
|
|
719017
|
-
return
|
|
719224
|
+
return join242(homedir42(), "Library", "Preferences", "com.googlecode.iterm2.plist");
|
|
719018
719225
|
}
|
|
719019
719226
|
async function checkAndRestoreITerm2Backup() {
|
|
719020
719227
|
const { inProgress, backupPath } = getIterm2RecoveryInfo();
|
|
@@ -722521,7 +722728,7 @@ var init_idleTimeout = __esm(() => {
|
|
|
722521
722728
|
// src/bridge/inboundAttachments.ts
|
|
722522
722729
|
import { randomUUID as randomUUID79 } from "crypto";
|
|
722523
722730
|
import { mkdir as mkdir46, writeFile as writeFile49 } from "fs/promises";
|
|
722524
|
-
import { basename as basename67, join as
|
|
722731
|
+
import { basename as basename67, join as join243 } from "path";
|
|
722525
722732
|
function debug(msg) {
|
|
722526
722733
|
logForDebugging(`[bridge:inbound-attach] ${msg}`);
|
|
722527
722734
|
}
|
|
@@ -722537,7 +722744,7 @@ function sanitizeFileName(name) {
|
|
|
722537
722744
|
return base2 || "attachment";
|
|
722538
722745
|
}
|
|
722539
722746
|
function uploadsDir() {
|
|
722540
|
-
return
|
|
722747
|
+
return join243(getURConfigHomeDir(), "uploads", getSessionId());
|
|
722541
722748
|
}
|
|
722542
722749
|
async function resolveOne(att) {
|
|
722543
722750
|
const token = getBridgeAccessToken();
|
|
@@ -722566,7 +722773,7 @@ async function resolveOne(att) {
|
|
|
722566
722773
|
const safeName = sanitizeFileName(att.file_name);
|
|
722567
722774
|
const prefix = (att.file_uuid.slice(0, 8) || randomUUID79().slice(0, 8)).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
722568
722775
|
const dir = uploadsDir();
|
|
722569
|
-
const outPath =
|
|
722776
|
+
const outPath = join243(dir, `${prefix}-${safeName}`);
|
|
722570
722777
|
try {
|
|
722571
722778
|
await mkdir46(dir, { recursive: true });
|
|
722572
722779
|
await writeFile49(outPath, data);
|
|
@@ -722666,7 +722873,7 @@ var init_sessionUrl = __esm(() => {
|
|
|
722666
722873
|
|
|
722667
722874
|
// src/utils/plugins/zipCacheAdapters.ts
|
|
722668
722875
|
import { readFile as readFile56 } from "fs/promises";
|
|
722669
|
-
import { join as
|
|
722876
|
+
import { join as join244 } from "path";
|
|
722670
722877
|
async function readZipCacheKnownMarketplaces() {
|
|
722671
722878
|
try {
|
|
722672
722879
|
const content = await readFile56(getZipCacheKnownMarketplacesPath(), "utf-8");
|
|
@@ -722691,13 +722898,13 @@ async function saveMarketplaceJsonToZipCache(marketplaceName, installLocation) {
|
|
|
722691
722898
|
const content = await readMarketplaceJsonContent(installLocation);
|
|
722692
722899
|
if (content !== null) {
|
|
722693
722900
|
const relPath = getMarketplaceJsonRelativePath(marketplaceName);
|
|
722694
|
-
await atomicWriteToZipCache(
|
|
722901
|
+
await atomicWriteToZipCache(join244(zipCachePath, relPath), content);
|
|
722695
722902
|
}
|
|
722696
722903
|
}
|
|
722697
722904
|
async function readMarketplaceJsonContent(dir) {
|
|
722698
722905
|
const candidates2 = [
|
|
722699
|
-
|
|
722700
|
-
|
|
722906
|
+
join244(dir, ".ur-plugin", "marketplace.json"),
|
|
722907
|
+
join244(dir, "marketplace.json"),
|
|
722701
722908
|
dir
|
|
722702
722909
|
];
|
|
722703
722910
|
for (const candidate of candidates2) {
|
|
@@ -722827,8 +723034,8 @@ async function getEnvLessBridgeConfig() {
|
|
|
722827
723034
|
}
|
|
722828
723035
|
async function checkEnvLessBridgeMinVersion() {
|
|
722829
723036
|
const cfg = await getEnvLessBridgeConfig();
|
|
722830
|
-
if (cfg.min_version && lt("1.
|
|
722831
|
-
return `Your version of UR (${"1.
|
|
723037
|
+
if (cfg.min_version && lt("1.58.1", cfg.min_version)) {
|
|
723038
|
+
return `Your version of UR (${"1.58.1"}) is too old for Remote Control.
|
|
722832
723039
|
Version ${cfg.min_version} or higher is required. Run \`ur update\` to update.`;
|
|
722833
723040
|
}
|
|
722834
723041
|
return null;
|
|
@@ -723156,14 +723363,14 @@ __export(exports_bridgePointer, {
|
|
|
723156
723363
|
BRIDGE_POINTER_TTL_MS: () => BRIDGE_POINTER_TTL_MS
|
|
723157
723364
|
});
|
|
723158
723365
|
import { mkdir as mkdir47, readFile as readFile57, stat as stat51, unlink as unlink27, writeFile as writeFile50 } from "fs/promises";
|
|
723159
|
-
import { dirname as
|
|
723366
|
+
import { dirname as dirname90, join as join245 } from "path";
|
|
723160
723367
|
function getBridgePointerPath(dir) {
|
|
723161
|
-
return
|
|
723368
|
+
return join245(getProjectsDir(), sanitizePath2(dir), "bridge-pointer.json");
|
|
723162
723369
|
}
|
|
723163
723370
|
async function writeBridgePointer(dir, pointer) {
|
|
723164
723371
|
const path24 = getBridgePointerPath(dir);
|
|
723165
723372
|
try {
|
|
723166
|
-
await mkdir47(
|
|
723373
|
+
await mkdir47(dirname90(path24), { recursive: true });
|
|
723167
723374
|
await writeFile50(path24, jsonStringify(pointer), "utf8");
|
|
723168
723375
|
logForDebugging(`[bridge:pointer] wrote ${path24}`);
|
|
723169
723376
|
} catch (err2) {
|
|
@@ -723302,7 +723509,7 @@ async function initBridgeCore(params) {
|
|
|
723302
723509
|
const rawApi = createBridgeApiClient({
|
|
723303
723510
|
baseUrl,
|
|
723304
723511
|
getAccessToken,
|
|
723305
|
-
runnerVersion: "1.
|
|
723512
|
+
runnerVersion: "1.58.1",
|
|
723306
723513
|
onDebug: logForDebugging,
|
|
723307
723514
|
onAuth401,
|
|
723308
723515
|
getTrustedDeviceToken
|
|
@@ -725167,7 +725374,7 @@ __export(exports_print, {
|
|
|
725167
725374
|
canBatchWith: () => canBatchWith
|
|
725168
725375
|
});
|
|
725169
725376
|
import { readFile as readFile58, stat as stat52, writeFile as writeFile51 } from "fs/promises";
|
|
725170
|
-
import { dirname as
|
|
725377
|
+
import { dirname as dirname91 } from "path";
|
|
725171
725378
|
import { cwd as cwd2 } from "process";
|
|
725172
725379
|
import { randomUUID as randomUUID82 } from "crypto";
|
|
725173
725380
|
function trackReceivedMessageUuid(uuid3) {
|
|
@@ -727624,7 +727831,7 @@ async function loadInitialMessages(setAppState, options4) {
|
|
|
727624
727831
|
if (false) {}
|
|
727625
727832
|
if (!options4.forkSession) {
|
|
727626
727833
|
if (result.sessionId) {
|
|
727627
|
-
switchSession(asSessionId(result.sessionId), result.fullPath ?
|
|
727834
|
+
switchSession(asSessionId(result.sessionId), result.fullPath ? dirname91(result.fullPath) : null);
|
|
727628
727835
|
if (persistSession) {
|
|
727629
727836
|
await resetSessionFilePointer();
|
|
727630
727837
|
}
|
|
@@ -727722,7 +727929,7 @@ async function loadInitialMessages(setAppState, options4) {
|
|
|
727722
727929
|
}
|
|
727723
727930
|
if (false) {}
|
|
727724
727931
|
if (!options4.forkSession && result.sessionId) {
|
|
727725
|
-
switchSession(asSessionId(result.sessionId), result.fullPath ?
|
|
727932
|
+
switchSession(asSessionId(result.sessionId), result.fullPath ? dirname91(result.fullPath) : null);
|
|
727726
727933
|
if (persistSession) {
|
|
727727
727934
|
await resetSessionFilePointer();
|
|
727728
727935
|
}
|
|
@@ -732778,7 +732985,7 @@ function getAgUiCapabilities() {
|
|
|
732778
732985
|
name: "UR-Nexus",
|
|
732779
732986
|
type: "ur-nexus",
|
|
732780
732987
|
description: "Provider-flexible, local-first autonomous engineering workflow agent.",
|
|
732781
|
-
version: "1.
|
|
732988
|
+
version: "1.58.1",
|
|
732782
732989
|
provider: "UR",
|
|
732783
732990
|
documentationUrl: "https://github.com/Maitham16/UR/blob/master/docs/AG_UI.md"
|
|
732784
732991
|
},
|
|
@@ -733918,7 +734125,7 @@ function createMCPServer(cwd4, debug2, verbose) {
|
|
|
733918
734125
|
};
|
|
733919
734126
|
const server2 = new Server({
|
|
733920
734127
|
name: "ur-nexus",
|
|
733921
|
-
version: "1.
|
|
734128
|
+
version: "1.58.1"
|
|
733922
734129
|
}, {
|
|
733923
734130
|
capabilities: {
|
|
733924
734131
|
tools: {}
|
|
@@ -734078,7 +734285,7 @@ import {
|
|
|
734078
734285
|
unlinkSync as unlinkSync15,
|
|
734079
734286
|
writeFileSync as writeFileSync69
|
|
734080
734287
|
} from "fs";
|
|
734081
|
-
import { join as
|
|
734288
|
+
import { join as join246 } from "path";
|
|
734082
734289
|
function isRecord6(value2) {
|
|
734083
734290
|
return Boolean(value2) && typeof value2 === "object" && !Array.isArray(value2);
|
|
734084
734291
|
}
|
|
@@ -734111,7 +734318,7 @@ function isTask2(value2) {
|
|
|
734111
734318
|
return typeof value2.taskId === "string" && ["working", "input_required", "completed", "failed", "cancelled"].includes(String(value2.status)) && typeof value2.createdAt === "string" && typeof value2.lastUpdatedAt === "string" && Number.isFinite(createdAt) && Number.isFinite(lastUpdatedAt) && (value2.ttlMs === null || typeof value2.ttlMs === "number" && Number.isSafeInteger(value2.ttlMs) && value2.ttlMs >= 0);
|
|
734112
734319
|
}
|
|
734113
734320
|
function taskManifestPath(cwd4) {
|
|
734114
|
-
return
|
|
734321
|
+
return join246(cwd4, ".ur", "mcp-2026", "tasks.json");
|
|
734115
734322
|
}
|
|
734116
734323
|
function quarantineTaskManifest(path24) {
|
|
734117
734324
|
const destination = `${path24}.corrupt.${new Date().toISOString().replaceAll(/[:.]/g, "-")}.${randomUUID85()}`;
|
|
@@ -734125,8 +734332,8 @@ function assertNotSymlink(path24) {
|
|
|
734125
734332
|
}
|
|
734126
734333
|
}
|
|
734127
734334
|
function prepareTaskDirectory(cwd4) {
|
|
734128
|
-
const urDir =
|
|
734129
|
-
const mcpDir =
|
|
734335
|
+
const urDir = join246(cwd4, ".ur");
|
|
734336
|
+
const mcpDir = join246(urDir, "mcp-2026");
|
|
734130
734337
|
assertNotSymlink(urDir);
|
|
734131
734338
|
mkdirSync69(urDir, { recursive: true, mode: 448 });
|
|
734132
734339
|
assertNotSymlink(urDir);
|
|
@@ -735076,7 +735283,7 @@ function thrownResponse(error40) {
|
|
|
735076
735283
|
}
|
|
735077
735284
|
async function createUrMcp2026Runtime(options4) {
|
|
735078
735285
|
const server2 = createMCPServer(options4.cwd, options4.debug === true, options4.verbose === true);
|
|
735079
|
-
const client2 = new Client({ name: "ur-mcp-2026-adapter", version: "1.
|
|
735286
|
+
const client2 = new Client({ name: "ur-mcp-2026-adapter", version: "1.58.1" }, { capabilities: {} });
|
|
735080
735287
|
const [clientTransport, serverTransport] = createLinkedTransportPair();
|
|
735081
735288
|
try {
|
|
735082
735289
|
await server2.connect(serverTransport);
|
|
@@ -735087,7 +735294,7 @@ async function createUrMcp2026Runtime(options4) {
|
|
|
735087
735294
|
}
|
|
735088
735295
|
const runtime2 = new Mcp2026Runtime({
|
|
735089
735296
|
cwd: options4.cwd,
|
|
735090
|
-
version: "1.
|
|
735297
|
+
version: "1.58.1",
|
|
735091
735298
|
backend: {
|
|
735092
735299
|
listTools: async () => {
|
|
735093
735300
|
const listed = await client2.listTools();
|
|
@@ -735270,14 +735477,14 @@ __export(exports_urDesktop, {
|
|
|
735270
735477
|
});
|
|
735271
735478
|
import { readdir as readdir33, readFile as readFile59, stat as stat54 } from "fs/promises";
|
|
735272
735479
|
import { homedir as homedir43 } from "os";
|
|
735273
|
-
import { join as
|
|
735480
|
+
import { join as join247 } from "path";
|
|
735274
735481
|
async function getURDesktopConfigPath() {
|
|
735275
735482
|
const platform7 = getPlatform();
|
|
735276
735483
|
if (!SUPPORTED_PLATFORMS.includes(platform7)) {
|
|
735277
735484
|
throw new Error(`Unsupported platform: ${platform7} - UR Desktop integration only works on macOS and WSL.`);
|
|
735278
735485
|
}
|
|
735279
735486
|
if (platform7 === "macos") {
|
|
735280
|
-
return
|
|
735487
|
+
return join247(homedir43(), "Library", "Application Support", "UR", "ur_desktop_config.json");
|
|
735281
735488
|
}
|
|
735282
735489
|
const windowsHome = process.env.USERPROFILE ? process.env.USERPROFILE.replace(/\\/g, "/") : null;
|
|
735283
735490
|
if (windowsHome) {
|
|
@@ -735296,7 +735503,7 @@ async function getURDesktopConfigPath() {
|
|
|
735296
735503
|
if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
|
|
735297
735504
|
continue;
|
|
735298
735505
|
}
|
|
735299
|
-
const potentialConfigPath =
|
|
735506
|
+
const potentialConfigPath = join247(usersDir, user.name, "AppData", "Roaming", "UR", "ur_desktop_config.json");
|
|
735300
735507
|
try {
|
|
735301
735508
|
await stat54(potentialConfigPath);
|
|
735302
735509
|
return potentialConfigPath;
|
|
@@ -735890,10 +736097,10 @@ var init_providers2 = __esm(() => {
|
|
|
735890
736097
|
});
|
|
735891
736098
|
|
|
735892
736099
|
// src/utils/plugins/pluginDoctor.ts
|
|
735893
|
-
import { existsSync as existsSync99, readdirSync as
|
|
735894
|
-
import { basename as basename68, join as
|
|
736100
|
+
import { existsSync as existsSync99, readdirSync as readdirSync35, readFileSync as readFileSync88, statSync as statSync32 } from "fs";
|
|
736101
|
+
import { basename as basename68, join as join248 } from "path";
|
|
735895
736102
|
function manifestPathFor2(dir) {
|
|
735896
|
-
const p2 =
|
|
736103
|
+
const p2 = join248(dir, ".ur-plugin", "plugin.json");
|
|
735897
736104
|
return existsSync99(p2) ? p2 : null;
|
|
735898
736105
|
}
|
|
735899
736106
|
function discoverPluginDirs(roots) {
|
|
@@ -735914,12 +736121,12 @@ function discoverPluginDirs(roots) {
|
|
|
735914
736121
|
}
|
|
735915
736122
|
let entries = [];
|
|
735916
736123
|
try {
|
|
735917
|
-
entries =
|
|
736124
|
+
entries = readdirSync35(root2);
|
|
735918
736125
|
} catch {
|
|
735919
736126
|
continue;
|
|
735920
736127
|
}
|
|
735921
736128
|
for (const entry of entries) {
|
|
735922
|
-
const full =
|
|
736129
|
+
const full = join248(root2, entry);
|
|
735923
736130
|
try {
|
|
735924
736131
|
if (statSync32(full).isDirectory() && manifestPathFor2(full))
|
|
735925
736132
|
add(full);
|
|
@@ -736050,7 +736257,7 @@ __export(exports_plugins, {
|
|
|
736050
736257
|
VALID_UPDATE_SCOPES: () => VALID_UPDATE_SCOPES,
|
|
736051
736258
|
VALID_INSTALLABLE_SCOPES: () => VALID_INSTALLABLE_SCOPES
|
|
736052
736259
|
});
|
|
736053
|
-
import { basename as basename69, dirname as
|
|
736260
|
+
import { basename as basename69, dirname as dirname93, join as join249, resolve as resolve72 } from "path";
|
|
736054
736261
|
function handleMarketplaceError(error40, action3) {
|
|
736055
736262
|
logError2(error40);
|
|
736056
736263
|
cliError(`${figures_default.cross} Failed to ${action3}: ${errorMessage2(error40)}`);
|
|
@@ -736077,7 +736284,7 @@ async function pluginDoctorHandler(options4) {
|
|
|
736077
736284
|
const roots = [];
|
|
736078
736285
|
if (options4.path)
|
|
736079
736286
|
roots.push(resolve72(options4.path));
|
|
736080
|
-
roots.push(
|
|
736287
|
+
roots.push(join249(process.cwd(), ".ur", "plugins"));
|
|
736081
736288
|
try {
|
|
736082
736289
|
const data = loadInstalledPluginsV2();
|
|
736083
736290
|
for (const installations of Object.values(data.plugins ?? {})) {
|
|
@@ -736103,9 +736310,9 @@ async function pluginValidateHandler(manifestPath6, options4) {
|
|
|
736103
736310
|
printValidationResult(result);
|
|
736104
736311
|
let contentResults = [];
|
|
736105
736312
|
if (result.fileType === "plugin") {
|
|
736106
|
-
const manifestDir =
|
|
736313
|
+
const manifestDir = dirname93(result.filePath);
|
|
736107
736314
|
if (basename69(manifestDir) === ".ur-plugin") {
|
|
736108
|
-
contentResults = await validatePluginContents(
|
|
736315
|
+
contentResults = await validatePluginContents(dirname93(manifestDir));
|
|
736109
736316
|
for (const r of contentResults) {
|
|
736110
736317
|
console.log(`Validating ${r.fileType}: ${r.filePath}
|
|
736111
736318
|
`);
|
|
@@ -736584,12 +736791,12 @@ __export(exports_install, {
|
|
|
736584
736791
|
install: () => install
|
|
736585
736792
|
});
|
|
736586
736793
|
import { homedir as homedir44 } from "os";
|
|
736587
|
-
import { join as
|
|
736794
|
+
import { join as join250 } from "path";
|
|
736588
736795
|
function getInstallationPath2() {
|
|
736589
736796
|
const isWindows2 = env2.platform === "win32";
|
|
736590
736797
|
const homeDir = homedir44();
|
|
736591
736798
|
if (isWindows2) {
|
|
736592
|
-
const windowsPath =
|
|
736799
|
+
const windowsPath = join250(homeDir, ".local", "bin", "ur.exe");
|
|
736593
736800
|
return windowsPath.replace(/\//g, "\\");
|
|
736594
736801
|
}
|
|
736595
736802
|
return "~/.local/bin/ur";
|
|
@@ -737220,7 +737427,7 @@ async function update() {
|
|
|
737220
737427
|
logEvent("tengu_update_check", {});
|
|
737221
737428
|
const diagnostic2 = await getDoctorDiagnostic();
|
|
737222
737429
|
const result = await checkUpgradeStatus({
|
|
737223
|
-
currentVersion: "1.
|
|
737430
|
+
currentVersion: "1.58.1",
|
|
737224
737431
|
packageName: UR_AGENT_PACKAGE_NAME,
|
|
737225
737432
|
installationType: diagnostic2.installationType,
|
|
737226
737433
|
latestVersion: () => getLatestNpmPackageVersion(UR_AGENT_PACKAGE_NAME)
|
|
@@ -738536,7 +738743,7 @@ ${customInstructions}` : customInstructions;
|
|
|
738536
738743
|
}
|
|
738537
738744
|
}
|
|
738538
738745
|
logForDiagnosticsNoPII("info", "started", {
|
|
738539
|
-
version: "1.
|
|
738746
|
+
version: "1.58.1",
|
|
738540
738747
|
is_native_binary: isInBundledMode()
|
|
738541
738748
|
});
|
|
738542
738749
|
registerCleanup(async () => {
|
|
@@ -739322,7 +739529,7 @@ Usage: ur --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
739322
739529
|
pendingHookMessages
|
|
739323
739530
|
}, renderAndRun);
|
|
739324
739531
|
}
|
|
739325
|
-
}).version("1.
|
|
739532
|
+
}).version("1.58.1 (UR-Nexus)", "-v, --version", "Output the version number");
|
|
739326
739533
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
739327
739534
|
program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
739328
739535
|
if (canUserConfigureAdvisor()) {
|
|
@@ -739758,8 +739965,9 @@ Usage: ur --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
739758
739965
|
const cmdArgs = [action3 ? quoteLocalCommandArg(action3) : undefined, name ? quoteLocalCommandArg(name) : undefined, ...args.map(quoteLocalCommandArg), opts.dryRun ? "--dry-run" : undefined, opts.maxTurns ? `--max-turns ${quoteLocalCommandArg(opts.maxTurns)}` : undefined, opts.skipPermissions ? "--skip-permissions" : undefined, opts.json ? "--json" : undefined].filter(Boolean).join(" ");
|
|
739759
739966
|
await runLocalTextCommand(() => Promise.resolve().then(() => (init_skill(), exports_skill)), cmdArgs);
|
|
739760
739967
|
});
|
|
739761
|
-
program2.command("agent-inspect").alias("inspect-agents").description("Reconstruct a per-subagent timeline from a session transcript").option("--file <path>", "Transcript JSONL or JSON file").option("--json", "Output as JSON").action(async (opts) => {
|
|
739762
|
-
const
|
|
739968
|
+
program2.command("agent-inspect").alias("inspect-agents").description("Reconstruct a per-subagent timeline from a session transcript").option("--file <path>", "Transcript JSONL or JSON file").option("--costs [dir]", "Per-agent token/cost breakdown from the session subagents directory").option("--json", "Output as JSON").action(async (opts) => {
|
|
739969
|
+
const costs = opts.costs === true ? "--costs" : typeof opts.costs === "string" ? `--costs ${quoteLocalCommandArg(opts.costs)}` : undefined;
|
|
739970
|
+
const args = [opts.file ? `--file ${quoteLocalCommandArg(opts.file)}` : undefined, costs, opts.json ? "--json" : undefined].filter(Boolean).join(" ");
|
|
739763
739971
|
await runLocalTextCommand(() => Promise.resolve().then(() => (init_agent_inspect(), exports_agent_inspect)), args);
|
|
739764
739972
|
});
|
|
739765
739973
|
program2.command("route [task...]").alias("intent").description("Classify a task and recommend the best subagent and collaboration pattern").option("--json", "Output as JSON").action(async (task2 = [], opts) => {
|
|
@@ -740357,7 +740565,7 @@ if (false) {}
|
|
|
740357
740565
|
async function main2() {
|
|
740358
740566
|
const args = process.argv.slice(2);
|
|
740359
740567
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
740360
|
-
console.log(`${"1.
|
|
740568
|
+
console.log(`${"1.58.1"} (UR-Nexus)`);
|
|
740361
740569
|
return;
|
|
740362
740570
|
}
|
|
740363
740571
|
if (args[0] === "a2a" && args[1] === "serve" && !args.includes("--help") && !args.includes("-h")) {
|