replicas-engine 0.1.421 → 0.1.423
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/src/index.js +184 -57
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -87,6 +87,7 @@ Token refresh managers may later overwrite credential files in place:
|
|
|
87
87
|
- `~/.git-credentials`
|
|
88
88
|
- `~/.claude/.credentials.json`
|
|
89
89
|
- `~/.codex/auth.json`
|
|
90
|
+
- `~/.replicas/infisical-env.sh` and `~/workspaces/.infisical.json`
|
|
90
91
|
|
|
91
92
|
Engine persistence locations:
|
|
92
93
|
|
|
@@ -131,3 +132,4 @@ Outgoing endpoints:
|
|
|
131
132
|
- `POST /v1/engine/github/refresh-token`
|
|
132
133
|
- `POST /v1/engine/claude/refresh-credentials`
|
|
133
134
|
- `POST /v1/engine/codex/refresh-credentials`
|
|
135
|
+
- `POST /v1/engine/infisical/refresh-token`
|
package/dist/src/index.js
CHANGED
|
@@ -508,9 +508,12 @@ var WORKSPACE_SIZES = ["small", "large"];
|
|
|
508
508
|
var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
|
|
509
509
|
|
|
510
510
|
// ../shared/src/e2b.ts
|
|
511
|
-
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-10-
|
|
511
|
+
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-10-v4";
|
|
512
512
|
|
|
513
513
|
// ../shared/src/runtime-env.ts
|
|
514
|
+
function shellQuotePosix(value) {
|
|
515
|
+
return `'${value.split("'").join("'\\''")}'`;
|
|
516
|
+
}
|
|
514
517
|
function parsePosixEnvFile(content) {
|
|
515
518
|
const result = {};
|
|
516
519
|
let pos = 0;
|
|
@@ -1169,18 +1172,19 @@ var GITLAB_ABILITY = {
|
|
|
1169
1172
|
};
|
|
1170
1173
|
|
|
1171
1174
|
// ../shared/src/default-skills/replicas-agent/abilities/google.ts
|
|
1172
|
-
var SECTION5 = `### Google Workspace
|
|
1173
|
-
Create and edit Google Docs, Sheets, and Forms
|
|
1175
|
+
var SECTION5 = `### Google Workspace and Search Console
|
|
1176
|
+
Create and edit Google Docs, Sheets, and Forms, and read Google Search Console data via the Replicas gateway. Drive access is limited to files created by Replicas.
|
|
1174
1177
|
|
|
1175
1178
|
**Reference:** \`references/GOOGLE.md\`
|
|
1176
1179
|
|
|
1177
1180
|
Use this when:
|
|
1178
1181
|
- You need to create or edit a Google Doc, Sheet, or Form
|
|
1179
1182
|
- You need to share, rename, move, or delete a Replicas-created Google file
|
|
1180
|
-
- You need to read responses from a Replicas-created Google Form
|
|
1181
|
-
|
|
1183
|
+
- You need to read responses from a Replicas-created Google Form
|
|
1184
|
+
- You need to list Search Console properties, query search performance, read sitemaps, or inspect an indexed URL`;
|
|
1185
|
+
var REFERENCE5 = `# Google Workspace and Search Console
|
|
1182
1186
|
|
|
1183
|
-
This guide covers how to create and edit Google Docs, Sheets, and Forms
|
|
1187
|
+
This guide covers how to create and edit Google Docs, Sheets, and Forms, perform basic Drive file operations, and read Google Search Console data from inside a Replicas workspace using the monolith as a gateway to Google's APIs.
|
|
1184
1188
|
|
|
1185
1189
|
## Prerequisites
|
|
1186
1190
|
|
|
@@ -1429,6 +1433,62 @@ curl -s "$MONOLITH_URL/v1/gdrive/files?pageSize=50" "\${GDRIVE_AUTH[@]}"
|
|
|
1429
1433
|
|
|
1430
1434
|
Pass \`?q=...\` to filter using [Drive API search syntax](https://developers.google.com/workspace/drive/api/guides/search-files). Only files the app created or was granted access to will appear.
|
|
1431
1435
|
|
|
1436
|
+
## Google Search Console (read-only)
|
|
1437
|
+
|
|
1438
|
+
Search Console access uses the \`webmasters.readonly\` scope. The connected Google account must have access to the requested property. If the account was connected before this scope was added, reconnect it in **Settings \u2192 Integrations \u2192 Google** first.
|
|
1439
|
+
|
|
1440
|
+
Property identifiers must be URL-encoded as query parameters. URL-prefix properties include the trailing slash (for example, \`https://example.com/\`); Domain properties use \`sc-domain:example.com\`.
|
|
1441
|
+
|
|
1442
|
+
### List accessible properties
|
|
1443
|
+
|
|
1444
|
+
\`\`\`bash
|
|
1445
|
+
curl -s "$MONOLITH_URL/v1/gdrive/search-console/sites" "\${GDRIVE_AUTH[@]}"
|
|
1446
|
+
\`\`\`
|
|
1447
|
+
|
|
1448
|
+
### Get a property
|
|
1449
|
+
|
|
1450
|
+
\`\`\`bash
|
|
1451
|
+
SITE_URL=$(printf %s 'sc-domain:example.com' | jq -sRr @uri)
|
|
1452
|
+
curl -s "$MONOLITH_URL/v1/gdrive/search-console/site?siteUrl=$SITE_URL" "\${GDRIVE_AUTH[@]}"
|
|
1453
|
+
\`\`\`
|
|
1454
|
+
|
|
1455
|
+
### Query search performance
|
|
1456
|
+
|
|
1457
|
+
\`\`\`bash
|
|
1458
|
+
curl -s -X POST "$MONOLITH_URL/v1/gdrive/search-console/search-analytics/query?siteUrl=$SITE_URL" "\${GDRIVE_AUTH[@]}" \\
|
|
1459
|
+
-H "Content-Type: application/json" \\
|
|
1460
|
+
-d '{
|
|
1461
|
+
"startDate": "2026-06-01",
|
|
1462
|
+
"endDate": "2026-06-30",
|
|
1463
|
+
"dimensions": ["query", "page"],
|
|
1464
|
+
"rowLimit": 1000
|
|
1465
|
+
}'
|
|
1466
|
+
\`\`\`
|
|
1467
|
+
|
|
1468
|
+
Results contain clicks, impressions, CTR, and average position. Use \`startRow\` with \`rowLimit\` to paginate; Google returns at most 25,000 rows per request.
|
|
1469
|
+
|
|
1470
|
+
### List sitemaps
|
|
1471
|
+
|
|
1472
|
+
\`\`\`bash
|
|
1473
|
+
curl -s "$MONOLITH_URL/v1/gdrive/search-console/sitemaps?siteUrl=$SITE_URL" "\${GDRIVE_AUTH[@]}"
|
|
1474
|
+
\`\`\`
|
|
1475
|
+
|
|
1476
|
+
Pass a URL-encoded \`sitemapIndex\` query parameter to list sitemaps referenced by a sitemap index. To fetch one sitemap, call \`/v1/gdrive/search-console/sitemap\` with URL-encoded \`siteUrl\` and \`feedpath\` query parameters.
|
|
1477
|
+
|
|
1478
|
+
### Inspect an indexed URL
|
|
1479
|
+
|
|
1480
|
+
\`\`\`bash
|
|
1481
|
+
curl -s -X POST "$MONOLITH_URL/v1/gdrive/search-console/url-inspection" "\${GDRIVE_AUTH[@]}" \\
|
|
1482
|
+
-H "Content-Type: application/json" \\
|
|
1483
|
+
-d '{
|
|
1484
|
+
"inspectionUrl": "https://example.com/page",
|
|
1485
|
+
"siteUrl": "sc-domain:example.com",
|
|
1486
|
+
"languageCode": "en-US"
|
|
1487
|
+
}'
|
|
1488
|
+
\`\`\`
|
|
1489
|
+
|
|
1490
|
+
URL Inspection reports the version currently in Google's index; it does not run a live URL test.
|
|
1491
|
+
|
|
1432
1492
|
## Tips
|
|
1433
1493
|
|
|
1434
1494
|
- **Always return the \`webViewLink\`** to the user when you create or edit a file so they can open it. Get it from \`/v1/gdrive/files/$FILE_ID?fields=webViewLink\` or from \`documents.documentId\` \u2192 \`https://docs.google.com/document/d/$ID/edit\`.
|
|
@@ -1436,9 +1496,9 @@ Pass \`?q=...\` to filter using [Drive API search syntax](https://developers.goo
|
|
|
1436
1496
|
- **Watch error responses.** A 412 from the gateway means the org has no Google credentials connected \u2014 tell the user to connect Google in the dashboard. Other 4xx responses come straight from Google and usually explain the issue clearly.
|
|
1437
1497
|
`;
|
|
1438
1498
|
var GOOGLE_ABILITY = {
|
|
1439
|
-
label: "Google
|
|
1440
|
-
description: "
|
|
1441
|
-
bullet: "- Interacting with Google Workspace
|
|
1499
|
+
label: "Google",
|
|
1500
|
+
description: "Use Google Workspace and read Search Console data via the Replicas gateway.",
|
|
1501
|
+
bullet: "- Interacting with Google Workspace or Search Console (Docs, Sheets, Forms, Drive files, search performance, sitemaps, and URL inspection)",
|
|
1442
1502
|
section: SECTION5,
|
|
1443
1503
|
referenceFile: { name: "GOOGLE.md", content: REFERENCE5 }
|
|
1444
1504
|
};
|
|
@@ -3311,18 +3371,13 @@ var BaseRefreshManager = class {
|
|
|
3311
3371
|
}
|
|
3312
3372
|
}
|
|
3313
3373
|
}
|
|
3314
|
-
this.
|
|
3315
|
-
this.refreshOnce().catch((error) => {
|
|
3316
|
-
console.error(`[${this.managerName}] Scheduled refresh failed:`, error);
|
|
3317
|
-
});
|
|
3318
|
-
}, this.intervalMs);
|
|
3319
|
-
console.log(`[${this.managerName}] Token refresh scheduled every ${Math.round(this.intervalMs / 6e4)} minutes`);
|
|
3374
|
+
this.scheduleNextRefresh();
|
|
3320
3375
|
}
|
|
3321
3376
|
stop() {
|
|
3322
3377
|
if (!this.intervalHandle) {
|
|
3323
3378
|
return;
|
|
3324
3379
|
}
|
|
3325
|
-
|
|
3380
|
+
clearTimeout(this.intervalHandle);
|
|
3326
3381
|
this.intervalHandle = null;
|
|
3327
3382
|
this.health.isRunning = false;
|
|
3328
3383
|
console.log(`[${this.managerName}] Stopped`);
|
|
@@ -3333,6 +3388,9 @@ var BaseRefreshManager = class {
|
|
|
3333
3388
|
getSkipReason() {
|
|
3334
3389
|
return null;
|
|
3335
3390
|
}
|
|
3391
|
+
getNextRefreshDelayMs() {
|
|
3392
|
+
return this.intervalMs;
|
|
3393
|
+
}
|
|
3336
3394
|
getRuntimeConfig() {
|
|
3337
3395
|
if (!ENGINE_ENV.WORKSPACE_ID) {
|
|
3338
3396
|
return null;
|
|
@@ -3343,6 +3401,15 @@ var BaseRefreshManager = class {
|
|
|
3343
3401
|
engineSecret: ENGINE_ENV.REPLICAS_ENGINE_SECRET
|
|
3344
3402
|
};
|
|
3345
3403
|
}
|
|
3404
|
+
scheduleNextRefresh() {
|
|
3405
|
+
const delayMs = this.getNextRefreshDelayMs();
|
|
3406
|
+
this.health.intervalMs = delayMs;
|
|
3407
|
+
this.intervalHandle = setTimeout(async () => {
|
|
3408
|
+
await this.refreshOnce();
|
|
3409
|
+
if (this.intervalHandle) this.scheduleNextRefresh();
|
|
3410
|
+
}, delayMs);
|
|
3411
|
+
console.log(`[${this.managerName}] Token refresh scheduled in ${Math.round(delayMs / 1e3)} seconds`);
|
|
3412
|
+
}
|
|
3346
3413
|
async refreshOnce() {
|
|
3347
3414
|
if (this.getSkipReason()) {
|
|
3348
3415
|
return;
|
|
@@ -3365,7 +3432,7 @@ var BaseRefreshManager = class {
|
|
|
3365
3432
|
};
|
|
3366
3433
|
|
|
3367
3434
|
// src/services/monolith-service.ts
|
|
3368
|
-
async function monolithRequest(
|
|
3435
|
+
async function monolithRequest(path6, init = {}) {
|
|
3369
3436
|
if (!ENGINE_ENV.WORKSPACE_ID) {
|
|
3370
3437
|
throw new Error("WORKSPACE_ID is not set; cannot call monolith");
|
|
3371
3438
|
}
|
|
@@ -3375,7 +3442,7 @@ async function monolithRequest(path5, init = {}) {
|
|
|
3375
3442
|
"X-Workspace-Id": ENGINE_ENV.WORKSPACE_ID
|
|
3376
3443
|
};
|
|
3377
3444
|
if (!isFormData) headers["Content-Type"] = "application/json";
|
|
3378
|
-
return fetch(`${ENGINE_ENV.MONOLITH_URL}${
|
|
3445
|
+
return fetch(`${ENGINE_ENV.MONOLITH_URL}${path6}`, {
|
|
3379
3446
|
method: init.method ?? "POST",
|
|
3380
3447
|
headers,
|
|
3381
3448
|
body: init.body === void 0 ? void 0 : isFormData ? init.body : JSON.stringify(init.body),
|
|
@@ -3418,11 +3485,11 @@ var AsyncLock = class {
|
|
|
3418
3485
|
};
|
|
3419
3486
|
|
|
3420
3487
|
// src/utils/file.ts
|
|
3421
|
-
async function atomicWriteFile(
|
|
3422
|
-
const tmpFile = `${
|
|
3488
|
+
async function atomicWriteFile(path6, data, options) {
|
|
3489
|
+
const tmpFile = `${path6}.${process.pid}.${Date.now()}.tmp`;
|
|
3423
3490
|
try {
|
|
3424
3491
|
await writeFile(tmpFile, data, { encoding: "utf-8", mode: options?.mode });
|
|
3425
|
-
await rename(tmpFile,
|
|
3492
|
+
await rename(tmpFile, path6);
|
|
3426
3493
|
} catch (error) {
|
|
3427
3494
|
await unlink(tmpFile).catch(() => void 0);
|
|
3428
3495
|
throw error;
|
|
@@ -3805,6 +3872,64 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
3805
3872
|
};
|
|
3806
3873
|
var codexTokenManager = new CodexTokenManager();
|
|
3807
3874
|
|
|
3875
|
+
// src/managers/infisical-token-manager.ts
|
|
3876
|
+
import { rm } from "fs/promises";
|
|
3877
|
+
import path5 from "path";
|
|
3878
|
+
var InfisicalTokenManager = class extends BaseRefreshManager {
|
|
3879
|
+
constructor(request = monolithRequest, paths = {
|
|
3880
|
+
homeDir: ENGINE_ENV.HOME_DIR,
|
|
3881
|
+
workspaceRoot: ENGINE_ENV.WORKSPACE_ROOT
|
|
3882
|
+
}, applyCredentials = applyInfisicalCredentials) {
|
|
3883
|
+
super("InfisicalTokenManager", 5 * 60 * 1e3);
|
|
3884
|
+
this.request = request;
|
|
3885
|
+
this.paths = paths;
|
|
3886
|
+
this.applyCredentials = applyCredentials;
|
|
3887
|
+
}
|
|
3888
|
+
request;
|
|
3889
|
+
paths;
|
|
3890
|
+
applyCredentials;
|
|
3891
|
+
nextRefreshDelayMs = 5 * 60 * 1e3;
|
|
3892
|
+
async doRefresh(_config) {
|
|
3893
|
+
const response = await this.request("/v1/engine/infisical/refresh-token");
|
|
3894
|
+
if (!response.ok) throw new Error(`Token refresh failed: ${response.status} ${await response.text()}`);
|
|
3895
|
+
const data = await response.json();
|
|
3896
|
+
await this.applyCredentials(data, this.paths);
|
|
3897
|
+
const ttlMs = data.configured ? Date.parse(data.expiresAt) - Date.now() : Number.NaN;
|
|
3898
|
+
this.nextRefreshDelayMs = Number.isFinite(ttlMs) ? Math.max(1e3, Math.min(5 * 60 * 1e3, Math.floor(ttlMs * 0.8))) : 5 * 60 * 1e3;
|
|
3899
|
+
}
|
|
3900
|
+
getNextRefreshDelayMs() {
|
|
3901
|
+
return this.nextRefreshDelayMs;
|
|
3902
|
+
}
|
|
3903
|
+
};
|
|
3904
|
+
async function applyInfisicalCredentials(data, paths) {
|
|
3905
|
+
const credentialPath = path5.join(paths.homeDir, ".replicas", "infisical-env.sh");
|
|
3906
|
+
const configPath = path5.join(paths.workspaceRoot, ".infisical.json");
|
|
3907
|
+
if (!data.configured) {
|
|
3908
|
+
delete process.env.INFISICAL_TOKEN;
|
|
3909
|
+
delete process.env.INFISICAL_DOMAIN;
|
|
3910
|
+
await Promise.all([rm(credentialPath, { force: true }), rm(configPath, { force: true })]);
|
|
3911
|
+
return;
|
|
3912
|
+
}
|
|
3913
|
+
process.env.INFISICAL_TOKEN = data.token;
|
|
3914
|
+
process.env.INFISICAL_DOMAIN = data.siteUrl;
|
|
3915
|
+
await Promise.all([
|
|
3916
|
+
writeSecureCredentialFile(credentialPath, [
|
|
3917
|
+
`export INFISICAL_TOKEN=${shellQuotePosix(data.token)}`,
|
|
3918
|
+
`export INFISICAL_DOMAIN=${shellQuotePosix(data.siteUrl)}`,
|
|
3919
|
+
"export INFISICAL_DISABLE_UPDATE_CHECK=true",
|
|
3920
|
+
""
|
|
3921
|
+
].join("\n"), { ensureParentDir: true }),
|
|
3922
|
+
writeSecureCredentialFile(configPath, `${JSON.stringify({
|
|
3923
|
+
workspaceId: data.projectId,
|
|
3924
|
+
defaultEnvironment: data.environment,
|
|
3925
|
+
gitBranchToEnvironmentMapping: null,
|
|
3926
|
+
domain: data.siteUrl
|
|
3927
|
+
}, null, 2)}
|
|
3928
|
+
`, { ensureParentDir: true })
|
|
3929
|
+
]);
|
|
3930
|
+
}
|
|
3931
|
+
var infisicalTokenManager = new InfisicalTokenManager();
|
|
3932
|
+
|
|
3808
3933
|
// src/git/service.ts
|
|
3809
3934
|
import { readdir, readFile as readFile3, stat } from "fs/promises";
|
|
3810
3935
|
import { existsSync as existsSync2, unlinkSync } from "fs";
|
|
@@ -4266,9 +4391,9 @@ var GitService = class {
|
|
|
4266
4391
|
try {
|
|
4267
4392
|
const paths = await this.listUntrackedPaths(repoPath);
|
|
4268
4393
|
let total = 0;
|
|
4269
|
-
for (const
|
|
4394
|
+
for (const path6 of paths) {
|
|
4270
4395
|
try {
|
|
4271
|
-
const contents = await readFile3(join5(repoPath,
|
|
4396
|
+
const contents = await readFile3(join5(repoPath, path6));
|
|
4272
4397
|
if (contents.length === 0 || contents.includes(0)) {
|
|
4273
4398
|
continue;
|
|
4274
4399
|
}
|
|
@@ -4556,12 +4681,12 @@ var GitService = class {
|
|
|
4556
4681
|
await saveRepoState(repo.name, state, state);
|
|
4557
4682
|
return state;
|
|
4558
4683
|
}
|
|
4559
|
-
pathExists(
|
|
4560
|
-
return existsSync2(
|
|
4684
|
+
pathExists(path6) {
|
|
4685
|
+
return existsSync2(path6);
|
|
4561
4686
|
}
|
|
4562
|
-
async safeStat(
|
|
4687
|
+
async safeStat(path6) {
|
|
4563
4688
|
try {
|
|
4564
|
-
return await stat(
|
|
4689
|
+
return await stat(path6);
|
|
4565
4690
|
} catch {
|
|
4566
4691
|
return null;
|
|
4567
4692
|
}
|
|
@@ -4584,8 +4709,8 @@ var StreamWriter = class {
|
|
|
4584
4709
|
backpressured = false;
|
|
4585
4710
|
droppedCount = 0;
|
|
4586
4711
|
flushTimer = null;
|
|
4587
|
-
open(
|
|
4588
|
-
this.stream = createWriteStream(
|
|
4712
|
+
open(path6, highWaterMark = DEFAULT_HIGH_WATER) {
|
|
4713
|
+
this.stream = createWriteStream(path6, { flags: "a", highWaterMark });
|
|
4589
4714
|
this.stream.on("error", () => {
|
|
4590
4715
|
this.stream = null;
|
|
4591
4716
|
});
|
|
@@ -5578,7 +5703,7 @@ async function registerDesktopPreview() {
|
|
|
5578
5703
|
|
|
5579
5704
|
// src/services/chat/chat-service.ts
|
|
5580
5705
|
import { existsSync as existsSync7 } from "fs";
|
|
5581
|
-
import { appendFile as appendFile3, copyFile, mkdir as mkdir13, readFile as readFile14, rename as rename2, rm } from "fs/promises";
|
|
5706
|
+
import { appendFile as appendFile3, copyFile, mkdir as mkdir13, readFile as readFile14, rename as rename2, rm as rm2 } from "fs/promises";
|
|
5582
5707
|
import { homedir as homedir15 } from "os";
|
|
5583
5708
|
import { join as join21 } from "path";
|
|
5584
5709
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
@@ -6095,7 +6220,7 @@ async function saveNormalizedImagesToTempFiles(images, tempImageDir = join12(hom
|
|
|
6095
6220
|
return tempPaths;
|
|
6096
6221
|
}
|
|
6097
6222
|
async function removeTempImageFiles(paths) {
|
|
6098
|
-
await Promise.allSettled(paths.map((
|
|
6223
|
+
await Promise.allSettled(paths.map((path6) => unlink2(path6)));
|
|
6099
6224
|
}
|
|
6100
6225
|
|
|
6101
6226
|
// src/services/message-queue-service.ts
|
|
@@ -6677,7 +6802,7 @@ async function getSkillRegistryInventory(homeDir) {
|
|
|
6677
6802
|
async function buildClaudeRegistryConfig(homeDir) {
|
|
6678
6803
|
const inventory = await getSkillRegistryInventory(homeDir);
|
|
6679
6804
|
return {
|
|
6680
|
-
plugins: inventory.claudePluginRoots.map((
|
|
6805
|
+
plugins: inventory.claudePluginRoots.map((path6) => ({ type: "local", path: path6 })),
|
|
6681
6806
|
enableAllSkills: inventory.claudePluginRoots.length > 0 || inventory.standaloneSkills.length > 0
|
|
6682
6807
|
};
|
|
6683
6808
|
}
|
|
@@ -6843,31 +6968,31 @@ function uniqueStandaloneSkills(skills) {
|
|
|
6843
6968
|
}
|
|
6844
6969
|
return unique;
|
|
6845
6970
|
}
|
|
6846
|
-
async function safeReadDir(
|
|
6971
|
+
async function safeReadDir(path6) {
|
|
6847
6972
|
try {
|
|
6848
|
-
return await readdir3(
|
|
6973
|
+
return await readdir3(path6, { withFileTypes: true });
|
|
6849
6974
|
} catch (error) {
|
|
6850
6975
|
if (isNotFoundError(error)) return [];
|
|
6851
6976
|
throw error;
|
|
6852
6977
|
}
|
|
6853
6978
|
}
|
|
6854
|
-
async function isDirectoryDirent(dirent,
|
|
6979
|
+
async function isDirectoryDirent(dirent, path6) {
|
|
6855
6980
|
if (dirent.isDirectory()) return true;
|
|
6856
6981
|
if (!dirent.isSymbolicLink()) return false;
|
|
6857
|
-
return directoryExists(
|
|
6982
|
+
return directoryExists(path6);
|
|
6858
6983
|
}
|
|
6859
|
-
async function directoryExists(
|
|
6984
|
+
async function directoryExists(path6) {
|
|
6860
6985
|
try {
|
|
6861
|
-
const pathStat = await stat2(
|
|
6986
|
+
const pathStat = await stat2(path6);
|
|
6862
6987
|
return pathStat.isDirectory();
|
|
6863
6988
|
} catch (error) {
|
|
6864
6989
|
if (isNotFoundError(error)) return false;
|
|
6865
6990
|
throw error;
|
|
6866
6991
|
}
|
|
6867
6992
|
}
|
|
6868
|
-
async function fileExists(
|
|
6993
|
+
async function fileExists(path6) {
|
|
6869
6994
|
try {
|
|
6870
|
-
const pathStat = await stat2(
|
|
6995
|
+
const pathStat = await stat2(path6);
|
|
6871
6996
|
return pathStat.isFile();
|
|
6872
6997
|
} catch (error) {
|
|
6873
6998
|
if (isNotFoundError(error)) return false;
|
|
@@ -8291,7 +8416,7 @@ var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
|
|
|
8291
8416
|
var MIN_CODEX_CLI_VERSION = "0.144.0";
|
|
8292
8417
|
var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
|
|
8293
8418
|
var codexCliVersionEnsured = null;
|
|
8294
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
8419
|
+
var ENGINE_PACKAGE_VERSION = "0.1.423";
|
|
8295
8420
|
var INITIALIZE_METHOD = "initialize";
|
|
8296
8421
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
8297
8422
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -8648,16 +8773,16 @@ function transcriptItemsForTurn(turn) {
|
|
|
8648
8773
|
const otherItems = turn.items.filter((item) => item.type !== "userMessage");
|
|
8649
8774
|
return [...userItems, ...otherItems];
|
|
8650
8775
|
}
|
|
8651
|
-
function userImageForLocalPath(
|
|
8652
|
-
const cached = localImageCache.get(
|
|
8776
|
+
function userImageForLocalPath(path6) {
|
|
8777
|
+
const cached = localImageCache.get(path6);
|
|
8653
8778
|
if (cached) return cached;
|
|
8654
|
-
if (!existsSync6(
|
|
8779
|
+
if (!existsSync6(path6)) return null;
|
|
8655
8780
|
const image = {
|
|
8656
8781
|
type: "image",
|
|
8657
|
-
mediaType: inferMediaType(
|
|
8658
|
-
data: readFileSync3(
|
|
8782
|
+
mediaType: inferMediaType(path6),
|
|
8783
|
+
data: readFileSync3(path6).toString("base64")
|
|
8659
8784
|
};
|
|
8660
|
-
if (image.data.length > 0) localImageCache.set(
|
|
8785
|
+
if (image.data.length > 0) localImageCache.set(path6, image);
|
|
8661
8786
|
return image;
|
|
8662
8787
|
}
|
|
8663
8788
|
function userImagesForInput(input) {
|
|
@@ -9031,9 +9156,9 @@ async function buildTurnInput(request) {
|
|
|
9031
9156
|
}
|
|
9032
9157
|
const normalizedImages = await normalizeImages(request.images);
|
|
9033
9158
|
const tempImagePaths = await saveNormalizedImagesToTempFiles(normalizedImages);
|
|
9034
|
-
input.push(...tempImagePaths.map((
|
|
9159
|
+
input.push(...tempImagePaths.map((path6) => ({
|
|
9035
9160
|
type: "localImage",
|
|
9036
|
-
path:
|
|
9161
|
+
path: path6
|
|
9037
9162
|
})));
|
|
9038
9163
|
return { input, tempImagePaths };
|
|
9039
9164
|
}
|
|
@@ -11477,9 +11602,9 @@ function extractTextBlocks(content, textBlockType, separator = "\n") {
|
|
|
11477
11602
|
const texts = content.map((block) => block && typeof block === "object" && "type" in block && block.type === textBlockType && "text" in block && typeof block.text === "string" ? block.text : "").filter(Boolean);
|
|
11478
11603
|
return texts.length > 0 ? texts.join(separator) : null;
|
|
11479
11604
|
}
|
|
11480
|
-
async function engineFetch(
|
|
11605
|
+
async function engineFetch(path6, options) {
|
|
11481
11606
|
const baseUrl = `http://localhost:${ENGINE_ENV.REPLICAS_ENGINE_PORT}`;
|
|
11482
|
-
return fetch(`${baseUrl}${
|
|
11607
|
+
return fetch(`${baseUrl}${path6}`, {
|
|
11483
11608
|
...options,
|
|
11484
11609
|
headers: {
|
|
11485
11610
|
"Content-Type": "application/json",
|
|
@@ -12755,8 +12880,8 @@ var ChatService = class {
|
|
|
12755
12880
|
return descendants;
|
|
12756
12881
|
}
|
|
12757
12882
|
async deleteHistoryFile(persisted) {
|
|
12758
|
-
await
|
|
12759
|
-
await
|
|
12883
|
+
await rm2(join21(HISTORY_DIR_BY_PROVIDER[persisted.provider], `${persisted.id}.jsonl`), { force: true });
|
|
12884
|
+
await rm2(this.senderFilePath(persisted.id), { force: true });
|
|
12760
12885
|
}
|
|
12761
12886
|
async getChatHistory(chatId, page = {}) {
|
|
12762
12887
|
const chat = this.requireChat(chatId);
|
|
@@ -14155,11 +14280,11 @@ function createV1Routes(deps) {
|
|
|
14155
14280
|
});
|
|
14156
14281
|
app2.get("/repo-files/content", async (c) => {
|
|
14157
14282
|
const repoName = c.req.query("repoName");
|
|
14158
|
-
const
|
|
14159
|
-
if (!repoName || !
|
|
14283
|
+
const path6 = c.req.query("path");
|
|
14284
|
+
if (!repoName || !path6) {
|
|
14160
14285
|
return c.json(jsonError("repoName and path are required"), 400);
|
|
14161
14286
|
}
|
|
14162
|
-
const result = await deps.repoFileService.readFile(repoName,
|
|
14287
|
+
const result = await deps.repoFileService.readFile(repoName, path6);
|
|
14163
14288
|
if (!result) {
|
|
14164
14289
|
return c.json(jsonError("File not found"), 404);
|
|
14165
14290
|
}
|
|
@@ -14748,7 +14873,8 @@ app.get("/token-refresh/health", async (c) => {
|
|
|
14748
14873
|
github: githubTokenManager.getHealthStatus(),
|
|
14749
14874
|
gitlab: gitlabTokenManager.getHealthStatus(),
|
|
14750
14875
|
claude: claudeTokenManager.getHealthStatus(),
|
|
14751
|
-
codex: codexTokenManager.getHealthStatus()
|
|
14876
|
+
codex: codexTokenManager.getHealthStatus(),
|
|
14877
|
+
infisical: infisicalTokenManager.getHealthStatus()
|
|
14752
14878
|
});
|
|
14753
14879
|
});
|
|
14754
14880
|
var repoFileService = new RepoFileService(gitService);
|
|
@@ -14897,6 +15023,7 @@ serve(
|
|
|
14897
15023
|
await gitlabTokenManager.start();
|
|
14898
15024
|
await claudeTokenManager.start();
|
|
14899
15025
|
await codexTokenManager.start();
|
|
15026
|
+
await infisicalTokenManager.start();
|
|
14900
15027
|
}
|
|
14901
15028
|
const repos = await gitService.listRepos();
|
|
14902
15029
|
await eventService.publish({
|