replicas-engine 0.1.1393 → 0.1.1395
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/{asp-host-UFTJU76Y.js → asp-host-X4B7BFXD.js} +5 -5
- package/dist/src/{chunk-ZUCNXOOK.js → chunk-GYXINP6G.js} +1 -1
- package/dist/src/{chunk-OSK2BFVR.js → chunk-LOSMI7ZJ.js} +2 -2
- package/dist/src/{chunk-TFUIT7CU.js → chunk-LOV3MVJJ.js} +2 -2
- package/dist/src/{chunk-GNWA725S.js → chunk-M5JKWEZ2.js} +6 -6
- package/dist/src/{chunk-BIUGCLX3.js → chunk-O4P6VNAB.js} +3 -3
- package/dist/src/{chunk-CKRLVTRB.js → chunk-PLWH35VJ.js} +177 -163
- package/dist/src/{chunk-JXEKJXH7.js → chunk-SAKMDQVZ.js} +2 -2
- package/dist/src/{chunk-INAQRTYM.js → chunk-X26DQM4O.js} +1 -1
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +4 -4
- package/dist/src/index.js +139 -51
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/subagent-mcp.js +1 -1
- package/package.json +1 -1
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
listRunningCodexModels,
|
|
9
9
|
restartCodexAspHost,
|
|
10
10
|
restartCodexAspHostIfRunning
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-M5JKWEZ2.js";
|
|
12
|
+
import "./chunk-SAKMDQVZ.js";
|
|
13
|
+
import "./chunk-O4P6VNAB.js";
|
|
14
|
+
import "./chunk-X26DQM4O.js";
|
|
15
15
|
import "./chunk-UZSNFLDQ.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-PLWH35VJ.js";
|
|
17
17
|
import "./chunk-VEQXQN22.js";
|
|
18
18
|
export {
|
|
19
19
|
CODEX_ULTRAFAST_SERVICE_TIER,
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getOriginDefaultBranch,
|
|
7
7
|
monolithRequest,
|
|
8
8
|
runGitCommand
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SAKMDQVZ.js";
|
|
10
10
|
import {
|
|
11
11
|
extractCommandProtectionCommandText,
|
|
12
12
|
findCommandProtectionGitLookups,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
findPrMergeSignals,
|
|
15
15
|
findScoutRepoWriteSignals,
|
|
16
16
|
parseCommandProtectionRequest
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-PLWH35VJ.js";
|
|
18
18
|
|
|
19
19
|
// src/services/command-protection-service.ts
|
|
20
20
|
import { readFile, stat } from "fs/promises";
|
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
AspClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-O4P6VNAB.js";
|
|
7
7
|
import {
|
|
8
8
|
ASTER_BASE_URL,
|
|
9
9
|
ASTER_PROVIDER,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
isRecord,
|
|
16
16
|
readOllamaAuthEnv,
|
|
17
17
|
readOpenAICompatibleAuthEnv
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-PLWH35VJ.js";
|
|
19
19
|
|
|
20
20
|
// src/managers/codex-asp/notification-dispatch.ts
|
|
21
21
|
var TURN_STARTED_METHOD = "turn/started";
|
|
@@ -10,15 +10,15 @@ import {
|
|
|
10
10
|
resolveDiffBase,
|
|
11
11
|
runGitCommand,
|
|
12
12
|
setAgentCredentialSnapshot
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-SAKMDQVZ.js";
|
|
14
14
|
import {
|
|
15
15
|
AppServerProcess,
|
|
16
16
|
buildCodexAgentEnv
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-O4P6VNAB.js";
|
|
18
18
|
import {
|
|
19
19
|
SUBPROCESS_MAX_BUFFER,
|
|
20
20
|
execFileAsync
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-X26DQM4O.js";
|
|
22
22
|
import {
|
|
23
23
|
isRecord
|
|
24
24
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
resolveOpenAICompatibleModelsUrl,
|
|
57
57
|
splitMothershipInstructions,
|
|
58
58
|
withTimeout
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-PLWH35VJ.js";
|
|
60
60
|
|
|
61
61
|
// src/managers/codex-token-manager.ts
|
|
62
62
|
import { promises as fs } from "fs";
|
|
@@ -319,7 +319,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
319
319
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
320
320
|
await this.applyCredentialsResponse(data);
|
|
321
321
|
setAgentCredentialSnapshot("codex", data);
|
|
322
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
322
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-X4B7BFXD.js");
|
|
323
323
|
await restartCodexAspHostIfRunning2();
|
|
324
324
|
});
|
|
325
325
|
await this.start(true);
|
|
@@ -341,7 +341,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
341
341
|
const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
|
|
342
342
|
await this.applyCredentialsResponse(data);
|
|
343
343
|
if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
|
|
344
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
344
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-X4B7BFXD.js");
|
|
345
345
|
await restartCodexAspHostIfRunning2();
|
|
346
346
|
}
|
|
347
347
|
setAgentCredentialSnapshot("codex", data);
|
|
@@ -3,10 +3,10 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
execFileAsync
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-X26DQM4O.js";
|
|
7
7
|
import {
|
|
8
8
|
isVersionBelow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PLWH35VJ.js";
|
|
10
10
|
|
|
11
11
|
// src/utils/codex-agent-env.ts
|
|
12
12
|
function buildCodexAgentEnv(source = process.env) {
|
|
@@ -240,7 +240,7 @@ function getCodexModelProvider(method) {
|
|
|
240
240
|
if (method === "foundry") return "azure";
|
|
241
241
|
return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
|
|
242
242
|
}
|
|
243
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
243
|
+
var ENGINE_PACKAGE_VERSION = "0.1.1395";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -10520,6 +10520,8 @@ function isMessageSource(value) {
|
|
|
10520
10520
|
}
|
|
10521
10521
|
var AUTOMATED_SOURCES = ["api", "automation"];
|
|
10522
10522
|
var AUTOMATED_SOURCES_SQL = AUTOMATED_SOURCES.map((s) => `'${s}'`).join(", ");
|
|
10523
|
+
var EGRESS_MICRODOLLARS_PER_GB = 15e4;
|
|
10524
|
+
var EGRESS_RATE_LABEL = `$${(EGRESS_MICRODOLLARS_PER_GB / 1e6).toFixed(2)}/GB`;
|
|
10523
10525
|
var PLANS = {
|
|
10524
10526
|
trial: {
|
|
10525
10527
|
id: "trial",
|
|
@@ -11203,44 +11205,88 @@ var engineMcpOAuthTokenResponseSchema = z6.object({
|
|
|
11203
11205
|
expires_at: z6.string().nullable()
|
|
11204
11206
|
});
|
|
11205
11207
|
|
|
11208
|
+
// ../shared/src/routes/environment.ts
|
|
11209
|
+
import { z as z7 } from "zod";
|
|
11210
|
+
var ENVIRONMENT_MCP_TRANSPORTS = ["stdio", "http", "sse"];
|
|
11211
|
+
var stringMap = z7.record(z7.string(), z7.string());
|
|
11212
|
+
var createEnvironmentMcpRequestSchema = z7.object({
|
|
11213
|
+
name: z7.string(),
|
|
11214
|
+
transport: z7.enum(ENVIRONMENT_MCP_TRANSPORTS),
|
|
11215
|
+
config: z7.union([
|
|
11216
|
+
z7.object({ command: z7.string().min(1), args: z7.array(z7.string()).optional(), env: stringMap.optional() }),
|
|
11217
|
+
z7.object({ url: z7.url(), headers: stringMap.optional(), auth: mcpAuthSchema.optional() })
|
|
11218
|
+
]).describe("stdio: `{ command, args, env }`. http/sse: `{ url, headers }`.")
|
|
11219
|
+
});
|
|
11220
|
+
var updateEnvironmentMcpRequestSchema = createEnvironmentMcpRequestSchema.partial();
|
|
11221
|
+
var screenPasswordSchema = z7.string().min(1, "Enter the screen password").max(256).describe('Screen Sharing password, for `replicas computer screen`. On a Mac, the "VNC viewers may control screen with password" password. Never returned.');
|
|
11222
|
+
var hostSchema = z7.string().max(253).regex(/^(?:[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?|[0-9A-Fa-f:]+)$/, "Enter a hostname or IP address");
|
|
11223
|
+
var createEnvironmentDeviceRequestSchema = z7.object({
|
|
11224
|
+
name: z7.string().regex(/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/, "Use lowercase letters, numbers and dashes").describe("SSH alias in workspaces, e.g. `mac-mini` for `ssh mac-mini`."),
|
|
11225
|
+
host: hostSchema.optional().describe("Hostname or IP, such as a Tailscale MagicDNS name (`mac-mini`) or a public address. Leave it out when the device connects to Replicas itself with `replicas device connect`."),
|
|
11226
|
+
port: z7.number().int().min(1).max(65535).optional().describe("SSH port on the device. Defaults to 22."),
|
|
11227
|
+
username: z7.string().regex(/^[A-Za-z0-9_][A-Za-z0-9._-]{0,63}$/, "Enter the account name on the device").describe("Account the agent signs in as."),
|
|
11228
|
+
screen_password: screenPasswordSchema.optional()
|
|
11229
|
+
});
|
|
11230
|
+
var updateEnvironmentDeviceRequestSchema = createEnvironmentDeviceRequestSchema.partial().extend({
|
|
11231
|
+
host: z7.union([hostSchema, z7.literal("")]).optional().describe("New hostname or IP, or an empty string for a device that connects to Replicas itself."),
|
|
11232
|
+
screen_password: z7.union([screenPasswordSchema, z7.literal("")]).optional().describe("New Screen Sharing password, or an empty string to remove it.")
|
|
11233
|
+
});
|
|
11234
|
+
var deviceConnectionResponseSchema = z7.object({
|
|
11235
|
+
name: z7.string(),
|
|
11236
|
+
port: z7.number(),
|
|
11237
|
+
workspace_ids: z7.array(z7.string())
|
|
11238
|
+
});
|
|
11239
|
+
var deviceHostKeysRequestSchema = z7.object({
|
|
11240
|
+
host_keys: z7.array(z7.string().max(2048).regex(/^[a-z0-9@.-]+ [A-Za-z0-9+/]+={0,3}$/, "Each host key must be `<type> <base64>`")).min(1).max(8).transform((keys) => [...new Set(keys)].sort())
|
|
11241
|
+
});
|
|
11242
|
+
var DEVICE_HOST_KEYS_HEADER = "x-replicas-device-host-keys";
|
|
11243
|
+
var provisionedDeviceSchema = z7.object({
|
|
11244
|
+
name: z7.string(),
|
|
11245
|
+
host: z7.string().nullable(),
|
|
11246
|
+
port: z7.number(),
|
|
11247
|
+
username: z7.string(),
|
|
11248
|
+
private_key: z7.string(),
|
|
11249
|
+
screen_password: z7.string().optional()
|
|
11250
|
+
});
|
|
11251
|
+
|
|
11206
11252
|
// ../shared/src/routes/mothership.ts
|
|
11207
|
-
import { z as
|
|
11253
|
+
import { z as z9 } from "zod";
|
|
11208
11254
|
|
|
11209
11255
|
// ../shared/src/routes/pull-requests.ts
|
|
11210
|
-
import { z as
|
|
11256
|
+
import { z as z8 } from "zod";
|
|
11211
11257
|
var PULL_REQUEST_MERGE_METHODS = ["merge", "squash", "rebase"];
|
|
11212
11258
|
var DEPLOY_START_WINDOW_MS = 30 * 6e4;
|
|
11213
|
-
var mergePullRequestRequestSchema =
|
|
11214
|
-
mergeMethod:
|
|
11215
|
-
bypassRules:
|
|
11259
|
+
var mergePullRequestRequestSchema = z8.object({
|
|
11260
|
+
mergeMethod: z8.enum(PULL_REQUEST_MERGE_METHODS).optional(),
|
|
11261
|
+
bypassRules: z8.boolean().optional()
|
|
11216
11262
|
});
|
|
11217
11263
|
|
|
11218
11264
|
// ../shared/src/routes/mothership.ts
|
|
11219
|
-
var linearRuleFields =
|
|
11220
|
-
team_id:
|
|
11221
|
-
current_cycle:
|
|
11222
|
-
label_ids:
|
|
11223
|
-
project_id:
|
|
11224
|
-
assignee_id:
|
|
11265
|
+
var linearRuleFields = z9.object({
|
|
11266
|
+
team_id: z9.string().min(1),
|
|
11267
|
+
current_cycle: z9.boolean().optional(),
|
|
11268
|
+
label_ids: z9.array(z9.string().min(1)).min(1).optional(),
|
|
11269
|
+
project_id: z9.string().min(1).optional(),
|
|
11270
|
+
assignee_id: z9.string().min(1).optional()
|
|
11225
11271
|
}).strict();
|
|
11226
11272
|
var withLabelIds = (value) => {
|
|
11227
11273
|
if (!isRecord(value) || typeof value.label_id !== "string") return value;
|
|
11228
11274
|
const { label_id, ...rest } = value;
|
|
11229
11275
|
return { ...rest, label_ids: [label_id] };
|
|
11230
11276
|
};
|
|
11231
|
-
var mothershipLinearRuleSchema =
|
|
11232
|
-
var storedMothershipLinearRuleSchema =
|
|
11277
|
+
var mothershipLinearRuleSchema = z9.preprocess(withLabelIds, linearRuleFields);
|
|
11278
|
+
var storedMothershipLinearRuleSchema = z9.preprocess(withLabelIds, linearRuleFields.extend({ linked_at: z9.string() }));
|
|
11233
11279
|
var SUBAGENT_SERVICE_TIERS = ["default", "fast", "ultrafast"];
|
|
11234
11280
|
function serviceTierRequestFields(tier) {
|
|
11235
11281
|
return { fastMode: tier !== "default", ...tier === "ultrafast" ? { ultrafastMode: true } : {} };
|
|
11236
11282
|
}
|
|
11237
|
-
var mothershipSubagentSettingsSchema =
|
|
11238
|
-
coding_agent:
|
|
11239
|
-
model:
|
|
11240
|
-
thinking_level:
|
|
11241
|
-
service_tier:
|
|
11242
|
-
goal_mode:
|
|
11243
|
-
plan_mode:
|
|
11283
|
+
var mothershipSubagentSettingsSchema = z9.object({
|
|
11284
|
+
coding_agent: z9.enum(VALID_AGENT_PROVIDERS),
|
|
11285
|
+
model: z9.string().nullable(),
|
|
11286
|
+
thinking_level: z9.enum(VALID_THINKING_LEVELS).nullable(),
|
|
11287
|
+
service_tier: z9.enum(SUBAGENT_SERVICE_TIERS),
|
|
11288
|
+
goal_mode: z9.boolean(),
|
|
11289
|
+
plan_mode: z9.boolean()
|
|
11244
11290
|
});
|
|
11245
11291
|
var QUEUE_SECTIONS = [
|
|
11246
11292
|
{ label: "Open PRs", groups: ["needs_you", "ready_to_merge", "ready_to_review"] },
|
|
@@ -11469,19 +11515,19 @@ function gitIdentityConfigCommands(identity, scope = "global") {
|
|
|
11469
11515
|
}
|
|
11470
11516
|
|
|
11471
11517
|
// ../shared/src/headless-agent.ts
|
|
11472
|
-
import { z as
|
|
11473
|
-
var headlessAgentRequestSchema =
|
|
11474
|
-
mode:
|
|
11475
|
-
agent:
|
|
11518
|
+
import { z as z10 } from "zod";
|
|
11519
|
+
var headlessAgentRequestSchema = z10.object({
|
|
11520
|
+
mode: z10.literal("structured"),
|
|
11521
|
+
agent: z10.custom(
|
|
11476
11522
|
(value) => typeof value === "string" && isValidAgentProvider(value)
|
|
11477
11523
|
),
|
|
11478
|
-
model:
|
|
11479
|
-
prompt:
|
|
11480
|
-
workingDirectory:
|
|
11481
|
-
timeoutSeconds:
|
|
11482
|
-
thinkingLevel:
|
|
11483
|
-
codexOauthTokens:
|
|
11484
|
-
outputSchema:
|
|
11524
|
+
model: z10.string().min(1),
|
|
11525
|
+
prompt: z10.string(),
|
|
11526
|
+
workingDirectory: z10.string().min(1),
|
|
11527
|
+
timeoutSeconds: z10.number().int().min(1).max(1800).default(300),
|
|
11528
|
+
thinkingLevel: z10.enum(STANDARD_THINKING_LEVELS).optional(),
|
|
11529
|
+
codexOauthTokens: z10.object({ accessToken: z10.string(), accountId: z10.string() }).optional(),
|
|
11530
|
+
outputSchema: z10.record(z10.string(), z10.json())
|
|
11485
11531
|
});
|
|
11486
11532
|
var headlessAgentUsagePath = (outputPath) => `${outputPath}.usage`;
|
|
11487
11533
|
|
|
@@ -11560,12 +11606,12 @@ function describeAuthFallback(payload) {
|
|
|
11560
11606
|
}
|
|
11561
11607
|
|
|
11562
11608
|
// ../shared/src/workspace-credentials.ts
|
|
11563
|
-
import { z as
|
|
11609
|
+
import { z as z11 } from "zod";
|
|
11564
11610
|
var WORKSPACE_CREDENTIAL_PROVIDERS = ["claude", "codex"];
|
|
11565
|
-
var workspaceCredentialProviderSchema =
|
|
11611
|
+
var workspaceCredentialProviderSchema = z11.enum(WORKSPACE_CREDENTIAL_PROVIDERS);
|
|
11566
11612
|
var workspaceCredentialSelectionSchema = agentCredentialSnapshotSchema.omit({ revision: true, account: true, credentialId: true });
|
|
11567
11613
|
var createWorkspaceCredentialSchema = workspaceCredentialSelectionSchema.extend({
|
|
11568
|
-
provider:
|
|
11614
|
+
provider: z11.enum(VALID_AGENT_PROVIDERS)
|
|
11569
11615
|
}).refine(({ provider: provider2, method }) => agentCredentialMethods(provider2).includes(method), {
|
|
11570
11616
|
message: "This inference provider is not supported by this agent"
|
|
11571
11617
|
});
|
|
@@ -11576,62 +11622,62 @@ var switchWorkspaceCredentialSchema = workspaceCredentialSelectionSchema.extend(
|
|
|
11576
11622
|
});
|
|
11577
11623
|
|
|
11578
11624
|
// ../shared/src/chat-fork.ts
|
|
11579
|
-
import { z as
|
|
11625
|
+
import { z as z13 } from "zod";
|
|
11580
11626
|
|
|
11581
11627
|
// ../shared/src/fallback-chains.ts
|
|
11582
|
-
import { z as
|
|
11583
|
-
var fallbackHarnessStepSchema =
|
|
11584
|
-
kind:
|
|
11585
|
-
provider:
|
|
11586
|
-
model:
|
|
11587
|
-
thinkingLevel:
|
|
11628
|
+
import { z as z12 } from "zod";
|
|
11629
|
+
var fallbackHarnessStepSchema = z12.object({
|
|
11630
|
+
kind: z12.literal("harness"),
|
|
11631
|
+
provider: z12.enum(VALID_AGENT_PROVIDERS),
|
|
11632
|
+
model: z12.string().min(1),
|
|
11633
|
+
thinkingLevel: z12.enum(VALID_THINKING_LEVELS).optional().catch(void 0)
|
|
11588
11634
|
});
|
|
11589
|
-
var fallbackPlanStepSchema =
|
|
11590
|
-
|
|
11591
|
-
kind:
|
|
11635
|
+
var fallbackPlanStepSchema = z12.discriminatedUnion("kind", [
|
|
11636
|
+
z12.object({
|
|
11637
|
+
kind: z12.literal("credentials"),
|
|
11592
11638
|
// An empty list would allow every method.
|
|
11593
|
-
methods:
|
|
11594
|
-
models:
|
|
11639
|
+
methods: z12.array(z12.unknown()).transform((methods) => methods.filter(isAuthMethod)).refine((methods) => methods.length > 0),
|
|
11640
|
+
models: z12.record(z12.string(), z12.string().min(1)).optional()
|
|
11595
11641
|
}),
|
|
11596
11642
|
fallbackHarnessStepSchema
|
|
11597
11643
|
]);
|
|
11598
|
-
var fallbackPlanResponseSchema =
|
|
11599
|
-
steps:
|
|
11644
|
+
var fallbackPlanResponseSchema = z12.object({
|
|
11645
|
+
steps: z12.array(z12.unknown()).transform((steps) => steps.flatMap((step) => fallbackPlanStepSchema.safeParse(step).data ?? []))
|
|
11600
11646
|
});
|
|
11601
11647
|
|
|
11602
11648
|
// ../shared/src/chat-fork.ts
|
|
11603
|
-
var fallbackReasonSchema =
|
|
11604
|
-
var chatForkInfoSchema =
|
|
11605
|
-
source:
|
|
11606
|
-
chatId:
|
|
11607
|
-
provider:
|
|
11608
|
-
title:
|
|
11649
|
+
var fallbackReasonSchema = z13.enum(AGENT_FALLBACK_REASONS);
|
|
11650
|
+
var chatForkInfoSchema = z13.object({
|
|
11651
|
+
source: z13.object({
|
|
11652
|
+
chatId: z13.string().min(1),
|
|
11653
|
+
provider: z13.enum(VALID_AGENT_PROVIDERS),
|
|
11654
|
+
title: z13.string()
|
|
11609
11655
|
}),
|
|
11610
|
-
trigger:
|
|
11656
|
+
trigger: z13.enum(["manual", "auto", "side", "switch"]),
|
|
11611
11657
|
reason: fallbackReasonSchema.optional(),
|
|
11612
|
-
state:
|
|
11613
|
-
error:
|
|
11614
|
-
startedAt:
|
|
11615
|
-
completedAt:
|
|
11658
|
+
state: z13.enum(["preparing", "ready", "failed"]),
|
|
11659
|
+
error: z13.string().optional(),
|
|
11660
|
+
startedAt: z13.string(),
|
|
11661
|
+
completedAt: z13.string().optional()
|
|
11616
11662
|
});
|
|
11617
11663
|
function coerceChatForkInfo(value) {
|
|
11618
11664
|
const parsed = chatForkInfoSchema.safeParse(value);
|
|
11619
11665
|
return parsed.success ? parsed.data : null;
|
|
11620
11666
|
}
|
|
11621
|
-
var forkChatRequestSchema =
|
|
11622
|
-
provider:
|
|
11623
|
-
model:
|
|
11624
|
-
thinkingLevel:
|
|
11625
|
-
title:
|
|
11626
|
-
message:
|
|
11627
|
-
id:
|
|
11628
|
-
clientRequestId:
|
|
11629
|
-
enableInteractiveTools:
|
|
11667
|
+
var forkChatRequestSchema = z13.object({
|
|
11668
|
+
provider: z13.enum(VALID_AGENT_PROVIDERS),
|
|
11669
|
+
model: z13.string().min(1).optional(),
|
|
11670
|
+
thinkingLevel: z13.enum(VALID_THINKING_LEVELS).optional(),
|
|
11671
|
+
title: z13.string().min(1).max(200).optional(),
|
|
11672
|
+
message: z13.string().trim().optional(),
|
|
11673
|
+
id: z13.string().uuid().optional(),
|
|
11674
|
+
clientRequestId: z13.string().min(1).max(128).optional(),
|
|
11675
|
+
enableInteractiveTools: z13.boolean().optional(),
|
|
11630
11676
|
// Server-injected by the monolith from the authenticated request; never trusted from clients.
|
|
11631
|
-
senderUserId:
|
|
11632
|
-
senderEmail:
|
|
11633
|
-
senderDisplayName:
|
|
11634
|
-
senderAvatarUrl:
|
|
11677
|
+
senderUserId: z13.string().optional(),
|
|
11678
|
+
senderEmail: z13.string().optional(),
|
|
11679
|
+
senderDisplayName: z13.string().optional(),
|
|
11680
|
+
senderAvatarUrl: z13.string().optional()
|
|
11635
11681
|
});
|
|
11636
11682
|
function describeQuotaLimit(reason) {
|
|
11637
11683
|
if (reason === "auth_failed") return "could not authenticate";
|
|
@@ -11643,10 +11689,10 @@ function describeChatForkReason(reason, provider2) {
|
|
|
11643
11689
|
return reason ? `${getProviderDisplayName(provider2)} ${describeQuotaLimit(reason)}` : null;
|
|
11644
11690
|
}
|
|
11645
11691
|
var AGENT_QUOTA_EXHAUSTED_EVENT_TYPE = "agent-quota-exhausted";
|
|
11646
|
-
var agentQuotaExhaustedPayloadSchema =
|
|
11647
|
-
provider:
|
|
11692
|
+
var agentQuotaExhaustedPayloadSchema = z13.object({
|
|
11693
|
+
provider: z13.enum(VALID_AGENT_PROVIDERS),
|
|
11648
11694
|
reason: fallbackReasonSchema,
|
|
11649
|
-
detail:
|
|
11695
|
+
detail: z13.string().optional(),
|
|
11650
11696
|
forkTo: fallbackHarnessStepSchema.optional()
|
|
11651
11697
|
});
|
|
11652
11698
|
function defaultForkChatTitle(source, provider2) {
|
|
@@ -11678,17 +11724,17 @@ function getChatThreadSources(chats, chat) {
|
|
|
11678
11724
|
}
|
|
11679
11725
|
|
|
11680
11726
|
// ../shared/src/credential-refresh.ts
|
|
11681
|
-
import { z as
|
|
11682
|
-
var engineCredentialRefreshFailureSchema =
|
|
11683
|
-
code:
|
|
11727
|
+
import { z as z14 } from "zod";
|
|
11728
|
+
var engineCredentialRefreshFailureSchema = z14.object({
|
|
11729
|
+
code: z14.string(),
|
|
11684
11730
|
credential: workspaceCredentialSelectionSchema.optional()
|
|
11685
11731
|
});
|
|
11686
11732
|
|
|
11687
11733
|
// ../shared/src/credential-pool.ts
|
|
11688
|
-
import { z as
|
|
11734
|
+
import { z as z15 } from "zod";
|
|
11689
11735
|
var MAX_CREDENTIAL_POOL_ACCOUNTS = 10;
|
|
11690
|
-
var reorderCredentialPoolSchema =
|
|
11691
|
-
credential_ids:
|
|
11736
|
+
var reorderCredentialPoolSchema = z15.object({
|
|
11737
|
+
credential_ids: z15.array(z15.string().uuid()).min(1).max(MAX_CREDENTIAL_POOL_ACCOUNTS)
|
|
11692
11738
|
});
|
|
11693
11739
|
|
|
11694
11740
|
// ../shared/src/mothership-events.ts
|
|
@@ -11698,39 +11744,39 @@ import { z as z23 } from "zod";
|
|
|
11698
11744
|
import { z as z19 } from "zod";
|
|
11699
11745
|
|
|
11700
11746
|
// ../shared/src/routes/linear.ts
|
|
11701
|
-
import { z as
|
|
11702
|
-
var linearSessionMetadataSchema =
|
|
11703
|
-
via_mothership:
|
|
11704
|
-
attached:
|
|
11705
|
-
issue_id:
|
|
11706
|
-
issue_identifier:
|
|
11707
|
-
issue_title:
|
|
11708
|
-
issue_description:
|
|
11709
|
-
issue_url:
|
|
11710
|
-
comment_id:
|
|
11711
|
-
comment_body:
|
|
11712
|
-
triggered_by_id:
|
|
11713
|
-
triggered_by_name:
|
|
11714
|
-
triggered_by_email:
|
|
11715
|
-
linear_workspace_id:
|
|
11716
|
-
creator_id:
|
|
11717
|
-
creator_name:
|
|
11718
|
-
creator_email:
|
|
11719
|
-
assignee_id:
|
|
11720
|
-
assignee_name:
|
|
11721
|
-
assignee_email:
|
|
11722
|
-
issue_state:
|
|
11723
|
-
parent_issue:
|
|
11724
|
-
id:
|
|
11725
|
-
identifier:
|
|
11726
|
-
title:
|
|
11727
|
-
description:
|
|
11747
|
+
import { z as z16 } from "zod";
|
|
11748
|
+
var linearSessionMetadataSchema = z16.object({
|
|
11749
|
+
via_mothership: z16.boolean().optional(),
|
|
11750
|
+
attached: z16.boolean().optional(),
|
|
11751
|
+
issue_id: z16.string(),
|
|
11752
|
+
issue_identifier: z16.string(),
|
|
11753
|
+
issue_title: z16.string(),
|
|
11754
|
+
issue_description: z16.string(),
|
|
11755
|
+
issue_url: z16.string(),
|
|
11756
|
+
comment_id: z16.string(),
|
|
11757
|
+
comment_body: z16.string(),
|
|
11758
|
+
triggered_by_id: z16.string().optional(),
|
|
11759
|
+
triggered_by_name: z16.string().optional(),
|
|
11760
|
+
triggered_by_email: z16.string().optional(),
|
|
11761
|
+
linear_workspace_id: z16.string().optional(),
|
|
11762
|
+
creator_id: z16.string().optional(),
|
|
11763
|
+
creator_name: z16.string().optional(),
|
|
11764
|
+
creator_email: z16.string().optional(),
|
|
11765
|
+
assignee_id: z16.string().optional(),
|
|
11766
|
+
assignee_name: z16.string().optional(),
|
|
11767
|
+
assignee_email: z16.string().optional(),
|
|
11768
|
+
issue_state: z16.string().optional(),
|
|
11769
|
+
parent_issue: z16.object({
|
|
11770
|
+
id: z16.string(),
|
|
11771
|
+
identifier: z16.string(),
|
|
11772
|
+
title: z16.string(),
|
|
11773
|
+
description: z16.string().nullable()
|
|
11728
11774
|
}).optional(),
|
|
11729
|
-
workspace:
|
|
11730
|
-
id:
|
|
11731
|
-
coding_agent:
|
|
11732
|
-
task_description:
|
|
11733
|
-
created_at:
|
|
11775
|
+
workspace: z16.object({
|
|
11776
|
+
id: z16.string(),
|
|
11777
|
+
coding_agent: z16.custom((value) => typeof value === "string" && isValidAgentProvider(value)),
|
|
11778
|
+
task_description: z16.string(),
|
|
11779
|
+
created_at: z16.string()
|
|
11734
11780
|
}).optional()
|
|
11735
11781
|
});
|
|
11736
11782
|
var LINEAR_WORKFLOW_STATE_TYPES = ["triage", "backlog", "unstarted", "started", "completed", "canceled", "duplicate"];
|
|
@@ -11740,7 +11786,7 @@ var LINEAR_ISSUE_STATE_CHANGED_EVENT = "issue.state_changed";
|
|
|
11740
11786
|
var LINEAR_STATE_TYPES = LINEAR_WORKFLOW_STATE_TYPES.filter((type) => type !== "duplicate");
|
|
11741
11787
|
|
|
11742
11788
|
// ../shared/src/automations/trigger-schemas.ts
|
|
11743
|
-
import { z as
|
|
11789
|
+
import { z as z17 } from "zod";
|
|
11744
11790
|
|
|
11745
11791
|
// ../shared/src/uuid.ts
|
|
11746
11792
|
function createUuidFromHex(value) {
|
|
@@ -11757,31 +11803,31 @@ function getReviewerLoginsError(event, logins) {
|
|
|
11757
11803
|
if (isReviewRequested === !!logins?.some((login) => login.trim().replace(/^@+/, ""))) return null;
|
|
11758
11804
|
return isReviewRequested ? "The PR review requested trigger needs at least one GitHub username" : "Requested reviewers only apply to the PR review requested trigger";
|
|
11759
11805
|
}
|
|
11760
|
-
var repositoryTriggerConfigSchema =
|
|
11761
|
-
event:
|
|
11762
|
-
repository_ids:
|
|
11763
|
-
group_pr_events:
|
|
11764
|
-
excluded_actors:
|
|
11765
|
-
reviewer_logins:
|
|
11806
|
+
var repositoryTriggerConfigSchema = z17.object({
|
|
11807
|
+
event: z17.string(),
|
|
11808
|
+
repository_ids: z17.array(z17.string().regex(UUID_RE, "must be a repository id")).optional(),
|
|
11809
|
+
group_pr_events: z17.boolean().optional(),
|
|
11810
|
+
excluded_actors: z17.array(z17.string()).optional(),
|
|
11811
|
+
reviewer_logins: z17.array(z17.string()).optional()
|
|
11766
11812
|
});
|
|
11767
|
-
var cronTriggerSchema =
|
|
11768
|
-
var githubTriggerSchema =
|
|
11769
|
-
type:
|
|
11813
|
+
var cronTriggerSchema = z17.object({ type: z17.literal("cron"), config: z17.object({ schedule: z17.string(), timezone: z17.string().optional() }) });
|
|
11814
|
+
var githubTriggerSchema = z17.object({
|
|
11815
|
+
type: z17.literal("github"),
|
|
11770
11816
|
config: repositoryTriggerConfigSchema.superRefine((config, ctx) => {
|
|
11771
11817
|
const message2 = getReviewerLoginsError(config.event, config.reviewer_logins);
|
|
11772
11818
|
if (message2) ctx.addIssue({ code: "custom", message: message2, path: ["reviewer_logins"] });
|
|
11773
11819
|
})
|
|
11774
11820
|
});
|
|
11775
|
-
var gitlabTriggerSchema =
|
|
11776
|
-
var linearTriggerConfigSchema =
|
|
11777
|
-
var automationTriggerSchema =
|
|
11821
|
+
var gitlabTriggerSchema = z17.object({ type: z17.literal("gitlab"), config: repositoryTriggerConfigSchema });
|
|
11822
|
+
var linearTriggerConfigSchema = z17.object({ event: z17.string(), team_ids: z17.array(z17.string()).optional(), state_types: z17.array(z17.enum(LINEAR_STATE_TYPES)).optional() });
|
|
11823
|
+
var automationTriggerSchema = z17.discriminatedUnion("type", [
|
|
11778
11824
|
cronTriggerSchema,
|
|
11779
11825
|
githubTriggerSchema,
|
|
11780
11826
|
gitlabTriggerSchema,
|
|
11781
|
-
|
|
11782
|
-
|
|
11783
|
-
|
|
11784
|
-
|
|
11827
|
+
z17.object({ type: z17.literal("slack"), config: z17.object({ event: z17.string(), channel_ids: z17.array(z17.string()).optional(), group_thread_replies: z17.boolean().optional() }) }),
|
|
11828
|
+
z17.object({ type: z17.literal("sentry"), config: z17.object({ event: z17.string(), project_slugs: z17.array(z17.string()).optional(), min_level: z17.string().optional() }) }),
|
|
11829
|
+
z17.object({ type: z17.literal("linear"), config: linearTriggerConfigSchema }),
|
|
11830
|
+
z17.object({ type: z17.literal("custom"), config: z17.object({}) })
|
|
11785
11831
|
]);
|
|
11786
11832
|
|
|
11787
11833
|
// ../shared/src/automations/types.ts
|
|
@@ -11790,39 +11836,6 @@ var AUTOMATION_LIFECYCLE_POLICIES = ["default", "archive_when_done", "sleep_when
|
|
|
11790
11836
|
var AUTOMATION_AUTO_PAUSE_DAYS = 7;
|
|
11791
11837
|
var AUTOMATION_AUTO_PAUSE_LABEL = `Paused after failing every run for ${AUTOMATION_AUTO_PAUSE_DAYS} days`;
|
|
11792
11838
|
|
|
11793
|
-
// ../shared/src/routes/environment.ts
|
|
11794
|
-
import { z as z17 } from "zod";
|
|
11795
|
-
var ENVIRONMENT_MCP_TRANSPORTS = ["stdio", "http", "sse"];
|
|
11796
|
-
var stringMap = z17.record(z17.string(), z17.string());
|
|
11797
|
-
var createEnvironmentMcpRequestSchema = z17.object({
|
|
11798
|
-
name: z17.string(),
|
|
11799
|
-
transport: z17.enum(ENVIRONMENT_MCP_TRANSPORTS),
|
|
11800
|
-
config: z17.union([
|
|
11801
|
-
z17.object({ command: z17.string().min(1), args: z17.array(z17.string()).optional(), env: stringMap.optional() }),
|
|
11802
|
-
z17.object({ url: z17.url(), headers: stringMap.optional(), auth: mcpAuthSchema.optional() })
|
|
11803
|
-
]).describe("stdio: `{ command, args, env }`. http/sse: `{ url, headers }`.")
|
|
11804
|
-
});
|
|
11805
|
-
var updateEnvironmentMcpRequestSchema = createEnvironmentMcpRequestSchema.partial();
|
|
11806
|
-
var screenPasswordSchema = z17.string().min(1, "Enter the screen password").max(256).describe('Screen Sharing password, for `replicas computer screen`. On a Mac, the "VNC viewers may control screen with password" password. Never returned.');
|
|
11807
|
-
var createEnvironmentDeviceRequestSchema = z17.object({
|
|
11808
|
-
name: z17.string().regex(/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/, "Use lowercase letters, numbers and dashes").describe("SSH alias in workspaces, e.g. `mac-mini` for `ssh mac-mini`."),
|
|
11809
|
-
host: z17.string().max(253).regex(/^(?:[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?|[0-9A-Fa-f:]+)$/, "Enter a hostname or IP address").describe("Hostname or IP, such as a Tailscale MagicDNS name (`mac-mini`) or a public address."),
|
|
11810
|
-
port: z17.number().int().min(1).max(65535).optional().describe("SSH port. Defaults to 22."),
|
|
11811
|
-
username: z17.string().regex(/^[A-Za-z0-9_][A-Za-z0-9._-]{0,63}$/, "Enter the account name on the device").describe("Account the agent signs in as."),
|
|
11812
|
-
screen_password: screenPasswordSchema.optional()
|
|
11813
|
-
});
|
|
11814
|
-
var updateEnvironmentDeviceRequestSchema = createEnvironmentDeviceRequestSchema.partial().extend({
|
|
11815
|
-
screen_password: z17.union([screenPasswordSchema, z17.literal("")]).optional().describe("New Screen Sharing password, or an empty string to remove it.")
|
|
11816
|
-
});
|
|
11817
|
-
var provisionedDeviceSchema = z17.object({
|
|
11818
|
-
name: z17.string(),
|
|
11819
|
-
host: z17.string(),
|
|
11820
|
-
port: z17.number(),
|
|
11821
|
-
username: z17.string(),
|
|
11822
|
-
private_key: z17.string(),
|
|
11823
|
-
screen_password: z17.string().optional()
|
|
11824
|
-
});
|
|
11825
|
-
|
|
11826
11839
|
// ../shared/src/routes/workspaces.ts
|
|
11827
11840
|
import { z as z18 } from "zod";
|
|
11828
11841
|
var WORKSPACE_STATUSES = ["active", "sleeping", "archived", "preparing", "error"];
|
|
@@ -20785,6 +20798,7 @@ export {
|
|
|
20785
20798
|
workspaceTokenResponseSchema,
|
|
20786
20799
|
legacyWorkspaceTokenBundleSchema,
|
|
20787
20800
|
engineMcpOAuthTokenResponseSchema,
|
|
20801
|
+
DEVICE_HOST_KEYS_HEADER,
|
|
20788
20802
|
provisionedDeviceSchema,
|
|
20789
20803
|
SUBAGENT_SERVICE_TIERS,
|
|
20790
20804
|
serviceTierRequestFields,
|
|
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
SUBPROCESS_MAX_BUFFER,
|
|
6
6
|
execFileAsync
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-X26DQM4O.js";
|
|
8
8
|
import {
|
|
9
9
|
isRecord as isRecord2
|
|
10
10
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
provisionedDeviceSchema,
|
|
22
22
|
readReplicasRuntimeEnv,
|
|
23
23
|
serializePosixEnvFile
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-PLWH35VJ.js";
|
|
25
25
|
|
|
26
26
|
// src/runtime-env-loader.ts
|
|
27
27
|
import { readFileSync } from "fs";
|
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
HOOK_EXEC_MAX_BUFFER_BYTES
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PLWH35VJ.js";
|
|
7
7
|
|
|
8
8
|
// src/utils/exec.ts
|
|
9
9
|
import { exec, execFile } from "child_process";
|
|
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
evaluateCommandProtection
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-LOSMI7ZJ.js";
|
|
7
|
+
import "./chunk-SAKMDQVZ.js";
|
|
8
|
+
import "./chunk-X26DQM4O.js";
|
|
9
9
|
import {
|
|
10
10
|
isRecord
|
|
11
11
|
} from "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-PLWH35VJ.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/command-protection-hook.ts
|
|
@@ -14,12 +14,12 @@ import {
|
|
|
14
14
|
recoverCompletedTurn,
|
|
15
15
|
spawnMuseMsp,
|
|
16
16
|
startMuseSession
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-LOV3MVJJ.js";
|
|
18
18
|
import {
|
|
19
19
|
AppServerProcess,
|
|
20
20
|
buildCodexAgentEnv
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-O4P6VNAB.js";
|
|
22
|
+
import "./chunk-X26DQM4O.js";
|
|
23
23
|
import {
|
|
24
24
|
AGENT,
|
|
25
25
|
OPENCODE_GO_PROVIDER,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
headlessAgentUsagePath,
|
|
30
30
|
isRecord,
|
|
31
31
|
withTimeout
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-PLWH35VJ.js";
|
|
33
33
|
import "./chunk-VEQXQN22.js";
|
|
34
34
|
|
|
35
35
|
// src/headless-agent.ts
|
package/dist/src/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
evaluateCommandProtection,
|
|
28
28
|
extractToolCommand,
|
|
29
29
|
reportCommandProtectionBlock
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-LOSMI7ZJ.js";
|
|
31
31
|
import {
|
|
32
32
|
ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
|
|
33
33
|
AGENT_MESSAGE_DELTA_METHOD,
|
|
@@ -65,10 +65,10 @@ import {
|
|
|
65
65
|
spawnMuseMsp,
|
|
66
66
|
startMuseSession,
|
|
67
67
|
uuidV7
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-LOV3MVJJ.js";
|
|
69
69
|
import {
|
|
70
70
|
publishedPullRequestUrls
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-GYXINP6G.js";
|
|
72
72
|
import {
|
|
73
73
|
ACCOUNT_RATE_LIMITS_READ_METHOD,
|
|
74
74
|
AsyncLock,
|
|
@@ -143,7 +143,7 @@ import {
|
|
|
143
143
|
timestampFromSeconds,
|
|
144
144
|
upsertCredentialFileLines,
|
|
145
145
|
writeSecureCredentialFile
|
|
146
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-M5JKWEZ2.js";
|
|
147
147
|
import {
|
|
148
148
|
ENGINE_ENV,
|
|
149
149
|
monolithRequest,
|
|
@@ -153,15 +153,15 @@ import {
|
|
|
153
153
|
resolveDiffBase,
|
|
154
154
|
setAgentCredentialSnapshot,
|
|
155
155
|
setLinearSessionId
|
|
156
|
-
} from "./chunk-
|
|
156
|
+
} from "./chunk-SAKMDQVZ.js";
|
|
157
157
|
import {
|
|
158
158
|
getCodexModelProvider
|
|
159
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-O4P6VNAB.js";
|
|
160
160
|
import {
|
|
161
161
|
SUBPROCESS_MAX_BUFFER,
|
|
162
162
|
execAsync,
|
|
163
163
|
execFileAsync
|
|
164
|
-
} from "./chunk-
|
|
164
|
+
} from "./chunk-X26DQM4O.js";
|
|
165
165
|
import {
|
|
166
166
|
isRecord as isRecord2
|
|
167
167
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -213,6 +213,7 @@ import {
|
|
|
213
213
|
DEFAULT_WEB_APP_URL,
|
|
214
214
|
DESKTOP_STREAM_PORT,
|
|
215
215
|
DEVICES_DIR,
|
|
216
|
+
DEVICE_HOST_KEYS_HEADER,
|
|
216
217
|
DEVICE_SCREEN_FILE_SUFFIX,
|
|
217
218
|
ENGINE_ACTIVATE_PATH,
|
|
218
219
|
ENGINE_HEALTH_MAX_WAIT_MS,
|
|
@@ -426,7 +427,7 @@ import {
|
|
|
426
427
|
workspaceTokenRequestSchema,
|
|
427
428
|
workspaceTokenResponseSchema,
|
|
428
429
|
wrapInTag
|
|
429
|
-
} from "./chunk-
|
|
430
|
+
} from "./chunk-PLWH35VJ.js";
|
|
430
431
|
import {
|
|
431
432
|
cloneMcpConfig,
|
|
432
433
|
ensureCompatibilityImports,
|
|
@@ -10568,23 +10569,102 @@ async function registerDesktopPreview(signal) {
|
|
|
10568
10569
|
);
|
|
10569
10570
|
}
|
|
10570
10571
|
|
|
10572
|
+
// src/services/device-relay.ts
|
|
10573
|
+
import { createServer } from "net";
|
|
10574
|
+
import { writeFileSync as writeFileSync2 } from "fs";
|
|
10575
|
+
import { rm as rm2 } from "fs/promises";
|
|
10576
|
+
import { createWebSocketStream } from "ws";
|
|
10577
|
+
var DEVICE_WAIT_MS = 2e4;
|
|
10578
|
+
var relays = /* @__PURE__ */ new Map();
|
|
10579
|
+
function pipe(local, device) {
|
|
10580
|
+
device.send("open");
|
|
10581
|
+
const stream = createWebSocketStream(device);
|
|
10582
|
+
const close = () => {
|
|
10583
|
+
local.destroy();
|
|
10584
|
+
stream.destroy();
|
|
10585
|
+
};
|
|
10586
|
+
local.on("error", close).on("close", close);
|
|
10587
|
+
stream.on("error", close).on("close", close);
|
|
10588
|
+
local.pipe(stream).pipe(local);
|
|
10589
|
+
}
|
|
10590
|
+
function remove(list, item) {
|
|
10591
|
+
const index = list.indexOf(item);
|
|
10592
|
+
if (index !== -1) list.splice(index, 1);
|
|
10593
|
+
}
|
|
10594
|
+
function attach(relay, local) {
|
|
10595
|
+
const device = relay.waiting.pop();
|
|
10596
|
+
if (device) return pipe(local, device);
|
|
10597
|
+
const timer = setTimeout(() => local.destroy(), DEVICE_WAIT_MS);
|
|
10598
|
+
const take = (next) => {
|
|
10599
|
+
clearTimeout(timer);
|
|
10600
|
+
pipe(local, next);
|
|
10601
|
+
};
|
|
10602
|
+
relay.pending.push(take);
|
|
10603
|
+
local.once("close", () => {
|
|
10604
|
+
clearTimeout(timer);
|
|
10605
|
+
remove(relay.pending, take);
|
|
10606
|
+
});
|
|
10607
|
+
}
|
|
10608
|
+
function acceptDeviceConnection(name, device, hostKeys) {
|
|
10609
|
+
const relay = relays.get(name);
|
|
10610
|
+
if (!relay) return device.close(4404, "This workspace has no such device connecting from itself");
|
|
10611
|
+
const knownHosts = hostKeys.map((key) => `${name} ${key}
|
|
10612
|
+
`).join("");
|
|
10613
|
+
if (knownHosts !== relay.knownHosts) {
|
|
10614
|
+
writeFileSync2(relay.knownHostsPath, knownHosts, { mode: 384 });
|
|
10615
|
+
relay.knownHosts = knownHosts;
|
|
10616
|
+
}
|
|
10617
|
+
const take = relay.pending.shift();
|
|
10618
|
+
if (take) return take(device);
|
|
10619
|
+
relay.waiting.push(device);
|
|
10620
|
+
device.once("close", () => remove(relay.waiting, device));
|
|
10621
|
+
}
|
|
10622
|
+
function stopDeviceRelays() {
|
|
10623
|
+
for (const relay of relays.values()) {
|
|
10624
|
+
relay.server.close();
|
|
10625
|
+
relay.waiting.forEach((device) => device.terminate());
|
|
10626
|
+
}
|
|
10627
|
+
relays.clear();
|
|
10628
|
+
}
|
|
10629
|
+
async function startDeviceRelays(names, paths, signal) {
|
|
10630
|
+
stopDeviceRelays();
|
|
10631
|
+
signal.addEventListener("abort", stopDeviceRelays, { once: true });
|
|
10632
|
+
await Promise.all(names.map(async (name) => {
|
|
10633
|
+
await rm2(paths.socket(name), { force: true });
|
|
10634
|
+
const relay = { server: createServer((local) => attach(relay, local)), knownHostsPath: paths.knownHosts(name), waiting: [], pending: [] };
|
|
10635
|
+
relays.set(name, relay);
|
|
10636
|
+
await new Promise((resolve7, reject) => relay.server.once("error", reject).listen(paths.socket(name), resolve7));
|
|
10637
|
+
}));
|
|
10638
|
+
}
|
|
10639
|
+
|
|
10571
10640
|
// src/services/device-service.ts
|
|
10572
|
-
import { mkdir as mkdir7, rm as
|
|
10641
|
+
import { mkdir as mkdir7, rm as rm3, writeFile as writeFile4 } from "fs/promises";
|
|
10573
10642
|
import { join as join8 } from "path";
|
|
10574
10643
|
var DEVICES_DIR2 = join8(ENGINE_ENV.HOME_DIR, DEVICES_DIR);
|
|
10575
10644
|
var TAILSCALED_UNIT = "replicas-tailscaled";
|
|
10645
|
+
var relayPaths = {
|
|
10646
|
+
socket: (name) => join8(DEVICES_DIR2, `${name}.sock`),
|
|
10647
|
+
knownHosts: (name) => join8(DEVICES_DIR2, `${name}.known_hosts`)
|
|
10648
|
+
};
|
|
10576
10649
|
function sshConfig(devices, tailnet) {
|
|
10577
10650
|
return devices.map((device) => [
|
|
10578
10651
|
`Host ${device.name}`,
|
|
10579
|
-
` HostName ${device.host}`,
|
|
10580
|
-
` Port ${device.port}`,
|
|
10581
10652
|
` User ${device.username}`,
|
|
10582
10653
|
` IdentityFile ${join8(DEVICES_DIR2, device.name)}`,
|
|
10583
10654
|
" IdentitiesOnly yes",
|
|
10584
|
-
" StrictHostKeyChecking accept-new",
|
|
10585
10655
|
" ServerAliveInterval 30",
|
|
10586
|
-
|
|
10587
|
-
|
|
10656
|
+
...device.host === null ? [
|
|
10657
|
+
` ProxyCommand websocat -b - unix:${relayPaths.socket(device.name)}`,
|
|
10658
|
+
// Anyone holding the device's token could answer through the relay, so only the identity the device pinned is trusted.
|
|
10659
|
+
` UserKnownHostsFile ${relayPaths.knownHosts(device.name)}`,
|
|
10660
|
+
" StrictHostKeyChecking yes"
|
|
10661
|
+
] : [
|
|
10662
|
+
` HostName ${device.host}`,
|
|
10663
|
+
` Port ${device.port}`,
|
|
10664
|
+
" StrictHostKeyChecking accept-new",
|
|
10665
|
+
// Userspace networking leaves the sandbox's routes and DNS alone, so tailnet names resolve through tailscaled.
|
|
10666
|
+
...tailnet ? [" ProxyCommand tailscale nc %h %p"] : []
|
|
10667
|
+
]
|
|
10588
10668
|
].join("\n")).join("\n\n") + "\n";
|
|
10589
10669
|
}
|
|
10590
10670
|
async function joinTailnet(authKey, workspaceId, signal) {
|
|
@@ -10613,11 +10693,10 @@ async function joinTailnet(authKey, workspaceId, signal) {
|
|
|
10613
10693
|
}
|
|
10614
10694
|
async function connectDevices(signal) {
|
|
10615
10695
|
const { REPLICAS_ENV_DEVICES: devices, TS_AUTHKEY: authKey, REPLICAS_WORKSPACE_ID: workspaceId } = ENGINE_ENV;
|
|
10616
|
-
await
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10620
|
-
}
|
|
10696
|
+
await rm3(DEVICES_DIR2, { recursive: true, force: true });
|
|
10697
|
+
const tailnetKey = devices.some((device) => device.host !== null) ? authKey : void 0;
|
|
10698
|
+
if (!tailnetKey) await execFileAsync("sudo", ["systemctl", "stop", TAILSCALED_UNIT], { signal }).catch(() => void 0);
|
|
10699
|
+
if (devices.length === 0) return;
|
|
10621
10700
|
await mkdir7(DEVICES_DIR2, { recursive: true, mode: 448 });
|
|
10622
10701
|
await Promise.all(devices.flatMap((device) => [
|
|
10623
10702
|
writeFile4(join8(DEVICES_DIR2, device.name), device.private_key, { mode: 384 }),
|
|
@@ -10627,24 +10706,27 @@ async function connectDevices(signal) {
|
|
|
10627
10706
|
{ mode: 384 }
|
|
10628
10707
|
)]
|
|
10629
10708
|
]));
|
|
10630
|
-
await writeFile4(join8(DEVICES_DIR2, "devices.conf"), sshConfig(devices,
|
|
10631
|
-
|
|
10709
|
+
await writeFile4(join8(DEVICES_DIR2, "devices.conf"), sshConfig(devices, tailnetKey !== void 0), { mode: 384 });
|
|
10710
|
+
await startDeviceRelays(devices.flatMap((device) => device.host === null ? [device.name] : []), relayPaths, signal);
|
|
10711
|
+
if (tailnetKey && workspaceId) await joinTailnet(tailnetKey, workspaceId, signal);
|
|
10632
10712
|
}
|
|
10633
10713
|
function devicesInstruction() {
|
|
10634
10714
|
const devices = ENGINE_ENV.REPLICAS_ENV_DEVICES;
|
|
10635
10715
|
if (devices.length === 0) return void 0;
|
|
10636
|
-
const list = devices.map((device) => `\`${device.name}\` (${device.username}@${device.host})`).join(", ");
|
|
10716
|
+
const list = devices.map((device) => `\`${device.name}\` (${device.username}@${device.host ?? device.name})`).join(", ");
|
|
10637
10717
|
const screens = devices.filter((device) => device.screen_password !== void 0).map((device) => `\`${device.name}\``);
|
|
10718
|
+
const relayed = devices.filter((device) => device.host === null).map((device) => `\`${device.name}\``);
|
|
10638
10719
|
return [
|
|
10639
10720
|
`The user's own computers are reachable over SSH by name: ${list}. Use \`ssh <name>\`, \`scp\` and \`rsync\` as usual, and \`ssh -L\` to reach a service running on one.`,
|
|
10640
10721
|
"They are personal machines with the user's files and accounts: change only what the task needs, and ask before anything destructive or hard to undo.",
|
|
10641
|
-
...ENGINE_ENV.TS_AUTHKEY ? ["They are reached through the user's tailnet. If a connection fails, `tailscale status` shows whether this workspace joined it."] : [],
|
|
10722
|
+
...ENGINE_ENV.TS_AUTHKEY && relayed.length < devices.length ? ["They are reached through the user's tailnet. If a connection fails, `tailscale status` shows whether this workspace joined it."] : [],
|
|
10723
|
+
...relayed.length > 0 ? [`${relayed.join(", ")} connect to this workspace from the device itself, while \`replicas device connect\` runs there. If \`ssh\` to one closes before it signs in, ask the user to start that command on it again. If it fails host key verification, something other than that device answered: never bypass the check, and tell the user.`] : [],
|
|
10642
10724
|
...screens.length > 0 ? [`To see and control the screen of ${screens.join(", ")}, run \`replicas computer screen <name>\`: it shows on this desktop, where the other \`replicas computer\` commands drive it. Prefer \`ssh\` when a command does the job.`] : []
|
|
10643
10725
|
].join(" ");
|
|
10644
10726
|
}
|
|
10645
10727
|
|
|
10646
10728
|
// src/services/chat/chat-service.ts
|
|
10647
|
-
import { appendFile as appendFile5, copyFile as copyFile2, mkdir as mkdir18, readFile as readFile17, rename as rename3, rm as
|
|
10729
|
+
import { appendFile as appendFile5, copyFile as copyFile2, mkdir as mkdir18, readFile as readFile17, rename as rename3, rm as rm6, stat as stat6 } from "fs/promises";
|
|
10648
10730
|
import { join as join29 } from "path";
|
|
10649
10731
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
10650
10732
|
import { z as z3 } from "zod";
|
|
@@ -17045,7 +17127,7 @@ ${pending}
|
|
|
17045
17127
|
|
|
17046
17128
|
// src/managers/opencode-manager.ts
|
|
17047
17129
|
import { existsSync as existsSync8 } from "fs";
|
|
17048
|
-
import { copyFile, mkdir as mkdir13, readFile as readFile10, rm as
|
|
17130
|
+
import { copyFile, mkdir as mkdir13, readFile as readFile10, rm as rm4 } from "fs/promises";
|
|
17049
17131
|
import { delimiter, dirname as dirname7, join as join15 } from "path";
|
|
17050
17132
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
17051
17133
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
@@ -17337,7 +17419,7 @@ var OpencodeManager = class extends CodingAgentManager {
|
|
|
17337
17419
|
}
|
|
17338
17420
|
await mkdir13(dirname7(OPENCODE_COMMAND_PROTECTION_PLUGIN_PATH), { recursive: true });
|
|
17339
17421
|
await copyFile(OPENCODE_COMMAND_PROTECTION_PLUGIN_SOURCE, OPENCODE_COMMAND_PROTECTION_PLUGIN_PATH);
|
|
17340
|
-
await
|
|
17422
|
+
await rm4(OPENCODE_LEGACY_COMMAND_PROTECTION_PLUGIN_PATH, { force: true });
|
|
17341
17423
|
process.env.REPLICAS_COMMAND_PROTECTION_HOOK_PATH = getCommandProtectionHookPath();
|
|
17342
17424
|
process.env.REPLICAS_POST_TOOL_PR_HOOK_PATH = getPostToolPrHookPath();
|
|
17343
17425
|
process.env.REPLICAS_COMMAND_PROTECTION_RUNTIME_PATH = process.execPath;
|
|
@@ -40221,7 +40303,7 @@ async function probeMcpEndpoint(url3) {
|
|
|
40221
40303
|
}
|
|
40222
40304
|
|
|
40223
40305
|
// ../node_modules/.bun/pi-mcp-adapter@2.32.1+04b0d7b0bc944965/node_modules/pi-mcp-adapter/npx-resolver.ts
|
|
40224
|
-
import { existsSync as existsSync9, readFileSync as readFileSync2, realpathSync, readdirSync, statSync as statSync2, writeFileSync as
|
|
40306
|
+
import { existsSync as existsSync9, readFileSync as readFileSync2, realpathSync, readdirSync, statSync as statSync2, writeFileSync as writeFileSync3, renameSync, mkdirSync as mkdirSync2, openSync, readSync, closeSync, unlinkSync } from "fs";
|
|
40225
40307
|
import { join as join16, dirname as dirname8, extname as extname2, resolve as resolve2, sep } from "path";
|
|
40226
40308
|
|
|
40227
40309
|
// ../node_modules/.bun/pi-mcp-adapter@2.32.1+04b0d7b0bc944965/node_modules/pi-mcp-adapter/abort.ts
|
|
@@ -40636,7 +40718,7 @@ function clearLegacyCache() {
|
|
|
40636
40718
|
unlinkSync(cachePath);
|
|
40637
40719
|
} catch {
|
|
40638
40720
|
try {
|
|
40639
|
-
|
|
40721
|
+
writeFileSync3(cachePath, "", "utf-8");
|
|
40640
40722
|
} catch {
|
|
40641
40723
|
}
|
|
40642
40724
|
}
|
|
@@ -40658,7 +40740,7 @@ function saveCacheEntry(key, entry) {
|
|
|
40658
40740
|
const merged = { version: CACHE_VERSION, entries };
|
|
40659
40741
|
merged.entries[key] = entry;
|
|
40660
40742
|
const tmpPath = `${cachePath}.${process.pid}.tmp`;
|
|
40661
|
-
|
|
40743
|
+
writeFileSync3(tmpPath, JSON.stringify(merged, null, 2), "utf-8");
|
|
40662
40744
|
renameSync(tmpPath, cachePath);
|
|
40663
40745
|
} catch {
|
|
40664
40746
|
}
|
|
@@ -42445,7 +42527,7 @@ defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
|
|
|
42445
42527
|
var open_default = open2;
|
|
42446
42528
|
|
|
42447
42529
|
// ../node_modules/.bun/pi-mcp-adapter@2.32.1+04b0d7b0bc944965/node_modules/pi-mcp-adapter/mcp-callback-server.ts
|
|
42448
|
-
import { createServer } from "http";
|
|
42530
|
+
import { createServer as createServer2 } from "http";
|
|
42449
42531
|
var PAGE_STYLE = `
|
|
42450
42532
|
:root { color-scheme: light dark; }
|
|
42451
42533
|
* { box-sizing: border-box; }
|
|
@@ -42695,7 +42777,7 @@ async function ensureCallbackServerLocked(options = {}) {
|
|
|
42695
42777
|
);
|
|
42696
42778
|
}
|
|
42697
42779
|
}
|
|
42698
|
-
const candidateServer =
|
|
42780
|
+
const candidateServer = createServer2(handleRequest);
|
|
42699
42781
|
const listenPort = strictPort ? requiredPort : 0;
|
|
42700
42782
|
try {
|
|
42701
42783
|
await new Promise((resolve7, reject) => {
|
|
@@ -47524,7 +47606,7 @@ function getEffectiveIdleTimeoutMinutes(state, serverName) {
|
|
|
47524
47606
|
}
|
|
47525
47607
|
|
|
47526
47608
|
// ../node_modules/.bun/pi-mcp-adapter@2.32.1+04b0d7b0bc944965/node_modules/pi-mcp-adapter/onboarding-state.ts
|
|
47527
|
-
import { existsSync as existsSync12, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as
|
|
47609
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync4, renameSync as renameSync2 } from "fs";
|
|
47528
47610
|
import { dirname as dirname12 } from "path";
|
|
47529
47611
|
var DEFAULT_STATE = {
|
|
47530
47612
|
version: 1,
|
|
@@ -47554,7 +47636,7 @@ function saveOnboardingState(state) {
|
|
|
47554
47636
|
const path7 = getOnboardingStatePath();
|
|
47555
47637
|
mkdirSync4(dirname12(path7), { recursive: true });
|
|
47556
47638
|
const tmpPath = `${path7}.${process.pid}.tmp`;
|
|
47557
|
-
|
|
47639
|
+
writeFileSync4(tmpPath, `${JSON.stringify(state, null, 2)}
|
|
47558
47640
|
`, "utf-8");
|
|
47559
47641
|
renameSync2(tmpPath, path7);
|
|
47560
47642
|
}
|
|
@@ -48177,7 +48259,7 @@ async function openMcpAuthPanel(state, pi, ctx, configOverridePath) {
|
|
|
48177
48259
|
}
|
|
48178
48260
|
|
|
48179
48261
|
// ../node_modules/.bun/pi-mcp-adapter@2.32.1+04b0d7b0bc944965/node_modules/pi-mcp-adapter/tool-registrar.ts
|
|
48180
|
-
import { mkdtempSync, rmSync as rmSync3, writeFileSync as
|
|
48262
|
+
import { mkdtempSync, rmSync as rmSync3, writeFileSync as writeFileSync5 } from "fs";
|
|
48181
48263
|
import { tmpdir } from "os";
|
|
48182
48264
|
import { join as join19 } from "path";
|
|
48183
48265
|
var MAX_BINARY_RESOURCE_BYTES = 10 * 1024 * 1024;
|
|
@@ -48294,7 +48376,7 @@ function materializeBinaryResource(resource, scope) {
|
|
|
48294
48376
|
session.bytes += decodedBytes;
|
|
48295
48377
|
session.files += 1;
|
|
48296
48378
|
try {
|
|
48297
|
-
|
|
48379
|
+
writeFileSync5(filePath, Buffer.from(resource.blob, "base64"), { flag: "wx", mode: 384 });
|
|
48298
48380
|
} catch {
|
|
48299
48381
|
try {
|
|
48300
48382
|
rmSync3(filePath, { force: true });
|
|
@@ -48381,7 +48463,7 @@ function stringifyStructuredContent(value) {
|
|
|
48381
48463
|
|
|
48382
48464
|
// ../node_modules/.bun/pi-mcp-adapter@2.32.1+04b0d7b0bc944965/node_modules/pi-mcp-adapter/mcp-output-guard.ts
|
|
48383
48465
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
48384
|
-
import { mkdtemp, rm as
|
|
48466
|
+
import { mkdtemp, rm as rm5, writeFile as writeFile8 } from "fs/promises";
|
|
48385
48467
|
import { tmpdir as tmpdir2 } from "os";
|
|
48386
48468
|
import { dirname as dirname13, join as join20 } from "path";
|
|
48387
48469
|
var DEFAULT_MCP_OUTPUT_MAX_BYTES = 50 * 1024;
|
|
@@ -48701,7 +48783,7 @@ async function saveArtifact(kind, text) {
|
|
|
48701
48783
|
}
|
|
48702
48784
|
async function discardArtifact(path7) {
|
|
48703
48785
|
try {
|
|
48704
|
-
await
|
|
48786
|
+
await rm5(dirname13(path7), { recursive: true, force: true });
|
|
48705
48787
|
} catch {
|
|
48706
48788
|
}
|
|
48707
48789
|
}
|
|
@@ -57351,13 +57433,13 @@ function installMcpAdapter(pi, options) {
|
|
|
57351
57433
|
const unregisterTool = pi.unregisterTool;
|
|
57352
57434
|
const unregistered = toolNames.filter((toolName) => unregisterTool?.(toolName) === true);
|
|
57353
57435
|
const fallbackNames = toolNames.filter((toolName) => !unregistered.includes(toolName));
|
|
57354
|
-
const
|
|
57436
|
+
const remove2 = new Set(toolNames);
|
|
57355
57437
|
const activeTools = getActiveToolsIfReady();
|
|
57356
57438
|
if (!activeTools || activeTools.length === 0) {
|
|
57357
57439
|
for (const toolName of fallbackNames) fallbackDeactivatedTools.add(toolName);
|
|
57358
57440
|
return unregistered;
|
|
57359
57441
|
}
|
|
57360
|
-
const nextActiveTools = activeTools.filter((name) => !
|
|
57442
|
+
const nextActiveTools = activeTools.filter((name) => !remove2.has(name));
|
|
57361
57443
|
if (nextActiveTools.length !== activeTools.length) {
|
|
57362
57444
|
for (const toolName of fallbackNames) fallbackDeactivatedTools.add(toolName);
|
|
57363
57445
|
pi.setActiveTools(nextActiveTools);
|
|
@@ -61183,9 +61265,9 @@ ${decisions}` };
|
|
|
61183
61265
|
historyPath,
|
|
61184
61266
|
`${historyPath}.pages.jsonl`,
|
|
61185
61267
|
`${historyPath}.pages.index.json`
|
|
61186
|
-
].map((path7) =>
|
|
61187
|
-
await
|
|
61188
|
-
await
|
|
61268
|
+
].map((path7) => rm6(path7, { force: true })));
|
|
61269
|
+
await rm6(chatMessageSendersFilePath(persisted.id), { force: true });
|
|
61270
|
+
await rm6(join29(FORKS_DIR, persisted.id), { recursive: true, force: true });
|
|
61189
61271
|
}
|
|
61190
61272
|
switchHarness(source, request) {
|
|
61191
61273
|
const switching = (async () => {
|
|
@@ -64572,8 +64654,8 @@ async function installWorkspaceSdk() {
|
|
|
64572
64654
|
}
|
|
64573
64655
|
|
|
64574
64656
|
// src/services/git-push-tracker.ts
|
|
64575
|
-
import { mkdir as mkdir21, rm as
|
|
64576
|
-
import { createServer as
|
|
64657
|
+
import { mkdir as mkdir21, rm as rm7 } from "fs/promises";
|
|
64658
|
+
import { createServer as createServer3 } from "net";
|
|
64577
64659
|
import { join as join35 } from "path";
|
|
64578
64660
|
var SOCKET_PATH = join35(ENGINE_DIR, "git-trace2.sock");
|
|
64579
64661
|
var MAX_LINE_LENGTH = 1024 * 1024;
|
|
@@ -64586,8 +64668,8 @@ function startGitPushTracker() {
|
|
|
64586
64668
|
}
|
|
64587
64669
|
async function listen() {
|
|
64588
64670
|
await mkdir21(ENGINE_DIR, { recursive: true });
|
|
64589
|
-
await
|
|
64590
|
-
const server3 =
|
|
64671
|
+
await rm7(SOCKET_PATH, { force: true });
|
|
64672
|
+
const server3 = createServer3((socket) => {
|
|
64591
64673
|
let buffered = "";
|
|
64592
64674
|
let ignored = false;
|
|
64593
64675
|
let push = false;
|
|
@@ -65020,8 +65102,9 @@ async function sleep3() {
|
|
|
65020
65102
|
await engineLogger.flush();
|
|
65021
65103
|
return createSuccessResult({ state: lifecycle.state, workspaceId: lifecycle.workspaceId });
|
|
65022
65104
|
}
|
|
65023
|
-
var
|
|
65105
|
+
var webSockets = new WebSocketServer({ noServer: true });
|
|
65024
65106
|
var TERMINAL_SOCKET_PATH = /^\/terminal\/sessions\/([^/]+)\/ws$/;
|
|
65107
|
+
var DEVICE_SOCKET_PATH = /^\/devices\/([^/]+)\/ws$/;
|
|
65025
65108
|
var server2 = serve(
|
|
65026
65109
|
{
|
|
65027
65110
|
fetch: app.fetch,
|
|
@@ -65043,15 +65126,20 @@ var server2 = serve(
|
|
|
65043
65126
|
);
|
|
65044
65127
|
server2.on("connection", recordProxyConnection);
|
|
65045
65128
|
server2.on("upgrade", (req, socket, head) => {
|
|
65046
|
-
const
|
|
65047
|
-
|
|
65048
|
-
|
|
65129
|
+
const path7 = new URL(req.url ?? "/", "http://engine").pathname;
|
|
65130
|
+
const sessionId = TERMINAL_SOCKET_PATH.exec(path7)?.[1];
|
|
65131
|
+
const device = DEVICE_SOCKET_PATH.exec(path7)?.[1];
|
|
65132
|
+
if (!(sessionId || device) || req.headers["x-replicas-engine-secret"] !== ENGINE_ENV.REPLICAS_ENGINE_SECRET || !lifecycle.active) {
|
|
65133
|
+
socket.end(`HTTP/1.1 ${sessionId || device ? "401 Unauthorized" : "404 Not Found"}\r
|
|
65049
65134
|
Connection: close\r
|
|
65050
65135
|
\r
|
|
65051
65136
|
`);
|
|
65052
65137
|
return;
|
|
65053
65138
|
}
|
|
65054
|
-
|
|
65139
|
+
webSockets.handleUpgrade(req, socket, head, (ws) => {
|
|
65140
|
+
if (sessionId) attachTerminalSocket(decodeURIComponent(sessionId), ws);
|
|
65141
|
+
else if (device) acceptDeviceConnection(decodeURIComponent(device), ws, String(req.headers[DEVICE_HOST_KEYS_HEADER] ?? "").split(",").filter(Boolean));
|
|
65142
|
+
});
|
|
65055
65143
|
});
|
|
65056
65144
|
/*! Bundled license information:
|
|
65057
65145
|
|
|
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
publishedPullRequestUrls
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GYXINP6G.js";
|
|
7
7
|
import {
|
|
8
8
|
isRecord
|
|
9
9
|
} from "./chunk-UZSNFLDQ.js";
|
|
10
10
|
import {
|
|
11
11
|
shouldRefreshPullRequests
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PLWH35VJ.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/services/post-tool-pr-notifier.ts
|
package/dist/src/subagent-mcp.js
CHANGED