replicas-engine 0.1.992 → 0.1.994
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-SYEHGXS4.js → asp-host-NXUZ3VZ7.js} +5 -5
- package/dist/src/{chunk-N3QARJXC.js → chunk-FUHUBWBQ.js} +19 -14
- package/dist/src/{chunk-IXGE52GO.js → chunk-K5CNOXH2.js} +3 -3
- package/dist/src/{chunk-XYQGBMCF.js → chunk-MAFKR626.js} +9 -3
- package/dist/src/{chunk-F7L43VMI.js → chunk-SR3TRBEI.js} +1 -1
- package/dist/src/{chunk-AXLQAMWY.js → chunk-VRMTJFZQ.js} +205 -178
- package/dist/src/{chunk-TKYLRJF4.js → chunk-W3M6AME6.js} +3 -3
- package/dist/src/{chunk-ZZ5OWSEB.js → chunk-W7DCWL4S.js} +1 -1
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +3 -3
- package/dist/src/index.js +63 -34
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/subagent-mcp.js +1 -1
- package/package.json +1 -1
- package/workspace-sdk/index.js +2 -1
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
getCodexAspHost,
|
|
6
6
|
restartCodexAspHost,
|
|
7
7
|
restartCodexAspHostIfRunning
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-FUHUBWBQ.js";
|
|
9
|
+
import "./chunk-MAFKR626.js";
|
|
10
|
+
import "./chunk-K5CNOXH2.js";
|
|
11
|
+
import "./chunk-W7DCWL4S.js";
|
|
12
12
|
import "./chunk-UZSNFLDQ.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-VRMTJFZQ.js";
|
|
14
14
|
import "./chunk-VEQXQN22.js";
|
|
15
15
|
export {
|
|
16
16
|
getCodexAspHost,
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
ENGINE_ENV,
|
|
6
6
|
monolithRequest,
|
|
7
7
|
setAgentCredentialSnapshot
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-MAFKR626.js";
|
|
9
9
|
import {
|
|
10
10
|
AppServerProcess,
|
|
11
11
|
buildCodexAgentEnv
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-K5CNOXH2.js";
|
|
13
13
|
import {
|
|
14
14
|
SUBPROCESS_MAX_BUFFER,
|
|
15
15
|
execFileAsync
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-W7DCWL4S.js";
|
|
17
17
|
import {
|
|
18
18
|
isRecord
|
|
19
19
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -23,11 +23,12 @@ import {
|
|
|
23
23
|
codexAuthEnvFromResponse,
|
|
24
24
|
createErrorResult,
|
|
25
25
|
createSuccessResult,
|
|
26
|
+
isSameCredential,
|
|
26
27
|
listOllamaModels,
|
|
27
28
|
listOpenAICompatibleModels,
|
|
28
29
|
readOllamaAuthEnv,
|
|
29
30
|
resolveOpenAICompatibleModelsUrl
|
|
30
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-VRMTJFZQ.js";
|
|
31
32
|
|
|
32
33
|
// src/managers/codex-token-manager.ts
|
|
33
34
|
import { promises as fs } from "fs";
|
|
@@ -70,14 +71,17 @@ function listCredentialFallbacks() {
|
|
|
70
71
|
function listExhaustedCredentials(provider) {
|
|
71
72
|
return [...exhaustedByAgent.get(provider)?.values() ?? []];
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
+
function routineRefreshRequest(provider) {
|
|
74
75
|
const live = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS[provider];
|
|
75
|
-
const excludeCredentials = listExhaustedCredentials(provider).filter((spent) =>
|
|
76
|
-
return
|
|
76
|
+
const excludeCredentials = listExhaustedCredentials(provider).filter((spent) => !live || !isSameCredential(spent, live));
|
|
77
|
+
return {
|
|
78
|
+
...excludeCredentials.length > 0 ? { excludeCredentials } : {},
|
|
79
|
+
...live ? { currentCredential: live } : {}
|
|
80
|
+
};
|
|
77
81
|
}
|
|
78
82
|
function recordExhaustedCredential(provider, credential) {
|
|
79
83
|
const spent = exhaustedByAgent.get(provider) ?? /* @__PURE__ */ new Map();
|
|
80
|
-
spent.set(`${credential.method}|${credential.scope}`, credential);
|
|
84
|
+
spent.set(`${credential.method}|${credential.scope}|${credential.credentialId ?? ""}`, credential);
|
|
81
85
|
exhaustedByAgent.set(provider, spent);
|
|
82
86
|
}
|
|
83
87
|
|
|
@@ -254,13 +258,13 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
254
258
|
return null;
|
|
255
259
|
}
|
|
256
260
|
async doRefresh(_config) {
|
|
257
|
-
await this.refreshWithRequest(
|
|
261
|
+
await this.refreshWithRequest(routineRefreshRequest("codex"), true);
|
|
258
262
|
}
|
|
259
263
|
async switchCredentials(data) {
|
|
260
264
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
261
265
|
await this.applyCredentialsResponse(data);
|
|
262
266
|
setAgentCredentialSnapshot("codex", data);
|
|
263
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
267
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-NXUZ3VZ7.js");
|
|
264
268
|
await restartCodexAspHostIfRunning2();
|
|
265
269
|
});
|
|
266
270
|
await this.start(true);
|
|
@@ -278,9 +282,10 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
278
282
|
}
|
|
279
283
|
const data = await response.json();
|
|
280
284
|
await this.applyCredentialUpdate(generation, async () => {
|
|
285
|
+
const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
|
|
281
286
|
await this.applyCredentialsResponse(data);
|
|
282
|
-
if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
|
|
283
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
287
|
+
if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
|
|
288
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-NXUZ3VZ7.js");
|
|
284
289
|
await restartCodexAspHostIfRunning2();
|
|
285
290
|
}
|
|
286
291
|
setAgentCredentialSnapshot("codex", data);
|
|
@@ -290,7 +295,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
290
295
|
}
|
|
291
296
|
async prepareAspOauthOptions() {
|
|
292
297
|
if (ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD !== "oauth") return {};
|
|
293
|
-
const response = await this.refreshWithRequest();
|
|
298
|
+
const response = await this.refreshWithRequest(routineRefreshRequest("codex"));
|
|
294
299
|
if (response.type !== "oauth") return {};
|
|
295
300
|
const login = this.buildAspOauthLogin(response);
|
|
296
301
|
let credential = login.credential;
|
|
@@ -509,7 +514,7 @@ export {
|
|
|
509
514
|
clearCredentialFallbacks,
|
|
510
515
|
recordCredentialFallback,
|
|
511
516
|
listCredentialFallbacks,
|
|
512
|
-
|
|
517
|
+
routineRefreshRequest,
|
|
513
518
|
recordExhaustedCredential,
|
|
514
519
|
refreshDelayMs,
|
|
515
520
|
BaseRefreshManager,
|
|
@@ -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-W7DCWL4S.js";
|
|
7
7
|
import {
|
|
8
8
|
isVersionBelow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VRMTJFZQ.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.994";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
isValidAgentProvider,
|
|
15
15
|
parsePosixEnvFile,
|
|
16
16
|
readReplicasRuntimeEnv
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-VRMTJFZQ.js";
|
|
18
18
|
|
|
19
19
|
// src/runtime-env-loader.ts
|
|
20
20
|
import { readFileSync } from "fs";
|
|
@@ -161,11 +161,17 @@ function reloadEngineEnv(runtimeEnvValues) {
|
|
|
161
161
|
ENGINE_ENV = loadEngineEnv(runtimeEnvValues);
|
|
162
162
|
return ENGINE_ENV;
|
|
163
163
|
}
|
|
164
|
-
function setAgentCredentialSnapshot(provider, { type, scope, revision, account }) {
|
|
164
|
+
function setAgentCredentialSnapshot(provider, { type, scope, revision, account, credentialId }) {
|
|
165
165
|
if (!scope) return;
|
|
166
166
|
ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS = {
|
|
167
167
|
...ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS,
|
|
168
|
-
[provider]: {
|
|
168
|
+
[provider]: {
|
|
169
|
+
method: type,
|
|
170
|
+
scope,
|
|
171
|
+
...revision ? { revision } : {},
|
|
172
|
+
...account ? { account } : {},
|
|
173
|
+
...credentialId ? { credentialId } : {}
|
|
174
|
+
}
|
|
169
175
|
};
|
|
170
176
|
process.env.REPLICAS_AGENT_CREDENTIALS = JSON.stringify(ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS);
|
|
171
177
|
}
|
|
@@ -1001,14 +1001,21 @@ function isAgentChatActivityRecord(value) {
|
|
|
1001
1001
|
}
|
|
1002
1002
|
var credentialAccountSchema = z2.object({
|
|
1003
1003
|
ownerName: z2.string().optional(),
|
|
1004
|
-
email: z2.string().optional()
|
|
1004
|
+
email: z2.string().optional(),
|
|
1005
|
+
/** 1-based place in the owner's account pool, set only when the pool holds several accounts. */
|
|
1006
|
+
ordinal: z2.number().int().positive().optional()
|
|
1005
1007
|
});
|
|
1006
1008
|
var agentCredentialSnapshotSchema = z2.object({
|
|
1007
1009
|
method: z2.enum(CREDENTIAL_METHOD),
|
|
1008
1010
|
scope: z2.enum(CREDENTIAL_SCOPE),
|
|
1009
1011
|
revision: z2.string().optional(),
|
|
1010
|
-
account: credentialAccountSchema.optional()
|
|
1012
|
+
account: credentialAccountSchema.optional(),
|
|
1013
|
+
/** The `credentials` row, which tells apart accounts pooled under one method and scope. */
|
|
1014
|
+
credentialId: z2.string().optional()
|
|
1011
1015
|
});
|
|
1016
|
+
function isSameCredential(a, b) {
|
|
1017
|
+
return a.method === b.method && a.scope === b.scope && a.credentialId === b.credentialId;
|
|
1018
|
+
}
|
|
1012
1019
|
function isAuthMethod(value) {
|
|
1013
1020
|
return typeof value === "string" && Object.values(CREDENTIAL_METHOD).some((method) => method === value);
|
|
1014
1021
|
}
|
|
@@ -1852,8 +1859,8 @@ function detectAgentQuotaLimit(text2) {
|
|
|
1852
1859
|
|
|
1853
1860
|
// ../shared/src/auth-fallback.ts
|
|
1854
1861
|
function describeCredential(provider, credential) {
|
|
1855
|
-
const
|
|
1856
|
-
const {
|
|
1862
|
+
const { ownerName, email, ordinal } = credential.account ?? {};
|
|
1863
|
+
const label = `${getCredentialMethodLabel(provider, credential.method)}${ordinal ? ` #${ordinal}` : ""}`;
|
|
1857
1864
|
const owner = credential.scope === CREDENTIAL_SCOPE.USER ? ownerName ? `${ownerName}'s personal ${label}` : `your ${label}` : credential.scope === CREDENTIAL_SCOPE.ORG ? `the organization's ${label}` : `the ${label}`;
|
|
1858
1865
|
return email ? `${owner} (${email})` : owner;
|
|
1859
1866
|
}
|
|
@@ -1879,7 +1886,7 @@ function describeAuthFallback(payload) {
|
|
|
1879
1886
|
import { z as z6 } from "zod";
|
|
1880
1887
|
var WORKSPACE_CREDENTIAL_PROVIDERS = ["claude", "codex"];
|
|
1881
1888
|
var workspaceCredentialProviderSchema = z6.enum(WORKSPACE_CREDENTIAL_PROVIDERS);
|
|
1882
|
-
var workspaceCredentialSelectionSchema = agentCredentialSnapshotSchema.omit({ revision: true, account: true });
|
|
1889
|
+
var workspaceCredentialSelectionSchema = agentCredentialSnapshotSchema.omit({ revision: true, account: true, credentialId: true });
|
|
1883
1890
|
var createWorkspaceCredentialSchema = workspaceCredentialSelectionSchema.extend({
|
|
1884
1891
|
provider: z6.enum(VALID_AGENT_PROVIDERS)
|
|
1885
1892
|
}).refine(({ provider, method }) => agentCredentialMethods(provider).includes(method), {
|
|
@@ -1963,6 +1970,13 @@ function defaultForkChatTitle(source, provider) {
|
|
|
1963
1970
|
return isDefaultChat(source) ? `Forked from ${source.title}` : `${source.title} (${getProviderDisplayName(provider)})`;
|
|
1964
1971
|
}
|
|
1965
1972
|
|
|
1973
|
+
// ../shared/src/credential-pool.ts
|
|
1974
|
+
import { z as z9 } from "zod";
|
|
1975
|
+
var MAX_CREDENTIAL_POOL_ACCOUNTS = 10;
|
|
1976
|
+
var reorderCredentialPoolSchema = z9.object({
|
|
1977
|
+
credential_ids: z9.array(z9.string().uuid()).min(1).max(MAX_CREDENTIAL_POOL_ACCOUNTS)
|
|
1978
|
+
});
|
|
1979
|
+
|
|
1966
1980
|
// ../shared/src/display-message/types.ts
|
|
1967
1981
|
var BACKGROUND_TASK_SUBTYPES = /* @__PURE__ */ new Set([
|
|
1968
1982
|
"task_started",
|
|
@@ -2662,10 +2676,10 @@ function buildCodeHostPrUrl(repoUrl, provider, prNumber) {
|
|
|
2662
2676
|
}
|
|
2663
2677
|
|
|
2664
2678
|
// ../shared/src/replicas-mcp.ts
|
|
2665
|
-
import { z as
|
|
2679
|
+
import { z as z11 } from "zod";
|
|
2666
2680
|
|
|
2667
2681
|
// ../shared/src/automations/trigger-schemas.ts
|
|
2668
|
-
import { z as
|
|
2682
|
+
import { z as z10 } from "zod";
|
|
2669
2683
|
|
|
2670
2684
|
// ../shared/src/uuid.ts
|
|
2671
2685
|
function createUuidFromHex(value) {
|
|
@@ -2674,22 +2688,22 @@ function createUuidFromHex(value) {
|
|
|
2674
2688
|
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
2675
2689
|
|
|
2676
2690
|
// ../shared/src/automations/trigger-schemas.ts
|
|
2677
|
-
var repositoryTriggerConfigSchema =
|
|
2678
|
-
event:
|
|
2679
|
-
repository_ids:
|
|
2680
|
-
group_pr_events:
|
|
2681
|
-
excluded_actors:
|
|
2691
|
+
var repositoryTriggerConfigSchema = z10.object({
|
|
2692
|
+
event: z10.string(),
|
|
2693
|
+
repository_ids: z10.array(z10.string().regex(UUID_RE, "must be a repository id")).optional(),
|
|
2694
|
+
group_pr_events: z10.boolean().optional(),
|
|
2695
|
+
excluded_actors: z10.array(z10.string()).optional()
|
|
2682
2696
|
});
|
|
2683
|
-
var cronTriggerSchema =
|
|
2684
|
-
var githubTriggerSchema =
|
|
2685
|
-
var gitlabTriggerSchema =
|
|
2686
|
-
var automationTriggerSchema =
|
|
2697
|
+
var cronTriggerSchema = z10.object({ type: z10.literal("cron"), config: z10.object({ schedule: z10.string(), timezone: z10.string().optional() }) });
|
|
2698
|
+
var githubTriggerSchema = z10.object({ type: z10.literal("github"), config: repositoryTriggerConfigSchema });
|
|
2699
|
+
var gitlabTriggerSchema = z10.object({ type: z10.literal("gitlab"), config: repositoryTriggerConfigSchema });
|
|
2700
|
+
var automationTriggerSchema = z10.discriminatedUnion("type", [
|
|
2687
2701
|
cronTriggerSchema,
|
|
2688
2702
|
githubTriggerSchema,
|
|
2689
2703
|
gitlabTriggerSchema,
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2704
|
+
z10.object({ type: z10.literal("slack"), config: z10.object({ event: z10.string(), channel_ids: z10.array(z10.string()).optional(), group_thread_replies: z10.boolean().optional() }) }),
|
|
2705
|
+
z10.object({ type: z10.literal("sentry"), config: z10.object({ event: z10.string(), project_slugs: z10.array(z10.string()).optional(), min_level: z10.string().optional() }) }),
|
|
2706
|
+
z10.object({ type: z10.literal("custom"), config: z10.object({}) })
|
|
2693
2707
|
]);
|
|
2694
2708
|
|
|
2695
2709
|
// ../shared/src/replicas-mcp.ts
|
|
@@ -2706,14 +2720,14 @@ var REPLICAS_MCP_TOOLS = {
|
|
|
2706
2720
|
readSubagent: "read_subagent",
|
|
2707
2721
|
archiveSubagent: "archive_subagent"
|
|
2708
2722
|
};
|
|
2709
|
-
var automationToolInputSchema =
|
|
2710
|
-
name:
|
|
2711
|
-
prompt:
|
|
2712
|
-
environment_id:
|
|
2713
|
-
triggers:
|
|
2723
|
+
var automationToolInputSchema = z11.object({
|
|
2724
|
+
name: z11.string().describe("Short automation name."),
|
|
2725
|
+
prompt: z11.string().describe("Prompt each automation run starts with."),
|
|
2726
|
+
environment_id: z11.string().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.`),
|
|
2727
|
+
triggers: z11.array(automationTriggerSchema).min(1).describe(
|
|
2714
2728
|
'One or more triggers. Cron: `{ "type": "cron", "config": { "schedule": "0 9 * * 1", "timezone": "America/New_York" } }`. GitHub: `{ "type": "github", "config": { "event": "pull_request.opened", "repository_ids": ["<repository uuid>"] } }`.'
|
|
2715
2729
|
),
|
|
2716
|
-
description:
|
|
2730
|
+
description: z11.string().optional().describe("One-line summary shown in the dashboard.")
|
|
2717
2731
|
});
|
|
2718
2732
|
|
|
2719
2733
|
// ../shared/src/default-skills/replicas-agent/abilities/computer.ts
|
|
@@ -2986,7 +3000,7 @@ var DOCKER_ABILITY = {
|
|
|
2986
3000
|
};
|
|
2987
3001
|
|
|
2988
3002
|
// ../shared/src/routes/environment-setups.ts
|
|
2989
|
-
import { z as
|
|
3003
|
+
import { z as z12 } from "zod";
|
|
2990
3004
|
var ENVIRONMENT_SETUP_STEPS = [
|
|
2991
3005
|
{ key: "understand", label: "Understand the codebase" },
|
|
2992
3006
|
{ key: "install", label: "Install dependencies and run the app" },
|
|
@@ -3020,17 +3034,17 @@ var ENVIRONMENT_SETUP_LIMITS = {
|
|
|
3020
3034
|
};
|
|
3021
3035
|
var ENVIRONMENT_SETUP_VARIABLE_WAIT = { defaultMs: 5 * 6e4, maxMs: 15 * 6e4, pollMs: 5e3 };
|
|
3022
3036
|
var VARIABLE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
3023
|
-
var text = (max) => max === void 0 ?
|
|
3037
|
+
var text = (max) => max === void 0 ? z12.string().trim() : z12.string().trim().max(max);
|
|
3024
3038
|
var requiredText = (max) => text(max).min(1, "must not be empty");
|
|
3025
3039
|
var optionalText = (max) => text(max).nullish().transform((value) => value || null);
|
|
3026
3040
|
var clearableText = (max) => text(max).nullish().transform((value) => value === void 0 ? void 0 : value || null);
|
|
3027
|
-
var list = (item, max) => max === void 0 ?
|
|
3041
|
+
var list = (item, max) => max === void 0 ? z12.array(item) : z12.array(item).max(max);
|
|
3028
3042
|
var ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES = ["cron", "github", "gitlab"];
|
|
3029
3043
|
function isEnvironmentSetupAuthoredTriggerType(type) {
|
|
3030
3044
|
return ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES.some((authored) => authored === type);
|
|
3031
3045
|
}
|
|
3032
|
-
var proposalTriggerSchema =
|
|
3033
|
-
var existingTriggerSchema =
|
|
3046
|
+
var proposalTriggerSchema = z12.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
|
|
3047
|
+
var existingTriggerSchema = z12.custom(
|
|
3034
3048
|
(value) => isRecord(value) && typeof value.type === "string" && isRecord(value.config),
|
|
3035
3049
|
"must be an automation trigger"
|
|
3036
3050
|
);
|
|
@@ -3038,17 +3052,17 @@ var carriedTriggerSchema = existingTriggerSchema.refine(
|
|
|
3038
3052
|
(trigger) => !isEnvironmentSetupAuthoredTriggerType(trigger.type)
|
|
3039
3053
|
);
|
|
3040
3054
|
function automationSchema(limits) {
|
|
3041
|
-
const authored =
|
|
3055
|
+
const authored = z12.object({
|
|
3042
3056
|
name: text(limits.nameChars),
|
|
3043
3057
|
description: text(limits.descriptionChars),
|
|
3044
3058
|
prompt: text(limits.automationPromptChars),
|
|
3045
3059
|
triggers: list(proposalTriggerSchema, limits.automationTriggers)
|
|
3046
3060
|
});
|
|
3047
|
-
const updated = authored.extend({ triggers: list(
|
|
3048
|
-
return
|
|
3061
|
+
const updated = authored.extend({ triggers: list(z12.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
|
|
3062
|
+
return z12.object({
|
|
3049
3063
|
key: requiredText(limits.automationKeyChars),
|
|
3050
|
-
action:
|
|
3051
|
-
automation_id:
|
|
3064
|
+
action: z12.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
|
|
3065
|
+
automation_id: z12.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
|
|
3052
3066
|
name: text().default(""),
|
|
3053
3067
|
description: optionalText().transform((value) => value ?? ""),
|
|
3054
3068
|
prompt: text().default(""),
|
|
@@ -3071,7 +3085,7 @@ function automationSchema(limits) {
|
|
|
3071
3085
|
const content = (automation.action === "update" ? updated : authored).safeParse(automation);
|
|
3072
3086
|
if (content.success) return { ...automation, ...content.data };
|
|
3073
3087
|
for (const issue of content.error.issues) ctx.addIssue({ ...issue, code: "custom" });
|
|
3074
|
-
return
|
|
3088
|
+
return z12.NEVER;
|
|
3075
3089
|
});
|
|
3076
3090
|
}
|
|
3077
3091
|
function automationListSchema(limits) {
|
|
@@ -3089,7 +3103,7 @@ function automationListSchema(limits) {
|
|
|
3089
3103
|
});
|
|
3090
3104
|
}
|
|
3091
3105
|
function environmentSchema(limits) {
|
|
3092
|
-
return
|
|
3106
|
+
return z12.object({
|
|
3093
3107
|
name: optionalText(limits.nameChars).transform((value) => value ?? void 0),
|
|
3094
3108
|
description: clearableText(limits.descriptionChars),
|
|
3095
3109
|
system_prompt: clearableText(limits.systemPromptChars),
|
|
@@ -3098,26 +3112,26 @@ function environmentSchema(limits) {
|
|
|
3098
3112
|
});
|
|
3099
3113
|
}
|
|
3100
3114
|
function variableSchema(limits, requiredDefault) {
|
|
3101
|
-
return
|
|
3102
|
-
key:
|
|
3115
|
+
return z12.object({
|
|
3116
|
+
key: z12.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
|
|
3103
3117
|
description: optionalText(limits.variableDescriptionChars).transform((value) => value ?? ""),
|
|
3104
|
-
required:
|
|
3118
|
+
required: z12.boolean().default(requiredDefault)
|
|
3105
3119
|
});
|
|
3106
3120
|
}
|
|
3107
3121
|
function proposalSchema(limits) {
|
|
3108
|
-
return
|
|
3122
|
+
return z12.object({
|
|
3109
3123
|
summary: requiredText(limits.summaryChars),
|
|
3110
3124
|
stack: list(text(), limits.stackItems).default([]).transform((items) => items.filter(Boolean)),
|
|
3111
3125
|
environment: environmentSchema(limits),
|
|
3112
3126
|
variables: list(variableSchema(limits, false), limits.variables).default([]),
|
|
3113
3127
|
automations: automationListSchema(limits),
|
|
3114
|
-
verification: list(
|
|
3128
|
+
verification: list(z12.object({
|
|
3115
3129
|
label: requiredText(limits.nameChars),
|
|
3116
|
-
status:
|
|
3130
|
+
status: z12.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
|
|
3117
3131
|
detail: optionalText(limits.verificationDetailChars).transform((value) => value ?? void 0)
|
|
3118
3132
|
}), limits.verificationItems).default([]),
|
|
3119
|
-
media: list(
|
|
3120
|
-
media_id:
|
|
3133
|
+
media: list(z12.object({
|
|
3134
|
+
media_id: z12.string().regex(UUID_RE, "must be a media id"),
|
|
3121
3135
|
title: requiredText(limits.nameChars)
|
|
3122
3136
|
}), limits.mediaItems).default([])
|
|
3123
3137
|
});
|
|
@@ -3125,35 +3139,35 @@ function proposalSchema(limits) {
|
|
|
3125
3139
|
var environmentSetupProposalSchema = proposalSchema({});
|
|
3126
3140
|
var environmentSetupProposalSubmissionSchema = proposalSchema(ENVIRONMENT_SETUP_LIMITS);
|
|
3127
3141
|
var environmentSetupVariableRequestSchema = variableSchema({}, false).extend({
|
|
3128
|
-
status:
|
|
3129
|
-
requested_at:
|
|
3130
|
-
resolved_at:
|
|
3142
|
+
status: z12.enum(["pending", "provided", "skipped"]),
|
|
3143
|
+
requested_at: z12.string(),
|
|
3144
|
+
resolved_at: z12.string().nullable().default(null)
|
|
3131
3145
|
});
|
|
3132
|
-
var environmentSetupRunStateSchema =
|
|
3133
|
-
status:
|
|
3134
|
-
steps:
|
|
3146
|
+
var environmentSetupRunStateSchema = z12.object({
|
|
3147
|
+
status: z12.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
|
|
3148
|
+
steps: z12.partialRecord(z12.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), z12.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
|
|
3135
3149
|
proposal: environmentSetupProposalSchema.nullable().default(null),
|
|
3136
|
-
applied:
|
|
3137
|
-
applied_at:
|
|
3138
|
-
automation_ids:
|
|
3150
|
+
applied: z12.object({
|
|
3151
|
+
applied_at: z12.string(),
|
|
3152
|
+
automation_ids: z12.array(z12.string())
|
|
3139
3153
|
}).nullable().default(null),
|
|
3140
|
-
variable_requests:
|
|
3154
|
+
variable_requests: z12.array(environmentSetupVariableRequestSchema).default([])
|
|
3141
3155
|
});
|
|
3142
|
-
var applyEnvironmentSetupRequestSchema =
|
|
3156
|
+
var applyEnvironmentSetupRequestSchema = z12.object({
|
|
3143
3157
|
environment: environmentSchema(ENVIRONMENT_SETUP_LIMITS).extend({ name: requiredText(ENVIRONMENT_SETUP_LIMITS.nameChars) }),
|
|
3144
|
-
variables: list(
|
|
3158
|
+
variables: list(z12.object({ key: z12.string().regex(VARIABLE_KEY_RE), value: z12.string() }), ENVIRONMENT_SETUP_LIMITS.variables).default([]).refine((variables) => new Set(variables.map((variable) => variable.key)).size === variables.length, "must have unique keys").transform((variables) => variables.filter((variable) => variable.value.length > 0)),
|
|
3145
3159
|
automations: automationListSchema(ENVIRONMENT_SETUP_LIMITS)
|
|
3146
3160
|
});
|
|
3147
|
-
var requestEnvironmentSetupVariablesSchema =
|
|
3161
|
+
var requestEnvironmentSetupVariablesSchema = z12.object({
|
|
3148
3162
|
variables: list(variableSchema(ENVIRONMENT_SETUP_LIMITS, true), ENVIRONMENT_SETUP_LIMITS.variables).min(1, "must not be empty")
|
|
3149
3163
|
}).superRefine(({ variables }, ctx) => {
|
|
3150
3164
|
if (new Set(variables.map((variable) => variable.key)).size !== variables.length) {
|
|
3151
3165
|
ctx.addIssue({ code: "custom", path: ["variables"], message: "must have unique keys" });
|
|
3152
3166
|
}
|
|
3153
3167
|
});
|
|
3154
|
-
var respondEnvironmentSetupVariablesSchema =
|
|
3155
|
-
values:
|
|
3156
|
-
skipped:
|
|
3168
|
+
var respondEnvironmentSetupVariablesSchema = z12.object({
|
|
3169
|
+
values: z12.record(z12.string().regex(VARIABLE_KEY_RE), z12.string()).default({}),
|
|
3170
|
+
skipped: z12.array(z12.string().regex(VARIABLE_KEY_RE)).default([])
|
|
3157
3171
|
});
|
|
3158
3172
|
|
|
3159
3173
|
// ../shared/src/default-skills/replicas-agent/abilities/environment-setup.ts
|
|
@@ -3648,7 +3662,9 @@ if (result.errors?.length) throw new Error(JSON.stringify(result.errors));
|
|
|
3648
3662
|
|
|
3649
3663
|
The gateway refreshes expired credentials and retries authentication failures once. Check the response's \`errors\` field before using \`data\`.
|
|
3650
3664
|
|
|
3651
|
-
|
|
3665
|
+
Initiatives need the \`initiative:read\` scope, which organizations connected before it was requested do not have. If Linear answers \`Invalid scope\`, ask an admin to reconnect Linear under Organization \u2192 Integrations; retrying will not help.
|
|
3666
|
+
|
|
3667
|
+
Personal \u2192 Connections links a person's Linear identity for agent defaults and attribution. Its disconnected state does not mean the organization's Linear integration is disconnected, and connecting it does not refresh the organization's token. Only recommend reconnecting under Organization \u2192 Integrations when the gateway reports missing credentials or an unrecoverable OAuth failure, or when Linear answers \`Invalid scope\`. Report transient failures without asking the user to disconnect.
|
|
3652
3668
|
|
|
3653
3669
|
## Create a ticket
|
|
3654
3670
|
|
|
@@ -4651,7 +4667,7 @@ var SENTRY_ABILITY = {
|
|
|
4651
4667
|
};
|
|
4652
4668
|
|
|
4653
4669
|
// ../shared/src/memory.ts
|
|
4654
|
-
import { z as
|
|
4670
|
+
import { z as z13 } from "zod";
|
|
4655
4671
|
|
|
4656
4672
|
// ../shared/src/sandbox.ts
|
|
4657
4673
|
var SANDBOX_LIFECYCLE = {
|
|
@@ -4660,6 +4676,15 @@ var SANDBOX_LIFECYCLE = {
|
|
|
4660
4676
|
AUTO_DELETE_MINUTES: -1,
|
|
4661
4677
|
SSH_TOKEN_EXPIRATION_MINUTES: 3 * 60
|
|
4662
4678
|
};
|
|
4679
|
+
var SANDBOX_SKILL_DIRS = [
|
|
4680
|
+
".agents/skills",
|
|
4681
|
+
".claude/skills",
|
|
4682
|
+
".codex/skills",
|
|
4683
|
+
".cursor/skills",
|
|
4684
|
+
".config/opencode/skills",
|
|
4685
|
+
".pi/agent/skills",
|
|
4686
|
+
".replicas/skill-registries"
|
|
4687
|
+
];
|
|
4663
4688
|
var SANDBOX_PATHS = {
|
|
4664
4689
|
HOME_DIR: "/home/user",
|
|
4665
4690
|
WORKSPACES_DIR: "/home/user/workspaces",
|
|
@@ -4673,11 +4698,11 @@ var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZ
|
|
|
4673
4698
|
// ../shared/src/memory.ts
|
|
4674
4699
|
var HISTORY_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/history`;
|
|
4675
4700
|
var HISTORY_INDEX_FILENAME = "INDEX.md";
|
|
4676
|
-
var memoryExtractionResultSchema =
|
|
4677
|
-
summary:
|
|
4678
|
-
indexEntry:
|
|
4701
|
+
var memoryExtractionResultSchema = z13.object({
|
|
4702
|
+
summary: z13.string().nullable(),
|
|
4703
|
+
indexEntry: z13.string().nullable()
|
|
4679
4704
|
});
|
|
4680
|
-
var { $schema: _, ...MEMORY_EXTRACTION_SCHEMA } =
|
|
4705
|
+
var { $schema: _, ...MEMORY_EXTRACTION_SCHEMA } = z13.toJSONSchema(memoryExtractionResultSchema);
|
|
4681
4706
|
|
|
4682
4707
|
// ../shared/src/default-skills/replicas-agent/abilities/session-history.ts
|
|
4683
4708
|
var SECTION12 = `### Session history
|
|
@@ -7885,7 +7910,7 @@ var CLAUDE_AUTH_ENV_KEYS_BY_METHOD = {
|
|
|
7885
7910
|
};
|
|
7886
7911
|
|
|
7887
7912
|
// ../shared/src/routes/command-protection.ts
|
|
7888
|
-
import { z as
|
|
7913
|
+
import { z as z14 } from "zod";
|
|
7889
7914
|
|
|
7890
7915
|
// ../shared/src/git-invocations.ts
|
|
7891
7916
|
var COMMIT_VALUE_OPTIONS = /* @__PURE__ */ new Set(["message", "file", "trailer", "reuse-message", "reedit-message", "fixup", "squash", "template", "author", "date", "cleanup", "pathspec-from-file"]);
|
|
@@ -7976,27 +8001,27 @@ function findCheckoutTarget(args) {
|
|
|
7976
8001
|
}
|
|
7977
8002
|
|
|
7978
8003
|
// ../shared/src/routes/command-protection.ts
|
|
7979
|
-
var commandProtectionRepoStateSchema =
|
|
7980
|
-
branch:
|
|
7981
|
-
defaultBranch:
|
|
7982
|
-
pushBranch:
|
|
7983
|
-
pushConfig:
|
|
7984
|
-
headMessage:
|
|
7985
|
-
mergeInProgress:
|
|
8004
|
+
var commandProtectionRepoStateSchema = z14.object({
|
|
8005
|
+
branch: z14.string().nullable(),
|
|
8006
|
+
defaultBranch: z14.string().nullable(),
|
|
8007
|
+
pushBranch: z14.string().nullable(),
|
|
8008
|
+
pushConfig: z14.string().nullable(),
|
|
8009
|
+
headMessage: z14.string().nullable(),
|
|
8010
|
+
mergeInProgress: z14.boolean().optional()
|
|
7986
8011
|
});
|
|
7987
|
-
var commandProtectionEvaluateRequestSchema =
|
|
7988
|
-
provider:
|
|
7989
|
-
source:
|
|
7990
|
-
toolName:
|
|
7991
|
-
toolInput:
|
|
7992
|
-
command:
|
|
7993
|
-
cwd:
|
|
7994
|
-
toolUseId:
|
|
8012
|
+
var commandProtectionEvaluateRequestSchema = z14.object({
|
|
8013
|
+
provider: z14.enum(["claude", "codex", "cursor", "opencode", "pi"]),
|
|
8014
|
+
source: z14.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call"]),
|
|
8015
|
+
toolName: z14.string(),
|
|
8016
|
+
toolInput: z14.unknown(),
|
|
8017
|
+
command: z14.string().nullish(),
|
|
8018
|
+
cwd: z14.string().nullish(),
|
|
8019
|
+
toolUseId: z14.string().nullish(),
|
|
7995
8020
|
// Read by the engine before the command runs, keyed by absolute path, so the
|
|
7996
8021
|
// policy can see branches and commit messages the command text only references.
|
|
7997
|
-
gitContext:
|
|
7998
|
-
repos:
|
|
7999
|
-
messageFiles:
|
|
8022
|
+
gitContext: z14.object({
|
|
8023
|
+
repos: z14.record(z14.string(), commandProtectionRepoStateSchema),
|
|
8024
|
+
messageFiles: z14.record(z14.string(), z14.string())
|
|
8000
8025
|
}).optional()
|
|
8001
8026
|
});
|
|
8002
8027
|
var COMMAND_PROTECTION_COMMAND_KEYS = ["command", "cmd", "script", "query", "endpoint", "path", "url", "mutation"];
|
|
@@ -8193,75 +8218,75 @@ function shouldRefreshPullRequests(toolName, toolInput) {
|
|
|
8193
8218
|
}
|
|
8194
8219
|
|
|
8195
8220
|
// ../shared/src/routes/linear.ts
|
|
8196
|
-
import { z as
|
|
8197
|
-
var linearSessionMetadataSchema =
|
|
8198
|
-
via_mothership:
|
|
8199
|
-
issue_id:
|
|
8200
|
-
issue_identifier:
|
|
8201
|
-
issue_title:
|
|
8202
|
-
issue_description:
|
|
8203
|
-
issue_url:
|
|
8204
|
-
comment_id:
|
|
8205
|
-
comment_body:
|
|
8206
|
-
triggered_by_id:
|
|
8207
|
-
triggered_by_name:
|
|
8208
|
-
triggered_by_email:
|
|
8209
|
-
linear_workspace_id:
|
|
8210
|
-
creator_id:
|
|
8211
|
-
creator_name:
|
|
8212
|
-
creator_email:
|
|
8213
|
-
assignee_id:
|
|
8214
|
-
assignee_name:
|
|
8215
|
-
assignee_email:
|
|
8216
|
-
issue_state:
|
|
8217
|
-
parent_issue:
|
|
8218
|
-
id:
|
|
8219
|
-
identifier:
|
|
8220
|
-
title:
|
|
8221
|
-
description:
|
|
8221
|
+
import { z as z15 } from "zod";
|
|
8222
|
+
var linearSessionMetadataSchema = z15.object({
|
|
8223
|
+
via_mothership: z15.boolean().optional(),
|
|
8224
|
+
issue_id: z15.string(),
|
|
8225
|
+
issue_identifier: z15.string(),
|
|
8226
|
+
issue_title: z15.string(),
|
|
8227
|
+
issue_description: z15.string(),
|
|
8228
|
+
issue_url: z15.string(),
|
|
8229
|
+
comment_id: z15.string(),
|
|
8230
|
+
comment_body: z15.string(),
|
|
8231
|
+
triggered_by_id: z15.string().optional(),
|
|
8232
|
+
triggered_by_name: z15.string().optional(),
|
|
8233
|
+
triggered_by_email: z15.string().optional(),
|
|
8234
|
+
linear_workspace_id: z15.string().optional(),
|
|
8235
|
+
creator_id: z15.string().optional(),
|
|
8236
|
+
creator_name: z15.string().optional(),
|
|
8237
|
+
creator_email: z15.string().optional(),
|
|
8238
|
+
assignee_id: z15.string().optional(),
|
|
8239
|
+
assignee_name: z15.string().optional(),
|
|
8240
|
+
assignee_email: z15.string().optional(),
|
|
8241
|
+
issue_state: z15.string().optional(),
|
|
8242
|
+
parent_issue: z15.object({
|
|
8243
|
+
id: z15.string(),
|
|
8244
|
+
identifier: z15.string(),
|
|
8245
|
+
title: z15.string(),
|
|
8246
|
+
description: z15.string().nullable()
|
|
8222
8247
|
}).optional(),
|
|
8223
|
-
workspace:
|
|
8224
|
-
id:
|
|
8225
|
-
coding_agent:
|
|
8226
|
-
task_description:
|
|
8227
|
-
created_at:
|
|
8248
|
+
workspace: z15.object({
|
|
8249
|
+
id: z15.string(),
|
|
8250
|
+
coding_agent: z15.custom((value) => typeof value === "string" && isValidAgentProvider(value)),
|
|
8251
|
+
task_description: z15.string(),
|
|
8252
|
+
created_at: z15.string()
|
|
8228
8253
|
}).optional()
|
|
8229
8254
|
});
|
|
8230
8255
|
|
|
8231
8256
|
// ../shared/src/routes/mothership.ts
|
|
8232
|
-
import { z as
|
|
8257
|
+
import { z as z16 } from "zod";
|
|
8233
8258
|
var MOTHERSHIP_LINEAR_ACTIONS = ["ask", "start"];
|
|
8234
|
-
var mothershipLinearSessionIntentRequestSchema =
|
|
8235
|
-
comment_id:
|
|
8236
|
-
action:
|
|
8259
|
+
var mothershipLinearSessionIntentRequestSchema = z16.object({
|
|
8260
|
+
comment_id: z16.string().trim().min(1).describe("Id of the Linear comment the session will be created on."),
|
|
8261
|
+
action: z16.enum(MOTHERSHIP_LINEAR_ACTIONS).describe("`ask` when the comment is a clarifying question, `start` when it is the complete task prompt.")
|
|
8237
8262
|
});
|
|
8238
|
-
var mothershipLinearStartRequestSchema =
|
|
8239
|
-
issue_id:
|
|
8240
|
-
agent_session_id:
|
|
8241
|
-
prompt:
|
|
8263
|
+
var mothershipLinearStartRequestSchema = z16.object({
|
|
8264
|
+
issue_id: z16.string().describe("Linear issue id from the envelope's `issue_id`."),
|
|
8265
|
+
agent_session_id: z16.string().describe("Existing Linear agent session id from the envelope's `agent_session_id`."),
|
|
8266
|
+
prompt: z16.string().trim().min(1).describe("Complete task prompt for the coding workspace.")
|
|
8242
8267
|
});
|
|
8243
|
-
var slackChannelIdSchema =
|
|
8244
|
-
var slackThreadTsSchema =
|
|
8245
|
-
var mothershipSlackSpawnRequestSchema =
|
|
8268
|
+
var slackChannelIdSchema = z16.string().describe("Slack channel id from the envelope's `channel_id`.");
|
|
8269
|
+
var slackThreadTsSchema = z16.string().describe("Slack thread timestamp from the envelope's `thread_ts`.");
|
|
8270
|
+
var mothershipSlackSpawnRequestSchema = z16.object({
|
|
8246
8271
|
channel_id: slackChannelIdSchema,
|
|
8247
8272
|
thread_ts: slackThreadTsSchema,
|
|
8248
|
-
message_ts:
|
|
8249
|
-
user_id:
|
|
8250
|
-
prompt:
|
|
8251
|
-
environment_id:
|
|
8273
|
+
message_ts: z16.string().describe("Timestamp of the Slack message that asked for the work (the envelope's `message_ts`). The server verifies this message and its author."),
|
|
8274
|
+
user_id: z16.string().describe("Slack user id of that message's author (the envelope's `user_id`). The workspace is attributed to them."),
|
|
8275
|
+
prompt: z16.string().describe("Complete task for the new workspace, written so it stands on its own."),
|
|
8276
|
+
environment_id: z16.string().optional().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`. Pass it only when clearly confident it fits; omit it to let routing choose. If routing cannot choose, the call fails and nothing is posted, so pick one or ask the person.`)
|
|
8252
8277
|
});
|
|
8253
|
-
var mothershipSlackRelayRequestSchema =
|
|
8278
|
+
var mothershipSlackRelayRequestSchema = z16.object({
|
|
8254
8279
|
channel_id: slackChannelIdSchema,
|
|
8255
8280
|
thread_ts: slackThreadTsSchema,
|
|
8256
|
-
message:
|
|
8257
|
-
user_id:
|
|
8258
|
-
queue:
|
|
8281
|
+
message: z16.string().describe("The follow-up to deliver, combining every fresh message that belongs to this update."),
|
|
8282
|
+
user_id: z16.string().optional().describe("Slack user id of the follow-up's author (the envelope's `user_id`), so it is attributed to them. Defaults to the thread's original requester."),
|
|
8283
|
+
queue: z16.boolean().optional().describe("Set true only when the person explicitly asked for this to happen after the current task finishes. Delivers behind the active turn instead of interrupting it.")
|
|
8259
8284
|
});
|
|
8260
8285
|
var mothershipAutomationToolInputSchema = automationToolInputSchema.extend({
|
|
8261
|
-
confirmation_channel_id:
|
|
8262
|
-
confirmation_thread_ts:
|
|
8263
|
-
confirmation_message_ts:
|
|
8264
|
-
confirmation_user_id:
|
|
8286
|
+
confirmation_channel_id: z16.string().describe("`channel_id` from the envelope of the Slack message that accepted the offer."),
|
|
8287
|
+
confirmation_thread_ts: z16.string().describe("`thread_ts` from that message's envelope."),
|
|
8288
|
+
confirmation_message_ts: z16.string().describe("`message_ts` from that message's envelope."),
|
|
8289
|
+
confirmation_user_id: z16.string().describe("`user_id` from that message's envelope.")
|
|
8265
8290
|
});
|
|
8266
8291
|
|
|
8267
8292
|
// ../shared/src/routes/plugin-catalog.ts
|
|
@@ -8570,7 +8595,7 @@ var MAX_CLIENT_STATE_REQUEST_BYTES = 5 * 1024 * 1024;
|
|
|
8570
8595
|
var MAX_CLIENT_STATE_BYTES_PER_USER = 10 * 1024 * 1024;
|
|
8571
8596
|
|
|
8572
8597
|
// ../shared/src/routes/workspaces.ts
|
|
8573
|
-
import { z as
|
|
8598
|
+
import { z as z17 } from "zod";
|
|
8574
8599
|
var WORKSPACE_STATUSES = ["active", "sleeping", "archived", "preparing", "error"];
|
|
8575
8600
|
var WORKSPACE_STATUS_FILTERS = WORKSPACE_STATUSES.map((status) => status === "error" ? "failed" : status);
|
|
8576
8601
|
var WORKSPACE_SORT_CHOICES = [
|
|
@@ -8594,56 +8619,56 @@ var DEFAULT_WORKSPACE_FILTERS = {
|
|
|
8594
8619
|
activity: "any"
|
|
8595
8620
|
};
|
|
8596
8621
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
8597
|
-
var terminalRtcCandidateSchema =
|
|
8598
|
-
var terminalSocketServerMessageSchema =
|
|
8599
|
-
|
|
8600
|
-
|
|
8622
|
+
var terminalRtcCandidateSchema = z17.object({ type: z17.literal("rtc-candidate"), candidate: z17.string(), mid: z17.string() });
|
|
8623
|
+
var terminalSocketServerMessageSchema = z17.discriminatedUnion("type", [
|
|
8624
|
+
z17.object({ type: z17.literal("output"), data: z17.string() }),
|
|
8625
|
+
z17.object({ type: z17.literal("rtc-answer"), sdp: z17.string() }),
|
|
8601
8626
|
terminalRtcCandidateSchema,
|
|
8602
|
-
|
|
8627
|
+
z17.object({ type: z17.literal("rtc-switch") })
|
|
8603
8628
|
]);
|
|
8604
8629
|
var TERMINAL_RTC_ICE_SERVER = "stun:stun.l.google.com:19302";
|
|
8605
8630
|
|
|
8606
8631
|
// ../shared/src/routes/workspace-events.ts
|
|
8607
|
-
import { z as
|
|
8608
|
-
var workspaceChangedEventSchema =
|
|
8609
|
-
|
|
8610
|
-
type:
|
|
8611
|
-
workspaceId:
|
|
8612
|
-
completion:
|
|
8613
|
-
workspaceName:
|
|
8614
|
-
completedAt:
|
|
8615
|
-
processing:
|
|
8632
|
+
import { z as z18 } from "zod";
|
|
8633
|
+
var workspaceChangedEventSchema = z18.discriminatedUnion("type", [
|
|
8634
|
+
z18.object({
|
|
8635
|
+
type: z18.literal("workspace.changed"),
|
|
8636
|
+
workspaceId: z18.string(),
|
|
8637
|
+
completion: z18.object({
|
|
8638
|
+
workspaceName: z18.string(),
|
|
8639
|
+
completedAt: z18.string(),
|
|
8640
|
+
processing: z18.boolean().optional()
|
|
8616
8641
|
}).optional(),
|
|
8617
|
-
ts:
|
|
8642
|
+
ts: z18.string()
|
|
8618
8643
|
}),
|
|
8619
|
-
|
|
8620
|
-
type:
|
|
8621
|
-
workspaceId:
|
|
8622
|
-
chatId:
|
|
8623
|
-
ts:
|
|
8644
|
+
z18.object({
|
|
8645
|
+
type: z18.literal("workspace.chat.changed"),
|
|
8646
|
+
workspaceId: z18.string(),
|
|
8647
|
+
chatId: z18.string(),
|
|
8648
|
+
ts: z18.string()
|
|
8624
8649
|
}),
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
type:
|
|
8628
|
-
workspaceId:
|
|
8629
|
-
ts:
|
|
8650
|
+
z18.object({ type: z18.literal("presence.changed"), ts: z18.string() }),
|
|
8651
|
+
z18.object({
|
|
8652
|
+
type: z18.literal("mobile-testing.changed"),
|
|
8653
|
+
workspaceId: z18.string(),
|
|
8654
|
+
ts: z18.string()
|
|
8630
8655
|
})
|
|
8631
8656
|
]);
|
|
8632
8657
|
|
|
8633
8658
|
// ../shared/src/routes/presence.ts
|
|
8634
|
-
import { z as
|
|
8635
|
-
var presenceStatusSchema =
|
|
8636
|
-
var presenceLocationSchema =
|
|
8637
|
-
environmentId:
|
|
8638
|
-
workspaceId:
|
|
8659
|
+
import { z as z19 } from "zod";
|
|
8660
|
+
var presenceStatusSchema = z19.enum(["online", "typing"]);
|
|
8661
|
+
var presenceLocationSchema = z19.object({
|
|
8662
|
+
environmentId: z19.string().optional(),
|
|
8663
|
+
workspaceId: z19.string().optional()
|
|
8639
8664
|
});
|
|
8640
|
-
var presenceEntrySchema =
|
|
8641
|
-
userId:
|
|
8665
|
+
var presenceEntrySchema = z19.object({
|
|
8666
|
+
userId: z19.string(),
|
|
8642
8667
|
status: presenceStatusSchema,
|
|
8643
8668
|
location: presenceLocationSchema,
|
|
8644
|
-
ts:
|
|
8669
|
+
ts: z19.string()
|
|
8645
8670
|
});
|
|
8646
|
-
var updatePresenceRequestSchema =
|
|
8671
|
+
var updatePresenceRequestSchema = z19.object({
|
|
8647
8672
|
status: presenceStatusSchema,
|
|
8648
8673
|
location: presenceLocationSchema.optional()
|
|
8649
8674
|
});
|
|
@@ -8964,7 +8989,7 @@ function parseChatTranscriptArtifact(value) {
|
|
|
8964
8989
|
}
|
|
8965
8990
|
|
|
8966
8991
|
// ../shared/src/learned-skills.ts
|
|
8967
|
-
import { z as
|
|
8992
|
+
import { z as z20 } from "zod";
|
|
8968
8993
|
|
|
8969
8994
|
// ../shared/src/frontmatter.ts
|
|
8970
8995
|
import { parse as parseYaml2 } from "yaml";
|
|
@@ -8987,8 +9012,8 @@ function parseFrontmatter(content) {
|
|
|
8987
9012
|
var LEARNED_SKILLS_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/learned-skills`;
|
|
8988
9013
|
var LEARNED_SKILLS_MANIFEST_PATH = `${LEARNED_SKILLS_ROOT}/manifest.json`;
|
|
8989
9014
|
var LEARNED_SKILL_DIR_PREFIX = "replicas-learned__";
|
|
8990
|
-
var learnedSkillsManifestSchema =
|
|
8991
|
-
skills:
|
|
9015
|
+
var learnedSkillsManifestSchema = z20.object({
|
|
9016
|
+
skills: z20.array(z20.object({ name: z20.string(), sha256: z20.string() }))
|
|
8992
9017
|
});
|
|
8993
9018
|
|
|
8994
9019
|
// ../shared/src/skill-registry.ts
|
|
@@ -9030,6 +9055,7 @@ export {
|
|
|
9030
9055
|
AGENT_CREDENTIAL_METHODS_IN_ORDER,
|
|
9031
9056
|
describeCredential,
|
|
9032
9057
|
agentCredentialSnapshotSchema,
|
|
9058
|
+
isSameCredential,
|
|
9033
9059
|
isAgentChatTurnActivityRecord,
|
|
9034
9060
|
isAgentChatSkillActivityRecord,
|
|
9035
9061
|
isAgentChatMcpActivityRecord,
|
|
@@ -9132,6 +9158,7 @@ export {
|
|
|
9132
9158
|
decodePathSegments,
|
|
9133
9159
|
buildCodeHostPrUrl,
|
|
9134
9160
|
createUuidFromHex,
|
|
9161
|
+
SANDBOX_SKILL_DIRS,
|
|
9135
9162
|
HISTORY_ROOT,
|
|
9136
9163
|
HISTORY_INDEX_FILENAME,
|
|
9137
9164
|
extractErrorText,
|
|
@@ -3,18 +3,18 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
monolithRequest
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MAFKR626.js";
|
|
7
7
|
import {
|
|
8
8
|
SUBPROCESS_MAX_BUFFER,
|
|
9
9
|
execFileAsync
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-W7DCWL4S.js";
|
|
11
11
|
import {
|
|
12
12
|
extractCommandProtectionCommandText,
|
|
13
13
|
findCommandProtectionGitLookups,
|
|
14
14
|
findGitCommitSignals,
|
|
15
15
|
findPrMergeSignals,
|
|
16
16
|
parseCommandProtectionRequest
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-VRMTJFZQ.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
|
HOOK_EXEC_MAX_BUFFER_BYTES
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VRMTJFZQ.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-W3M6AME6.js";
|
|
7
|
+
import "./chunk-MAFKR626.js";
|
|
8
|
+
import "./chunk-W7DCWL4S.js";
|
|
9
9
|
import {
|
|
10
10
|
isRecord
|
|
11
11
|
} from "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-VRMTJFZQ.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/command-protection-hook.ts
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
AppServerProcess,
|
|
9
9
|
buildCodexAgentEnv
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-K5CNOXH2.js";
|
|
11
|
+
import "./chunk-W7DCWL4S.js";
|
|
12
12
|
import {
|
|
13
13
|
AGENT,
|
|
14
14
|
headlessAgentRequestSchema
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-VRMTJFZQ.js";
|
|
16
16
|
import "./chunk-VEQXQN22.js";
|
|
17
17
|
|
|
18
18
|
// src/headless-agent.ts
|
package/dist/src/index.js
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
reportCommandProtectionBlock,
|
|
33
33
|
resolveDiffBase,
|
|
34
34
|
runGitCommand
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-W3M6AME6.js";
|
|
36
36
|
import {
|
|
37
37
|
ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
|
|
38
38
|
AGENT_MESSAGE_DELTA_METHOD,
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
} from "./chunk-P73LGPQO.js";
|
|
58
58
|
import {
|
|
59
59
|
publishedPullRequestUrls
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-SR3TRBEI.js";
|
|
61
61
|
import {
|
|
62
62
|
BaseRefreshManager,
|
|
63
63
|
CodexAspAuthMethodChangedError,
|
|
@@ -70,8 +70,8 @@ import {
|
|
|
70
70
|
recordExhaustedCredential,
|
|
71
71
|
refreshDelayMs,
|
|
72
72
|
restartCodexAspHost,
|
|
73
|
-
|
|
74
|
-
} from "./chunk-
|
|
73
|
+
routineRefreshRequest
|
|
74
|
+
} from "./chunk-FUHUBWBQ.js";
|
|
75
75
|
import {
|
|
76
76
|
ENGINE_ENV,
|
|
77
77
|
monolithRequest,
|
|
@@ -79,16 +79,16 @@ import {
|
|
|
79
79
|
readRuntimeEnvFile,
|
|
80
80
|
reloadEngineEnv,
|
|
81
81
|
setAgentCredentialSnapshot
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-MAFKR626.js";
|
|
83
83
|
import {
|
|
84
84
|
AspClient,
|
|
85
85
|
getCodexModelProvider
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-K5CNOXH2.js";
|
|
87
87
|
import {
|
|
88
88
|
SUBPROCESS_MAX_BUFFER,
|
|
89
89
|
execAsync,
|
|
90
90
|
execFileAsync
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-W7DCWL4S.js";
|
|
92
92
|
import {
|
|
93
93
|
isRecord as isRecord2
|
|
94
94
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -164,6 +164,7 @@ import {
|
|
|
164
164
|
REMOVED_MESSAGE_IDS_PAYLOAD_KEY,
|
|
165
165
|
REPLICAS_CONFIG_FILENAMES,
|
|
166
166
|
REPLICAS_RUNTIME_ENV_ALIASES,
|
|
167
|
+
SANDBOX_SKILL_DIRS,
|
|
167
168
|
SUBAGENT_MCP_HARNESSES,
|
|
168
169
|
SUBAGENT_MCP_SERVER_NAME,
|
|
169
170
|
SUBAGENT_MCP_TOOLS,
|
|
@@ -261,6 +262,7 @@ import {
|
|
|
261
262
|
isLatestChatHistoryPage,
|
|
262
263
|
isNonEmptyString,
|
|
263
264
|
isRecord,
|
|
265
|
+
isSameCredential,
|
|
264
266
|
isSkillRegistryManifest,
|
|
265
267
|
isTokenUsageCounts,
|
|
266
268
|
isTokenUsageUploadRecord,
|
|
@@ -314,7 +316,7 @@ import {
|
|
|
314
316
|
workspaceCredentialProviderSchema,
|
|
315
317
|
workspaceTokenRequestSchema,
|
|
316
318
|
workspaceTokenResponseSchema
|
|
317
|
-
} from "./chunk-
|
|
319
|
+
} from "./chunk-VRMTJFZQ.js";
|
|
318
320
|
import {
|
|
319
321
|
cloneMcpConfig,
|
|
320
322
|
ensureCompatibilityImports,
|
|
@@ -515,7 +517,7 @@ var require_lib = __commonJS({
|
|
|
515
517
|
"../node_modules/.bun/which@5.0.0/node_modules/which/lib/index.js"(exports, module) {
|
|
516
518
|
"use strict";
|
|
517
519
|
var { isexe, sync: isexeSync } = require_index_min();
|
|
518
|
-
var { join:
|
|
520
|
+
var { join: join42, delimiter: delimiter3, sep: sep2, posix } = __require("path");
|
|
519
521
|
var isWindows = process.platform === "win32";
|
|
520
522
|
var rSlash = new RegExp(`[${posix.sep}${sep2 === posix.sep ? "" : sep2}]`.replace(/(\\)/g, "\\$1"));
|
|
521
523
|
var rRel = new RegExp(`^\\.${rSlash.source}`);
|
|
@@ -544,7 +546,7 @@ var require_lib = __commonJS({
|
|
|
544
546
|
var getPathPart = (raw, cmd) => {
|
|
545
547
|
const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
|
|
546
548
|
const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
|
|
547
|
-
return prefix +
|
|
549
|
+
return prefix + join42(pathPart, cmd);
|
|
548
550
|
};
|
|
549
551
|
var which = async (cmd, opt = {}) => {
|
|
550
552
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
@@ -9493,7 +9495,7 @@ var ClaudeTokenManager = class extends BaseRefreshManager {
|
|
|
9493
9495
|
return null;
|
|
9494
9496
|
}
|
|
9495
9497
|
async doRefresh(_config) {
|
|
9496
|
-
await this.refreshWithRequest(
|
|
9498
|
+
await this.refreshWithRequest(routineRefreshRequest("claude"));
|
|
9497
9499
|
}
|
|
9498
9500
|
async switchCredentials(data) {
|
|
9499
9501
|
await this.applyCredentialUpdate(++this.credentialGeneration, () => this.applyCredentialsResponse(data));
|
|
@@ -11717,7 +11719,7 @@ var AuthFallbackCoordinator = class {
|
|
|
11717
11719
|
continue;
|
|
11718
11720
|
}
|
|
11719
11721
|
const applied = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS[this.provider] ?? exhausted;
|
|
11720
|
-
if (applied
|
|
11722
|
+
if (isSameCredential(applied, exhausted)) {
|
|
11721
11723
|
failed = true;
|
|
11722
11724
|
continue;
|
|
11723
11725
|
}
|
|
@@ -61928,7 +61930,8 @@ var ChatService = class {
|
|
|
61928
61930
|
// src/services/repo-file-service.ts
|
|
61929
61931
|
import { execFile as execFile7 } from "child_process";
|
|
61930
61932
|
import { readFile as readFile20 } from "fs/promises";
|
|
61931
|
-
import {
|
|
61933
|
+
import { homedir as homedir14 } from "os";
|
|
61934
|
+
import { extname as extname3, join as join37 } from "path";
|
|
61932
61935
|
|
|
61933
61936
|
// src/services/language-server-service.ts
|
|
61934
61937
|
import { spawn as spawn6 } from "child_process";
|
|
@@ -62146,14 +62149,16 @@ function execGitAsync(args, cwd, timeoutMs) {
|
|
|
62146
62149
|
});
|
|
62147
62150
|
}
|
|
62148
62151
|
var RepoFileService = class {
|
|
62152
|
+
constructor(gitService2, homeDir = homedir14()) {
|
|
62153
|
+
this.homeDir = homeDir;
|
|
62154
|
+
this.gitService = gitService2;
|
|
62155
|
+
}
|
|
62156
|
+
homeDir;
|
|
62149
62157
|
cache = /* @__PURE__ */ new Map();
|
|
62150
62158
|
gitService;
|
|
62151
62159
|
indexInflight = null;
|
|
62152
62160
|
writeLock = new AsyncLock();
|
|
62153
62161
|
languageServers = new LanguageServerService();
|
|
62154
|
-
constructor(gitService2) {
|
|
62155
|
-
this.gitService = gitService2;
|
|
62156
|
-
}
|
|
62157
62162
|
async search(params) {
|
|
62158
62163
|
const { refresh = false } = params;
|
|
62159
62164
|
let stale = false;
|
|
@@ -62198,7 +62203,15 @@ var RepoFileService = class {
|
|
|
62198
62203
|
async readFile(repoName, filePath) {
|
|
62199
62204
|
const resolved = await this.resolveFile(repoName, filePath);
|
|
62200
62205
|
if (!resolved) return null;
|
|
62201
|
-
const
|
|
62206
|
+
const file = await this.readResolvedFile(repoName, filePath, resolved);
|
|
62207
|
+
return typeof file?.content === "string" ? { ...file, revision: fileRevision(file.content) } : file;
|
|
62208
|
+
}
|
|
62209
|
+
/** Read-only: skill files carry no revision, so the viewer never offers to edit them. */
|
|
62210
|
+
async readSkillFile(filePath) {
|
|
62211
|
+
const resolved = await this.resolveSkillFile(filePath);
|
|
62212
|
+
return resolved ? await this.readResolvedFile("", filePath, resolved) : null;
|
|
62213
|
+
}
|
|
62214
|
+
async readResolvedFile(repoName, filePath, { fullPath, sizeBytes }) {
|
|
62202
62215
|
try {
|
|
62203
62216
|
if (isBinaryExtension(filePath)) {
|
|
62204
62217
|
const { kind, mimeType } = classifyCanvasFilename(filePath);
|
|
@@ -62257,8 +62270,7 @@ var RepoFileService = class {
|
|
|
62257
62270
|
language: detectLanguageByPath(filePath),
|
|
62258
62271
|
sizeBytes,
|
|
62259
62272
|
binary: false,
|
|
62260
|
-
tooLarge: false
|
|
62261
|
-
revision: fileRevision(content)
|
|
62273
|
+
tooLarge: false
|
|
62262
62274
|
};
|
|
62263
62275
|
} catch {
|
|
62264
62276
|
return null;
|
|
@@ -62330,6 +62342,16 @@ var RepoFileService = class {
|
|
|
62330
62342
|
if (!repo) return null;
|
|
62331
62343
|
return await resolveContainedFile(repo.path, filePath);
|
|
62332
62344
|
}
|
|
62345
|
+
async resolveSkillFile(filePath) {
|
|
62346
|
+
const skillRoots = SANDBOX_SKILL_DIRS.map((dir) => join37(this.homeDir, dir));
|
|
62347
|
+
if (!skillRoots.some((root) => filePath.startsWith(`${root}/`))) return null;
|
|
62348
|
+
const repos = await this.gitService.listRepositories();
|
|
62349
|
+
for (const root of [...skillRoots, ...repos.map((repo) => repo.path)]) {
|
|
62350
|
+
const resolved = await resolveContainedFile(root, filePath);
|
|
62351
|
+
if (resolved) return resolved.fullPath.split("/").includes(".git") ? null : resolved;
|
|
62352
|
+
}
|
|
62353
|
+
return null;
|
|
62354
|
+
}
|
|
62333
62355
|
async indexAll(refresh) {
|
|
62334
62356
|
const repos = await this.gitService.listRepositories();
|
|
62335
62357
|
for (const repo of repos) {
|
|
@@ -62395,20 +62417,20 @@ var RepoFileService = class {
|
|
|
62395
62417
|
import { Hono } from "hono";
|
|
62396
62418
|
import { z as z5 } from "zod";
|
|
62397
62419
|
import { readdir as readdir11, stat as stat7, readFile as readFile23 } from "fs/promises";
|
|
62398
|
-
import { join as
|
|
62420
|
+
import { join as join40, resolve as resolve5 } from "path";
|
|
62399
62421
|
|
|
62400
62422
|
// src/services/warm-hooks-service.ts
|
|
62401
62423
|
import { spawn as spawn7 } from "child_process";
|
|
62402
62424
|
import { readFile as readFile22 } from "fs/promises";
|
|
62403
62425
|
import { existsSync as existsSync19 } from "fs";
|
|
62404
|
-
import { join as
|
|
62426
|
+
import { join as join39 } from "path";
|
|
62405
62427
|
|
|
62406
62428
|
// src/services/warm-hook-logs-service.ts
|
|
62407
62429
|
import { mkdir as mkdir21, readFile as readFile21, writeFile as writeFile11, readdir as readdir10, appendFile as appendFile6, unlink as unlink4 } from "fs/promises";
|
|
62408
|
-
import { homedir as
|
|
62409
|
-
import { join as
|
|
62410
|
-
var LOGS_DIR2 =
|
|
62411
|
-
var CURRENT_RUN_LOG =
|
|
62430
|
+
import { homedir as homedir15 } from "os";
|
|
62431
|
+
import { join as join38 } from "path";
|
|
62432
|
+
var LOGS_DIR2 = join38(homedir15(), ".replicas", "warm-hook-logs");
|
|
62433
|
+
var CURRENT_RUN_LOG = join38(LOGS_DIR2, "current-run.log");
|
|
62412
62434
|
var GLOBAL_FILENAME = "global.json";
|
|
62413
62435
|
function withPreview2(stored) {
|
|
62414
62436
|
const preview = buildHookOutputPreview(stored.output);
|
|
@@ -62425,7 +62447,7 @@ var WarmHookLogsService = class {
|
|
|
62425
62447
|
hookName: "organization",
|
|
62426
62448
|
...entry
|
|
62427
62449
|
};
|
|
62428
|
-
await writeFile11(
|
|
62450
|
+
await writeFile11(join38(LOGS_DIR2, GLOBAL_FILENAME), `${JSON.stringify(log, null, 2)}
|
|
62429
62451
|
`, "utf-8");
|
|
62430
62452
|
}
|
|
62431
62453
|
async saveEnvironmentHookLog(entry) {
|
|
@@ -62435,7 +62457,7 @@ var WarmHookLogsService = class {
|
|
|
62435
62457
|
hookName: "environment",
|
|
62436
62458
|
...entry
|
|
62437
62459
|
};
|
|
62438
|
-
await writeFile11(
|
|
62460
|
+
await writeFile11(join38(LOGS_DIR2, ENVIRONMENT_HOOK_LOG_FILENAME), `${JSON.stringify(log, null, 2)}
|
|
62439
62461
|
`, "utf-8");
|
|
62440
62462
|
}
|
|
62441
62463
|
async saveRepoHookLog(repoName, entry) {
|
|
@@ -62445,7 +62467,7 @@ var WarmHookLogsService = class {
|
|
|
62445
62467
|
hookName: repoName,
|
|
62446
62468
|
...entry
|
|
62447
62469
|
};
|
|
62448
|
-
await writeFile11(
|
|
62470
|
+
await writeFile11(join38(LOGS_DIR2, repoHookLogFilename(repoName)), `${JSON.stringify(log, null, 2)}
|
|
62449
62471
|
`, "utf-8");
|
|
62450
62472
|
}
|
|
62451
62473
|
async getAllLogs() {
|
|
@@ -62464,7 +62486,7 @@ var WarmHookLogsService = class {
|
|
|
62464
62486
|
continue;
|
|
62465
62487
|
}
|
|
62466
62488
|
try {
|
|
62467
|
-
const raw = await readFile21(
|
|
62489
|
+
const raw = await readFile21(join38(LOGS_DIR2, file), "utf-8");
|
|
62468
62490
|
const stored = JSON.parse(raw);
|
|
62469
62491
|
logs.push(withPreview2(stored));
|
|
62470
62492
|
} catch {
|
|
@@ -62502,7 +62524,7 @@ var WarmHookLogsService = class {
|
|
|
62502
62524
|
async getFullOutput(hookType, hookName) {
|
|
62503
62525
|
const filename = hookType === "global" ? GLOBAL_FILENAME : hookType === "environment" ? ENVIRONMENT_HOOK_LOG_FILENAME : repoHookLogFilename(hookName);
|
|
62504
62526
|
try {
|
|
62505
|
-
const raw = await readFile21(
|
|
62527
|
+
const raw = await readFile21(join38(LOGS_DIR2, filename), "utf-8");
|
|
62506
62528
|
const stored = JSON.parse(raw);
|
|
62507
62529
|
if (stored.hookType !== hookType || stored.hookName !== hookName) {
|
|
62508
62530
|
return null;
|
|
@@ -62521,7 +62543,7 @@ var warmHookLogsService = new WarmHookLogsService();
|
|
|
62521
62543
|
// src/services/warm-hooks-service.ts
|
|
62522
62544
|
async function readRepoWarmHook(repoPath) {
|
|
62523
62545
|
for (const filename of REPLICAS_CONFIG_FILENAMES) {
|
|
62524
|
-
const configPath =
|
|
62546
|
+
const configPath = join39(repoPath, filename);
|
|
62525
62547
|
if (!existsSync19(configPath)) {
|
|
62526
62548
|
continue;
|
|
62527
62549
|
}
|
|
@@ -63495,6 +63517,13 @@ function createV1Routes(deps) {
|
|
|
63495
63517
|
}
|
|
63496
63518
|
return c.json(result);
|
|
63497
63519
|
});
|
|
63520
|
+
app2.get("/skill-files/content", async (c) => {
|
|
63521
|
+
const path7 = c.req.query("path");
|
|
63522
|
+
if (!path7) return c.json(jsonError("path is required"), 400);
|
|
63523
|
+
const result = await deps.repoFileService.readSkillFile(path7);
|
|
63524
|
+
if (!result) return c.json(jsonError("File not found"), 404);
|
|
63525
|
+
return c.json(result);
|
|
63526
|
+
});
|
|
63498
63527
|
app2.put("/repo-files/content", async (c) => {
|
|
63499
63528
|
const repoName = c.req.query("repoName");
|
|
63500
63529
|
const path7 = c.req.query("path");
|
|
@@ -63896,7 +63925,7 @@ data: ${JSON.stringify("Terminal session not found")}
|
|
|
63896
63925
|
const logFiles = files.filter((f) => f.endsWith(".log"));
|
|
63897
63926
|
const sessions = await Promise.all(
|
|
63898
63927
|
logFiles.map(async (filename) => {
|
|
63899
|
-
const filePath =
|
|
63928
|
+
const filePath = join40(LOG_DIR, filename);
|
|
63900
63929
|
const fileStat = await stat7(filePath);
|
|
63901
63930
|
const sessionId = filename.replace(/\.log$/, "");
|
|
63902
63931
|
return {
|
|
@@ -64122,8 +64151,8 @@ async function installWorkspaceSdk() {
|
|
|
64122
64151
|
// src/services/git-push-tracker.ts
|
|
64123
64152
|
import { mkdir as mkdir23, rm as rm5 } from "fs/promises";
|
|
64124
64153
|
import { createServer as createServer2 } from "net";
|
|
64125
|
-
import { join as
|
|
64126
|
-
var SOCKET_PATH =
|
|
64154
|
+
import { join as join41 } from "path";
|
|
64155
|
+
var SOCKET_PATH = join41(ENGINE_DIR2, "git-trace2.sock");
|
|
64127
64156
|
var MAX_LINE_LENGTH = 1024 * 1024;
|
|
64128
64157
|
var listening = null;
|
|
64129
64158
|
function startGitPushTracker() {
|
|
@@ -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-SR3TRBEI.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-VRMTJFZQ.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
package/package.json
CHANGED
package/workspace-sdk/index.js
CHANGED
|
@@ -30,7 +30,8 @@ async function requestResponse(path, options = {}) {
|
|
|
30
30
|
});
|
|
31
31
|
if (response.ok) return response;
|
|
32
32
|
const data = await parseResponse(response);
|
|
33
|
-
|
|
33
|
+
const message = typeof data?.error === 'string' ? data.error : data?.errors?.[0]?.message;
|
|
34
|
+
throw new Error(typeof message === 'string' ? message : `Replicas request failed (${response.status})`);
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
async function request(path, options = {}) {
|