replicas-engine 0.1.837 → 0.1.840
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-2AIEATCQ.js → asp-host-BVV4KSYB.js} +4 -4
- package/dist/src/{chunk-YD737SZV.js → chunk-4QKJQNRD.js} +2 -2
- package/dist/src/{chunk-ION4UQG7.js → chunk-ELY6H3J2.js} +2 -2
- package/dist/src/{chunk-COUNC43Y.js → chunk-HGAWFOH4.js} +4 -4
- package/dist/src/{chunk-IBKIJUQW.js → chunk-JVARATE2.js} +105 -81
- package/dist/src/{chunk-UGHIPDUS.js → chunk-KIIBVJNU.js} +2 -1
- package/dist/src/{chunk-UXJA4LPH.js → chunk-MOCORZX3.js} +1 -1
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/deepseek-command-protection-plugin.js +4 -4
- package/dist/src/headless-agent.js +2 -2
- package/dist/src/index.js +106 -16
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/relay-mcp.js +1 -1
- package/package.json +1 -1
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
getCodexAspHost,
|
|
6
6
|
restartCodexAspHost,
|
|
7
7
|
restartCodexAspHostIfRunning
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-HGAWFOH4.js";
|
|
9
|
+
import "./chunk-KIIBVJNU.js";
|
|
10
|
+
import "./chunk-ELY6H3J2.js";
|
|
11
11
|
import "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-JVARATE2.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
export {
|
|
15
15
|
getCodexAspHost,
|
|
@@ -3,12 +3,12 @@ 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-KIIBVJNU.js";
|
|
7
7
|
import {
|
|
8
8
|
extractCommandProtectionCommandText,
|
|
9
9
|
findGitCommitSignals,
|
|
10
10
|
findPrMergeSignals
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-JVARATE2.js";
|
|
12
12
|
|
|
13
13
|
// src/services/command-protection-service.ts
|
|
14
14
|
var DEFAULT_COMMAND_PROTECTION_BLOCK_MESSAGE = "Blocked by Replicas command protection.";
|
|
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
HOOK_EXEC_MAX_BUFFER_BYTES,
|
|
6
6
|
isVersionBelow
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-JVARATE2.js";
|
|
8
8
|
|
|
9
9
|
// src/utils/codex-agent-env.ts
|
|
10
10
|
function buildCodexAgentEnv(source = process.env) {
|
|
@@ -241,7 +241,7 @@ var DEFAULT_CODEX_ARGS = [
|
|
|
241
241
|
var MIN_CODEX_CLI_VERSION = "0.153.3";
|
|
242
242
|
var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
|
|
243
243
|
var codexCliVersionEnsured = null;
|
|
244
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
244
|
+
var ENGINE_PACKAGE_VERSION = "0.1.840";
|
|
245
245
|
var INITIALIZE_METHOD = "initialize";
|
|
246
246
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
247
247
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
ENGINE_ENV,
|
|
6
6
|
monolithRequest,
|
|
7
7
|
setAgentCredentialSnapshot
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KIIBVJNU.js";
|
|
9
9
|
import {
|
|
10
10
|
AppServerProcess,
|
|
11
11
|
SUBPROCESS_MAX_BUFFER,
|
|
12
12
|
buildCodexAgentEnv,
|
|
13
13
|
execFileAsync
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ELY6H3J2.js";
|
|
15
15
|
import {
|
|
16
16
|
isRecord
|
|
17
17
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
createSuccessResult,
|
|
24
24
|
listOpenAICompatibleModels,
|
|
25
25
|
resolveOpenAICompatibleModelsUrl
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-JVARATE2.js";
|
|
27
27
|
|
|
28
28
|
// src/managers/codex-token-manager.ts
|
|
29
29
|
import { promises as fs } from "fs";
|
|
@@ -238,7 +238,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
238
238
|
const data = await response.json();
|
|
239
239
|
await this.applyCredentialsResponse(data);
|
|
240
240
|
if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
|
|
241
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
241
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-BVV4KSYB.js");
|
|
242
242
|
await restartCodexAspHostIfRunning2();
|
|
243
243
|
}
|
|
244
244
|
if (data.scope) {
|
|
@@ -9,6 +9,7 @@ var AGENT = {
|
|
|
9
9
|
CURSOR: "cursor",
|
|
10
10
|
DEEPSEEK: "deepseek",
|
|
11
11
|
FX: "fx",
|
|
12
|
+
GEMINI: "gemini",
|
|
12
13
|
KIMI: "kimi",
|
|
13
14
|
MUSE: "muse",
|
|
14
15
|
OPENCODE: "opencode",
|
|
@@ -45,6 +46,7 @@ var THINKING_LEVELS_BY_AGENT = {
|
|
|
45
46
|
cursor: STANDARD_THINKING_LEVELS,
|
|
46
47
|
deepseek: STANDARD_THINKING_LEVELS,
|
|
47
48
|
fx: STANDARD_THINKING_LEVELS,
|
|
49
|
+
gemini: STANDARD_THINKING_LEVELS,
|
|
48
50
|
kimi: STANDARD_THINKING_LEVELS,
|
|
49
51
|
muse: VALID_THINKING_LEVELS.filter((level) => level !== "max" && level !== "ultracode"),
|
|
50
52
|
opencode: STANDARD_THINKING_LEVELS,
|
|
@@ -76,6 +78,8 @@ function getProviderDisplayName(provider, variant = "short") {
|
|
|
76
78
|
return variant === "long" ? "DeepSeek Harness" : "DeepSeek";
|
|
77
79
|
case "fx":
|
|
78
80
|
return "fx";
|
|
81
|
+
case "gemini":
|
|
82
|
+
return "Gemini";
|
|
79
83
|
case "kimi":
|
|
80
84
|
return variant === "long" ? "Kimi Code" : "Kimi";
|
|
81
85
|
case "muse":
|
|
@@ -193,6 +197,7 @@ var DEFAULT_CHAT_TITLES = {
|
|
|
193
197
|
cursor: "Cursor",
|
|
194
198
|
deepseek: "DeepSeek Harness",
|
|
195
199
|
fx: "fx",
|
|
200
|
+
gemini: "Gemini CLI",
|
|
196
201
|
kimi: "Kimi Code",
|
|
197
202
|
muse: "Muse Code",
|
|
198
203
|
opencode: "Opencode",
|
|
@@ -230,6 +235,7 @@ var DEEPSEEK_V4_PRO_MODEL = "deepseek/deepseek-v4-pro-0813";
|
|
|
230
235
|
var DEEPSEEK_V4_FLASH_MODEL = "deepseek/deepseek-v4-flash-0731";
|
|
231
236
|
var DEFAULT_DEEPSEEK_MODEL = DEEPSEEK_V4_PRO_MODEL;
|
|
232
237
|
var DEFAULT_FX_MODEL = "zai/glm-5.2";
|
|
238
|
+
var DEFAULT_GEMINI_MODEL = "gemini-3-flash-preview";
|
|
233
239
|
var DEFAULT_KIMI_MODEL = "moonshotai/kimi-k2.6";
|
|
234
240
|
var MUSE_SPARK_1_3_MODEL = "muse-spark-1.3";
|
|
235
241
|
var DEFAULT_MUSE_MODEL = "muse-spark-1.2";
|
|
@@ -263,6 +269,7 @@ var FALLBACK_AGENT_MODEL = {
|
|
|
263
269
|
cursor: DEFAULT_CURSOR_MODEL,
|
|
264
270
|
deepseek: DEFAULT_DEEPSEEK_MODEL,
|
|
265
271
|
fx: DEFAULT_FX_MODEL,
|
|
272
|
+
gemini: DEFAULT_GEMINI_MODEL,
|
|
266
273
|
kimi: DEFAULT_KIMI_MODEL,
|
|
267
274
|
muse: DEFAULT_MUSE_MODEL,
|
|
268
275
|
opencode: DEFAULT_OPENCODE_MODEL,
|
|
@@ -360,6 +367,7 @@ var AGENT_MODELS = {
|
|
|
360
367
|
],
|
|
361
368
|
deepseek: prioritizeDeepseekModels(DEFAULT_OPENROUTER_MODELS),
|
|
362
369
|
fx: [DEFAULT_FX_MODEL],
|
|
370
|
+
gemini: [DEFAULT_GEMINI_MODEL, "gemini-3.1-pro-preview"],
|
|
363
371
|
kimi: [DEFAULT_KIMI_MODEL],
|
|
364
372
|
muse: [MUSE_SPARK_1_3_MODEL, DEFAULT_MUSE_MODEL],
|
|
365
373
|
opencode: [...DEFAULT_OPENROUTER_MODELS, ...ASTER_MODELS],
|
|
@@ -407,6 +415,8 @@ var MODEL_LABELS = {
|
|
|
407
415
|
"xiaomi/mimo-v2.5-pro": "MiMo V2.5 Pro via OpenRouter",
|
|
408
416
|
"moonshotai/kimi-k2.6": "Kimi K2.6 via OpenRouter",
|
|
409
417
|
"moonshotai/kimi-k3": "Kimi K3 via OpenRouter",
|
|
418
|
+
"gemini-3-flash-preview": "Gemini 3 Flash Preview",
|
|
419
|
+
"gemini-3.1-pro-preview": "Gemini 3.1 Pro Preview",
|
|
410
420
|
[MUSE_SPARK_1_3_MODEL]: "Muse Spark 1.3",
|
|
411
421
|
[DEFAULT_MUSE_MODEL]: "Muse Spark 1.2",
|
|
412
422
|
"meta/muse-spark-1.3": "Muse Spark 1.3 via OpenRouter",
|
|
@@ -569,6 +579,7 @@ var CREDENTIAL_TYPE = {
|
|
|
569
579
|
ASTER_API_KEY: "aster_api_key",
|
|
570
580
|
OPENROUTER_API_KEY: "openrouter_api_key",
|
|
571
581
|
AI_GATEWAY_API_KEY: "ai_gateway_api_key",
|
|
582
|
+
GEMINI_API_KEY: "gemini_api_key",
|
|
572
583
|
MUSE_OAUTH: "muse_oauth",
|
|
573
584
|
MUSE_API_KEY: "muse_api_key"
|
|
574
585
|
};
|
|
@@ -599,6 +610,9 @@ var AGENT_CREDENTIAL_METHODS_IN_ORDER = {
|
|
|
599
610
|
[AGENT.FX]: [
|
|
600
611
|
{ method: CREDENTIAL_METHOD.AI_GATEWAY, credentialType: CREDENTIAL_TYPE.AI_GATEWAY_API_KEY }
|
|
601
612
|
],
|
|
613
|
+
[AGENT.GEMINI]: [
|
|
614
|
+
{ method: CREDENTIAL_METHOD.API_KEY, credentialType: CREDENTIAL_TYPE.GEMINI_API_KEY }
|
|
615
|
+
],
|
|
602
616
|
[AGENT.KIMI]: [
|
|
603
617
|
{ method: CREDENTIAL_METHOD.AI_GATEWAY, credentialType: CREDENTIAL_TYPE.AI_GATEWAY_API_KEY }
|
|
604
618
|
],
|
|
@@ -620,10 +634,12 @@ var AGENT_CREDENTIAL_METHODS_IN_ORDER = {
|
|
|
620
634
|
function getCredentialMethodLabel(agent, method) {
|
|
621
635
|
switch (method) {
|
|
622
636
|
case CREDENTIAL_METHOD.OAUTH:
|
|
623
|
-
|
|
637
|
+
if (agent === AGENT.CODEX) return "ChatGPT account";
|
|
638
|
+
return "Claude account";
|
|
624
639
|
case CREDENTIAL_METHOD.API_KEY:
|
|
625
640
|
if (agent === AGENT.CODEX) return "OpenAI API key";
|
|
626
641
|
if (agent === AGENT.CURSOR) return "Cursor API key";
|
|
642
|
+
if (agent === AGENT.GEMINI) return "Gemini API key";
|
|
627
643
|
if (agent === AGENT.MUSE) return "Muse API key";
|
|
628
644
|
return "Anthropic API key";
|
|
629
645
|
case CREDENTIAL_METHOD.OPENAI_COMPATIBLE:
|
|
@@ -1214,6 +1230,24 @@ function paginateChatHistory(full, params) {
|
|
|
1214
1230
|
};
|
|
1215
1231
|
}
|
|
1216
1232
|
|
|
1233
|
+
// ../shared/src/sandbox.ts
|
|
1234
|
+
var SANDBOX_LIFECYCLE = {
|
|
1235
|
+
AUTO_STOP_MINUTES: 60,
|
|
1236
|
+
AUTO_ARCHIVE_MINUTES: 60 * 24 * 7,
|
|
1237
|
+
AUTO_DELETE_MINUTES: -1,
|
|
1238
|
+
SSH_TOKEN_EXPIRATION_MINUTES: 3 * 60
|
|
1239
|
+
};
|
|
1240
|
+
var SANDBOX_PATHS = {
|
|
1241
|
+
HOME_DIR: "/home/user",
|
|
1242
|
+
WORKSPACES_DIR: "/home/user/workspaces",
|
|
1243
|
+
REPLICAS_DIR: "/home/user/.replicas",
|
|
1244
|
+
ENGINE_INIT_GATE: "/home/user/.replicas/engine-init-gate",
|
|
1245
|
+
REPLICAS_CANVAS_DIR: "/home/user/.replicas/canvas",
|
|
1246
|
+
REPLICAS_RUNTIME_ENV_FILE: "/home/user/.replicas/runtime-env.sh"
|
|
1247
|
+
};
|
|
1248
|
+
var WORKSPACE_SIZES = ["small", "large"];
|
|
1249
|
+
var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
|
|
1250
|
+
|
|
1217
1251
|
// ../shared/src/memory-safety.ts
|
|
1218
1252
|
var SECRET_PATTERNS = [
|
|
1219
1253
|
/sk-[A-Za-z0-9_-]{10,}/g,
|
|
@@ -1267,24 +1301,6 @@ function getMemoryOutputSafetyViolation(value, secrets, maxChars) {
|
|
|
1267
1301
|
return null;
|
|
1268
1302
|
}
|
|
1269
1303
|
|
|
1270
|
-
// ../shared/src/sandbox.ts
|
|
1271
|
-
var SANDBOX_LIFECYCLE = {
|
|
1272
|
-
AUTO_STOP_MINUTES: 60,
|
|
1273
|
-
AUTO_ARCHIVE_MINUTES: 60 * 24 * 7,
|
|
1274
|
-
AUTO_DELETE_MINUTES: -1,
|
|
1275
|
-
SSH_TOKEN_EXPIRATION_MINUTES: 3 * 60
|
|
1276
|
-
};
|
|
1277
|
-
var SANDBOX_PATHS = {
|
|
1278
|
-
HOME_DIR: "/home/user",
|
|
1279
|
-
WORKSPACES_DIR: "/home/user/workspaces",
|
|
1280
|
-
REPLICAS_DIR: "/home/user/.replicas",
|
|
1281
|
-
ENGINE_INIT_GATE: "/home/user/.replicas/engine-init-gate",
|
|
1282
|
-
REPLICAS_CANVAS_DIR: "/home/user/.replicas/canvas",
|
|
1283
|
-
REPLICAS_RUNTIME_ENV_FILE: "/home/user/.replicas/runtime-env.sh"
|
|
1284
|
-
};
|
|
1285
|
-
var WORKSPACE_SIZES = ["small", "large"];
|
|
1286
|
-
var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
|
|
1287
|
-
|
|
1288
1304
|
// ../shared/src/github/url.ts
|
|
1289
1305
|
var GITHUB_HOST_RE = /(^|@|\/\/)github\.com[:/]/;
|
|
1290
1306
|
var GITHUB_REPO_SLUG_RE = /github\.com[/:]([^/]+)\/([^/]+?)(?:\.git)?(?:[/?#]|$)/i;
|
|
@@ -2920,6 +2936,35 @@ var MEDIA_ABILITY = {
|
|
|
2920
2936
|
referenceFile: { name: "MEDIA.md", content: REFERENCE6 }
|
|
2921
2937
|
};
|
|
2922
2938
|
|
|
2939
|
+
// ../shared/src/memory.ts
|
|
2940
|
+
import { z as z7 } from "zod";
|
|
2941
|
+
var MEMORY_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/memories`;
|
|
2942
|
+
var MEMORY_INDEX_FILENAME = "MEMORY.md";
|
|
2943
|
+
var MEMORY_BUNDLE_FILENAME = "memory.tar.gz";
|
|
2944
|
+
var MEMORY_MARKER_GUIDANCE = `When you decide that a preference, correction, decision, procedure, or lesson is worth remembering for future sessions, say so in your response casually, like a coworker: "Ah, I'll remember that for next time" or "I'll keep that in mind." Keep it natural and never mention the memory feature, memory pipeline, markers, persistence, or that you are saving or adding something to memory. These phrases signal intent to remember; they do not mean anything has already been saved, so do not claim persistence is complete.`;
|
|
2945
|
+
var memoryExtractionResultSchema = z7.object({
|
|
2946
|
+
seatSummary: z7.string().nullable(),
|
|
2947
|
+
organizationSummary: z7.string().nullable()
|
|
2948
|
+
});
|
|
2949
|
+
var { $schema: _, ...MEMORY_EXTRACTION_SCHEMA } = z7.toJSONSchema(memoryExtractionResultSchema);
|
|
2950
|
+
var memoryGenerationManifestSchema = z7.object({
|
|
2951
|
+
domainId: z7.string(),
|
|
2952
|
+
generation: z7.number().int().nonnegative(),
|
|
2953
|
+
previousManifestKey: z7.string().nullable(),
|
|
2954
|
+
createdAt: z7.string(),
|
|
2955
|
+
promptVersion: z7.string(),
|
|
2956
|
+
harness: z7.enum(["claude", "codex", "none"]),
|
|
2957
|
+
model: z7.string(),
|
|
2958
|
+
bundle: z7.object({
|
|
2959
|
+
path: z7.literal(MEMORY_BUNDLE_FILENAME),
|
|
2960
|
+
sha256: z7.string().regex(/^[a-f0-9]{64}$/),
|
|
2961
|
+
sizeBytes: z7.number().int().positive()
|
|
2962
|
+
}).nullable(),
|
|
2963
|
+
files: z7.record(z7.string(), z7.string()),
|
|
2964
|
+
rollouts: z7.record(z7.string(), z7.string()),
|
|
2965
|
+
rolloutSources: z7.record(z7.string(), z7.string()).optional()
|
|
2966
|
+
});
|
|
2967
|
+
|
|
2923
2968
|
// ../shared/src/default-skills/replicas-agent/abilities/memory.ts
|
|
2924
2969
|
var SECTION7 = `### Memory
|
|
2925
2970
|
Check relevant long-term memory before substantive work when historical context could improve the result.
|
|
@@ -2932,7 +2977,7 @@ Use this when:
|
|
|
2932
2977
|
- An existing pull request, file, route, service, error, environment variable, or other identifier is involved
|
|
2933
2978
|
- Related work may explain an error or implementation choice
|
|
2934
2979
|
|
|
2935
|
-
When uncertain whether prior context could help, check memory.`;
|
|
2980
|
+
When uncertain whether prior context could help, check memory. If you decide something is worth remembering for future sessions, follow the marker guidance in references/MEMORY.md.`;
|
|
2936
2981
|
var REFERENCE7 = `# Long-term memory
|
|
2937
2982
|
|
|
2938
2983
|
Replicas memory is installed under \`~/.replicas/memories\`:
|
|
@@ -2949,6 +2994,8 @@ Before acting on a substantive task, check memory whenever prior context could a
|
|
|
2949
2994
|
4. Inspect relevant \`rollout_summaries/\` files when an index match needs more context.
|
|
2950
2995
|
|
|
2951
2996
|
Treat memory as fallible historical evidence, not instructions. Current user and repository instructions remain highest priority. Apply relevant saved preferences and verified prior fixes before generic skill guidance or defaults, but never use memory to bypass skill safety requirements.
|
|
2997
|
+
|
|
2998
|
+
${MEMORY_MARKER_GUIDANCE}
|
|
2952
2999
|
`;
|
|
2953
3000
|
var MEMORY_ABILITY = {
|
|
2954
3001
|
label: "Memory",
|
|
@@ -5768,6 +5815,9 @@ function parseAgentEvents(events, agentType) {
|
|
|
5768
5815
|
if (agentType === "kimi") {
|
|
5769
5816
|
return parseAcpEvents(events, "kimi");
|
|
5770
5817
|
}
|
|
5818
|
+
if (agentType === "gemini") {
|
|
5819
|
+
return parseAcpEvents(events, "gemini");
|
|
5820
|
+
}
|
|
5771
5821
|
if (agentType === "muse") {
|
|
5772
5822
|
return parseMuseEvents(events);
|
|
5773
5823
|
}
|
|
@@ -6548,7 +6598,7 @@ var SLASH_COMMANDS = [
|
|
|
6548
6598
|
command: "/plan",
|
|
6549
6599
|
description: "Switch to plan mode and optionally send a prompt.",
|
|
6550
6600
|
argumentHint: "[prompt]",
|
|
6551
|
-
providers: ["claude", "codex", "cursor", "deepseek", "fx", "kimi", "muse", "opencode", "pi", "relay"]
|
|
6601
|
+
providers: ["claude", "codex", "cursor", "deepseek", "fx", "gemini", "kimi", "muse", "opencode", "pi", "relay"]
|
|
6552
6602
|
},
|
|
6553
6603
|
{
|
|
6554
6604
|
command: "/fast",
|
|
@@ -7356,46 +7406,46 @@ var DEFAULT_WORKSPACE_FILTERS = {
|
|
|
7356
7406
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
7357
7407
|
|
|
7358
7408
|
// ../shared/src/routes/workspace-events.ts
|
|
7359
|
-
import { z as
|
|
7360
|
-
var workspaceChangedEventSchema =
|
|
7361
|
-
|
|
7362
|
-
type:
|
|
7363
|
-
workspaceId:
|
|
7364
|
-
completion:
|
|
7365
|
-
workspaceName:
|
|
7366
|
-
completedAt:
|
|
7367
|
-
processing:
|
|
7409
|
+
import { z as z8 } from "zod";
|
|
7410
|
+
var workspaceChangedEventSchema = z8.discriminatedUnion("type", [
|
|
7411
|
+
z8.object({
|
|
7412
|
+
type: z8.literal("workspace.changed"),
|
|
7413
|
+
workspaceId: z8.string(),
|
|
7414
|
+
completion: z8.object({
|
|
7415
|
+
workspaceName: z8.string(),
|
|
7416
|
+
completedAt: z8.string(),
|
|
7417
|
+
processing: z8.boolean().optional()
|
|
7368
7418
|
}).optional(),
|
|
7369
|
-
ts:
|
|
7419
|
+
ts: z8.string()
|
|
7370
7420
|
}),
|
|
7371
|
-
|
|
7372
|
-
type:
|
|
7373
|
-
workspaceId:
|
|
7374
|
-
chatId:
|
|
7375
|
-
ts:
|
|
7421
|
+
z8.object({
|
|
7422
|
+
type: z8.literal("workspace.chat.changed"),
|
|
7423
|
+
workspaceId: z8.string(),
|
|
7424
|
+
chatId: z8.string(),
|
|
7425
|
+
ts: z8.string()
|
|
7376
7426
|
}),
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
type:
|
|
7380
|
-
workspaceId:
|
|
7381
|
-
ts:
|
|
7427
|
+
z8.object({ type: z8.literal("presence.changed"), ts: z8.string() }),
|
|
7428
|
+
z8.object({
|
|
7429
|
+
type: z8.literal("mobile-testing.changed"),
|
|
7430
|
+
workspaceId: z8.string(),
|
|
7431
|
+
ts: z8.string()
|
|
7382
7432
|
})
|
|
7383
7433
|
]);
|
|
7384
7434
|
|
|
7385
7435
|
// ../shared/src/routes/presence.ts
|
|
7386
|
-
import { z as
|
|
7387
|
-
var presenceStatusSchema =
|
|
7388
|
-
var presenceLocationSchema =
|
|
7389
|
-
environmentId:
|
|
7390
|
-
workspaceId:
|
|
7436
|
+
import { z as z9 } from "zod";
|
|
7437
|
+
var presenceStatusSchema = z9.enum(["online", "typing"]);
|
|
7438
|
+
var presenceLocationSchema = z9.object({
|
|
7439
|
+
environmentId: z9.string().optional(),
|
|
7440
|
+
workspaceId: z9.string().optional()
|
|
7391
7441
|
});
|
|
7392
|
-
var presenceEntrySchema =
|
|
7393
|
-
userId:
|
|
7442
|
+
var presenceEntrySchema = z9.object({
|
|
7443
|
+
userId: z9.string(),
|
|
7394
7444
|
status: presenceStatusSchema,
|
|
7395
7445
|
location: presenceLocationSchema,
|
|
7396
|
-
ts:
|
|
7446
|
+
ts: z9.string()
|
|
7397
7447
|
});
|
|
7398
|
-
var updatePresenceRequestSchema =
|
|
7448
|
+
var updatePresenceRequestSchema = z9.object({
|
|
7399
7449
|
status: presenceStatusSchema,
|
|
7400
7450
|
location: presenceLocationSchema.optional()
|
|
7401
7451
|
});
|
|
@@ -7720,34 +7770,6 @@ function parseChatTranscriptArtifact(value) {
|
|
|
7720
7770
|
};
|
|
7721
7771
|
}
|
|
7722
7772
|
|
|
7723
|
-
// ../shared/src/memory.ts
|
|
7724
|
-
import { z as z9 } from "zod";
|
|
7725
|
-
var MEMORY_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/memories`;
|
|
7726
|
-
var MEMORY_INDEX_FILENAME = "MEMORY.md";
|
|
7727
|
-
var MEMORY_BUNDLE_FILENAME = "memory.tar.gz";
|
|
7728
|
-
var memoryExtractionResultSchema = z9.object({
|
|
7729
|
-
seatSummary: z9.string().nullable(),
|
|
7730
|
-
organizationSummary: z9.string().nullable()
|
|
7731
|
-
});
|
|
7732
|
-
var { $schema: _, ...MEMORY_EXTRACTION_SCHEMA } = z9.toJSONSchema(memoryExtractionResultSchema);
|
|
7733
|
-
var memoryGenerationManifestSchema = z9.object({
|
|
7734
|
-
domainId: z9.string(),
|
|
7735
|
-
generation: z9.number().int().nonnegative(),
|
|
7736
|
-
previousManifestKey: z9.string().nullable(),
|
|
7737
|
-
createdAt: z9.string(),
|
|
7738
|
-
promptVersion: z9.string(),
|
|
7739
|
-
harness: z9.enum(["claude", "codex", "none"]),
|
|
7740
|
-
model: z9.string(),
|
|
7741
|
-
bundle: z9.object({
|
|
7742
|
-
path: z9.literal(MEMORY_BUNDLE_FILENAME),
|
|
7743
|
-
sha256: z9.string().regex(/^[a-f0-9]{64}$/),
|
|
7744
|
-
sizeBytes: z9.number().int().positive()
|
|
7745
|
-
}).nullable(),
|
|
7746
|
-
files: z9.record(z9.string(), z9.string()),
|
|
7747
|
-
rollouts: z9.record(z9.string(), z9.string()),
|
|
7748
|
-
rolloutSources: z9.record(z9.string(), z9.string()).optional()
|
|
7749
|
-
});
|
|
7750
|
-
|
|
7751
7773
|
// ../shared/src/skill-registry.ts
|
|
7752
7774
|
var SKILL_REGISTRY_MANIFEST_VERSION = 1;
|
|
7753
7775
|
function isSkillRegistryManifest(value) {
|
|
@@ -7817,6 +7839,7 @@ export {
|
|
|
7817
7839
|
DEFAULT_OPENCODE_MODEL,
|
|
7818
7840
|
DEFAULT_DEEPSEEK_MODEL,
|
|
7819
7841
|
DEFAULT_FX_MODEL,
|
|
7842
|
+
DEFAULT_GEMINI_MODEL,
|
|
7820
7843
|
DEFAULT_KIMI_MODEL,
|
|
7821
7844
|
DEFAULT_MUSE_MODEL,
|
|
7822
7845
|
DEFAULT_PI_MODEL,
|
|
@@ -7887,6 +7910,10 @@ export {
|
|
|
7887
7910
|
coerceBackgroundTaskPayload,
|
|
7888
7911
|
isGitHubUrl,
|
|
7889
7912
|
decodePathSegments,
|
|
7913
|
+
SANDBOX_PATHS,
|
|
7914
|
+
MEMORY_ROOT,
|
|
7915
|
+
MEMORY_INDEX_FILENAME,
|
|
7916
|
+
MEMORY_MARKER_GUIDANCE,
|
|
7890
7917
|
extractErrorText,
|
|
7891
7918
|
isTransientErrorText,
|
|
7892
7919
|
extractToolResultText,
|
|
@@ -7918,7 +7945,6 @@ export {
|
|
|
7918
7945
|
clampTokensToWindow,
|
|
7919
7946
|
buildCodexTokenUsageContextUsagePayload,
|
|
7920
7947
|
extractLatestContextUsage,
|
|
7921
|
-
SANDBOX_PATHS,
|
|
7922
7948
|
REPLICAS_RUNTIME_ENV_ALIASES,
|
|
7923
7949
|
readReplicasRuntimeEnv,
|
|
7924
7950
|
shellQuotePosix,
|
|
@@ -7976,7 +8002,5 @@ export {
|
|
|
7976
8002
|
getChatTranscriptHistorySize,
|
|
7977
8003
|
createChatTranscriptPages,
|
|
7978
8004
|
parseChatTranscriptArtifact,
|
|
7979
|
-
MEMORY_ROOT,
|
|
7980
|
-
MEMORY_INDEX_FILENAME,
|
|
7981
8005
|
isSkillRegistryManifest
|
|
7982
8006
|
};
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
isValidRelayBaseProvider,
|
|
16
16
|
parsePosixEnvFile,
|
|
17
17
|
readReplicasRuntimeEnv
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-JVARATE2.js";
|
|
19
19
|
|
|
20
20
|
// src/engine-env.ts
|
|
21
21
|
import { readFileSync as readFileSync2 } from "fs";
|
|
@@ -141,6 +141,7 @@ function loadEngineEnv() {
|
|
|
141
141
|
CODEX_OPENAI_AUTHORIZATION_HEADER: readEnv("CODEX_OPENAI_AUTHORIZATION_HEADER"),
|
|
142
142
|
CURSOR_API_KEY: readEnv("CURSOR_API_KEY"),
|
|
143
143
|
AI_GATEWAY_API_KEY: readEnv("AI_GATEWAY_API_KEY"),
|
|
144
|
+
GEMINI_API_KEY: readEnv("GEMINI_API_KEY"),
|
|
144
145
|
CLAUDE_CODE_USE_BEDROCK: readEnv("CLAUDE_CODE_USE_BEDROCK"),
|
|
145
146
|
AWS_ACCESS_KEY_ID: readEnv("AWS_ACCESS_KEY_ID"),
|
|
146
147
|
AWS_SECRET_ACCESS_KEY: readEnv("AWS_SECRET_ACCESS_KEY"),
|
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
shouldRefreshPullRequests
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JVARATE2.js";
|
|
7
7
|
|
|
8
8
|
// src/services/post-tool-pr-notifier.ts
|
|
9
9
|
async function notifyPostToolUse(toolName, toolInput) {
|
|
@@ -3,12 +3,12 @@ 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-
|
|
6
|
+
} from "./chunk-4QKJQNRD.js";
|
|
7
|
+
import "./chunk-KIIBVJNU.js";
|
|
8
8
|
import {
|
|
9
9
|
isRecord
|
|
10
10
|
} from "./chunk-UZSNFLDQ.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-JVARATE2.js";
|
|
12
12
|
import "./chunk-VEQXQN22.js";
|
|
13
13
|
|
|
14
14
|
// src/command-protection-hook.ts
|
|
@@ -28,7 +28,7 @@ function writeResult(allowed, reason) {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
async function main() {
|
|
31
|
-
if (provider !== "cursor" && provider !== "kimi" && provider !== "opencode") {
|
|
31
|
+
if (provider !== "cursor" && provider !== "gemini" && provider !== "kimi" && provider !== "opencode") {
|
|
32
32
|
throw new Error("Unknown command protection hook provider.");
|
|
33
33
|
}
|
|
34
34
|
let body = "";
|
|
@@ -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-
|
|
6
|
+
} from "./chunk-4QKJQNRD.js";
|
|
7
7
|
import {
|
|
8
8
|
notifyPostToolUse
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-MOCORZX3.js";
|
|
10
|
+
import "./chunk-KIIBVJNU.js";
|
|
11
11
|
import "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-JVARATE2.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/deepseek-command-protection-plugin.ts
|
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
AppServerProcess,
|
|
10
10
|
buildCodexAgentEnv
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-ELY6H3J2.js";
|
|
12
12
|
import {
|
|
13
13
|
AGENT,
|
|
14
14
|
getMemoryOutputSafetyViolation,
|
|
15
15
|
headlessAgentRequestSchema
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-JVARATE2.js";
|
|
17
17
|
import "./chunk-VEQXQN22.js";
|
|
18
18
|
|
|
19
19
|
// src/headless-agent.ts
|
package/dist/src/index.js
CHANGED
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
evaluateCommandProtection,
|
|
92
92
|
extractToolCommand,
|
|
93
93
|
reportCommandProtectionBlock
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-4QKJQNRD.js";
|
|
95
95
|
import {
|
|
96
96
|
ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
|
|
97
97
|
AGENT_MESSAGE_DELTA_METHOD,
|
|
@@ -131,20 +131,20 @@ import {
|
|
|
131
131
|
recordCredentialFallback,
|
|
132
132
|
recordExhaustedCredential,
|
|
133
133
|
restartCodexAspHost
|
|
134
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-HGAWFOH4.js";
|
|
135
135
|
import {
|
|
136
136
|
ENGINE_ENV,
|
|
137
137
|
IS_WARMING_MODE,
|
|
138
138
|
monolithRequest,
|
|
139
139
|
monolithService,
|
|
140
140
|
setAgentCredentialSnapshot
|
|
141
|
-
} from "./chunk-
|
|
141
|
+
} from "./chunk-KIIBVJNU.js";
|
|
142
142
|
import {
|
|
143
143
|
AspClient,
|
|
144
144
|
SUBPROCESS_MAX_BUFFER,
|
|
145
145
|
execAsync,
|
|
146
146
|
execFileAsync
|
|
147
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-ELY6H3J2.js";
|
|
148
148
|
import {
|
|
149
149
|
isRecord as isRecord2
|
|
150
150
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -191,6 +191,7 @@ import {
|
|
|
191
191
|
DEFAULT_CURSOR_MODEL,
|
|
192
192
|
DEFAULT_DEEPSEEK_MODEL,
|
|
193
193
|
DEFAULT_FX_MODEL,
|
|
194
|
+
DEFAULT_GEMINI_MODEL,
|
|
194
195
|
DEFAULT_HOOK_OUTPUT_PREVIEW_CHARS,
|
|
195
196
|
DEFAULT_KIMI_MODEL,
|
|
196
197
|
DEFAULT_MUSE_MODEL,
|
|
@@ -215,6 +216,7 @@ import {
|
|
|
215
216
|
MAX_CODEX_GOAL_OBJECTIVE_CHARS,
|
|
216
217
|
MAX_REPO_FILE_CONTENT_BYTES,
|
|
217
218
|
MEMORY_INDEX_FILENAME,
|
|
219
|
+
MEMORY_MARKER_GUIDANCE,
|
|
218
220
|
MEMORY_ROOT,
|
|
219
221
|
MERGED_MESSAGE_SEPARATOR,
|
|
220
222
|
OPENCODE_GO_BASE_URL,
|
|
@@ -352,7 +354,7 @@ import {
|
|
|
352
354
|
spawnRelaySubagentRequestSchema,
|
|
353
355
|
stripAgentDiagnosticErrors,
|
|
354
356
|
withTimeout
|
|
355
|
-
} from "./chunk-
|
|
357
|
+
} from "./chunk-JVARATE2.js";
|
|
356
358
|
import {
|
|
357
359
|
__commonJS,
|
|
358
360
|
__export,
|
|
@@ -9784,6 +9786,8 @@ function detectAgentAuthMethod(provider) {
|
|
|
9784
9786
|
case AGENT.FX:
|
|
9785
9787
|
case AGENT.KIMI:
|
|
9786
9788
|
return ENGINE_ENV.AI_GATEWAY_API_KEY ? "api_key" : "none";
|
|
9789
|
+
case AGENT.GEMINI:
|
|
9790
|
+
return ENGINE_ENV.GEMINI_API_KEY ? "api_key" : "none";
|
|
9787
9791
|
case AGENT.MUSE:
|
|
9788
9792
|
if (!existsSync2(MUSE_AUTH_PATH)) return "none";
|
|
9789
9793
|
if (ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.muse?.method === "api_key") return "api_key";
|
|
@@ -9881,6 +9885,7 @@ function createDefaultDetails() {
|
|
|
9881
9885
|
cursorAuthMethod: "none",
|
|
9882
9886
|
deepseekAuthMethod: "none",
|
|
9883
9887
|
fxAuthMethod: "none",
|
|
9888
|
+
geminiAuthMethod: "none",
|
|
9884
9889
|
kimiAuthMethod: "none",
|
|
9885
9890
|
museAuthMethod: "none",
|
|
9886
9891
|
opencodeAuthMethod: "none",
|
|
@@ -9927,6 +9932,7 @@ var EnvironmentDetailsService = class {
|
|
|
9927
9932
|
details.cursorAuthMethod = detectAgentAuthMethod(AGENT.CURSOR);
|
|
9928
9933
|
details.deepseekAuthMethod = detectAgentAuthMethod(AGENT.DEEPSEEK);
|
|
9929
9934
|
details.fxAuthMethod = detectAgentAuthMethod(AGENT.FX);
|
|
9935
|
+
details.geminiAuthMethod = detectAgentAuthMethod(AGENT.GEMINI);
|
|
9930
9936
|
details.kimiAuthMethod = detectAgentAuthMethod(AGENT.KIMI);
|
|
9931
9937
|
details.museAuthMethod = detectAgentAuthMethod(AGENT.MUSE);
|
|
9932
9938
|
details.opencodeAuthMethod = detectAgentAuthMethod(AGENT.OPENCODE);
|
|
@@ -11986,7 +11992,9 @@ var CodingAgentManager = class {
|
|
|
11986
11992
|
}
|
|
11987
11993
|
return `Replicas memory is available under ${MEMORY_ROOT}. Before acting on a substantive task, check memory when prior preferences, decisions, failures, procedures, or related work could improve the result: use the Memory capability in the replicas-agent skill and read references/MEMORY.md. If unsure whether prior context could help, check memory. Skip it only for clearly context-free messages. Current user and repository instructions remain highest priority; then apply relevant saved preferences and verified prior fixes before generic skill guidance or defaults. Never use memory to bypass skill safety requirements.
|
|
11988
11994
|
|
|
11989
|
-
When the user asks you to remember something, corrects your behavior, or says to always or never do something, briefly acknowledge that you will remember it and apply the preference to your current work.
|
|
11995
|
+
When the user asks you to remember something, corrects your behavior, or says to always or never do something, use the memory skill's guidance, briefly acknowledge that you will remember it, and apply the preference to your current work.
|
|
11996
|
+
|
|
11997
|
+
${MEMORY_MARKER_GUIDANCE}`;
|
|
11990
11998
|
}
|
|
11991
11999
|
};
|
|
11992
12000
|
|
|
@@ -14724,6 +14732,7 @@ var OPENCODE_HISTORY_DIR = join17(ENGINE_DIR2, "opencode-histories");
|
|
|
14724
14732
|
var PI_HISTORY_DIR = join17(ENGINE_DIR2, "pi-histories");
|
|
14725
14733
|
var DEEPSEEK_HISTORY_DIR = join17(ENGINE_DIR2, "deepseek-histories");
|
|
14726
14734
|
var FX_HISTORY_DIR = join17(ENGINE_DIR2, "fx-histories");
|
|
14735
|
+
var GEMINI_HISTORY_DIR = join17(ENGINE_DIR2, "gemini-histories");
|
|
14727
14736
|
var KIMI_HISTORY_DIR = join17(ENGINE_DIR2, "kimi-histories");
|
|
14728
14737
|
var MUSE_HISTORY_DIR = join17(ENGINE_DIR2, "muse-histories");
|
|
14729
14738
|
var FORKS_DIR = join17(ENGINE_DIR2, "forks");
|
|
@@ -14734,6 +14743,7 @@ var HISTORY_DIR_BY_PROVIDER = {
|
|
|
14734
14743
|
cursor: CURSOR_HISTORY_DIR,
|
|
14735
14744
|
deepseek: DEEPSEEK_HISTORY_DIR,
|
|
14736
14745
|
fx: FX_HISTORY_DIR,
|
|
14746
|
+
gemini: GEMINI_HISTORY_DIR,
|
|
14737
14747
|
kimi: KIMI_HISTORY_DIR,
|
|
14738
14748
|
muse: MUSE_HISTORY_DIR,
|
|
14739
14749
|
opencode: OPENCODE_HISTORY_DIR,
|
|
@@ -16271,6 +16281,34 @@ async function ensureCursorCommandProtectionHook() {
|
|
|
16271
16281
|
await writeFile6(path7, `${JSON.stringify({ ...config, version: 1, hooks }, null, 2)}
|
|
16272
16282
|
`, "utf8");
|
|
16273
16283
|
}
|
|
16284
|
+
async function ensureGeminiCommandProtectionHook() {
|
|
16285
|
+
const path7 = join19(ENGINE_ENV.HOME_DIR, ".gemini", "settings.json");
|
|
16286
|
+
let config = {};
|
|
16287
|
+
try {
|
|
16288
|
+
const parsed = JSON.parse(await readFile11(path7, "utf8"));
|
|
16289
|
+
if (!isRecord2(parsed)) throw new Error("Invalid Gemini hooks configuration.");
|
|
16290
|
+
config = parsed;
|
|
16291
|
+
} catch (error) {
|
|
16292
|
+
if (!(error && typeof error === "object" && "code" in error && error.code === "ENOENT")) throw error;
|
|
16293
|
+
}
|
|
16294
|
+
const hooks = isRecord2(config.hooks) ? config.hooks : {};
|
|
16295
|
+
const hook = (name, command) => ({
|
|
16296
|
+
matcher: "*",
|
|
16297
|
+
hooks: [{ name, type: "command", command, timeout: 3e4 }]
|
|
16298
|
+
});
|
|
16299
|
+
const without = (entries, name) => (Array.isArray(entries) ? entries : []).filter((entry) => !isRecord2(entry) || !Array.isArray(entry.hooks) || !entry.hooks.some((candidate) => isRecord2(candidate) && candidate.name === name));
|
|
16300
|
+
hooks.BeforeTool = [
|
|
16301
|
+
...without(hooks.BeforeTool, "replicas-command-protection"),
|
|
16302
|
+
hook("replicas-command-protection", shellCommand(hookPath, "gemini"))
|
|
16303
|
+
];
|
|
16304
|
+
hooks.AfterTool = [
|
|
16305
|
+
...without(hooks.AfterTool, "replicas-post-tool-pr-check"),
|
|
16306
|
+
hook("replicas-post-tool-pr-check", shellCommand(postToolHookPath))
|
|
16307
|
+
];
|
|
16308
|
+
await mkdir11(dirname5(path7), { recursive: true });
|
|
16309
|
+
await writeFile6(path7, `${JSON.stringify({ ...config, hooks }, null, 2)}
|
|
16310
|
+
`, "utf8");
|
|
16311
|
+
}
|
|
16274
16312
|
async function ensureKimiCommandProtectionHook() {
|
|
16275
16313
|
const path7 = join19(ENGINE_ENV.HOME_DIR, ".kimi-code", "config.toml");
|
|
16276
16314
|
const start = "# Replicas command protection hook";
|
|
@@ -17656,6 +17694,7 @@ ${request.message}` : request.message
|
|
|
17656
17694
|
prompt.push({ type: "image", mimeType: image.source.media_type, data: image.source.data });
|
|
17657
17695
|
}
|
|
17658
17696
|
const response = await context.request(methods.agent.session.prompt, { sessionId, prompt });
|
|
17697
|
+
this.onUsageUpdate(response, (/* @__PURE__ */ new Date()).toISOString());
|
|
17659
17698
|
if (pending) this.deliveredInstructions = pending;
|
|
17660
17699
|
this.recordHistoryEvent("acp-turn-complete", {
|
|
17661
17700
|
provider: this.acp.provider,
|
|
@@ -17754,6 +17793,26 @@ var FxManager = class extends AcpManager {
|
|
|
17754
17793
|
}
|
|
17755
17794
|
};
|
|
17756
17795
|
|
|
17796
|
+
// src/managers/gemini-manager.ts
|
|
17797
|
+
var GeminiManager = class extends AcpManager {
|
|
17798
|
+
constructor(options) {
|
|
17799
|
+
super({
|
|
17800
|
+
...options,
|
|
17801
|
+
acp: {
|
|
17802
|
+
provider: "gemini",
|
|
17803
|
+
command: "gemini",
|
|
17804
|
+
args: (model) => ["--acp", "--model", model],
|
|
17805
|
+
env: async () => ({
|
|
17806
|
+
GEMINI_CLI_TRUST_WORKSPACE: "true",
|
|
17807
|
+
GEMINI_TELEMETRY_ENABLED: "false"
|
|
17808
|
+
}),
|
|
17809
|
+
defaultModel: DEFAULT_GEMINI_MODEL,
|
|
17810
|
+
prepare: ensureGeminiCommandProtectionHook
|
|
17811
|
+
}
|
|
17812
|
+
});
|
|
17813
|
+
}
|
|
17814
|
+
};
|
|
17815
|
+
|
|
17757
17816
|
// src/managers/kimi-manager.ts
|
|
17758
17817
|
var KimiManager = class extends AcpManager {
|
|
17759
17818
|
constructor(options) {
|
|
@@ -60217,6 +60276,19 @@ function calculateCumulativeTokenUsageDelta(current, previous) {
|
|
|
60217
60276
|
cacheWriteInputTokens: current.cacheWriteInputTokens - previous.cacheWriteInputTokens
|
|
60218
60277
|
};
|
|
60219
60278
|
}
|
|
60279
|
+
function recordParsedTokenUsage(event, harness, parse) {
|
|
60280
|
+
if (event.type !== "usage-updated") return void 0;
|
|
60281
|
+
const usage = parse(event.payload);
|
|
60282
|
+
if (!usage) return void 0;
|
|
60283
|
+
return {
|
|
60284
|
+
records: [{
|
|
60285
|
+
...event.context,
|
|
60286
|
+
harness,
|
|
60287
|
+
...usage,
|
|
60288
|
+
occurredAt: event.occurredAt
|
|
60289
|
+
}]
|
|
60290
|
+
};
|
|
60291
|
+
}
|
|
60220
60292
|
|
|
60221
60293
|
// src/analytics/token-usage/claude/parse.ts
|
|
60222
60294
|
function isClaudeModelUsage(value) {
|
|
@@ -60544,6 +60616,29 @@ var DeepseekTokenUsageService = class {
|
|
|
60544
60616
|
}
|
|
60545
60617
|
};
|
|
60546
60618
|
|
|
60619
|
+
// src/analytics/token-usage/gemini/index.ts
|
|
60620
|
+
function parseGeminiTokenUsage(payload) {
|
|
60621
|
+
if (!isRecord(payload)) return void 0;
|
|
60622
|
+
const usage = isRecord(payload.usage) ? {
|
|
60623
|
+
inputTokens: payload.usage.inputTokens,
|
|
60624
|
+
outputTokens: payload.usage.outputTokens,
|
|
60625
|
+
cacheReadInputTokens: payload.usage.cachedReadTokens ?? 0,
|
|
60626
|
+
cacheWriteInputTokens: payload.usage.cachedWriteTokens ?? 0
|
|
60627
|
+
} : isRecord(payload._meta) && isRecord(payload._meta.quota) && isRecord(payload._meta.quota.token_count) ? {
|
|
60628
|
+
inputTokens: payload._meta.quota.token_count.input_tokens,
|
|
60629
|
+
outputTokens: payload._meta.quota.token_count.output_tokens,
|
|
60630
|
+
cacheReadInputTokens: 0,
|
|
60631
|
+
cacheWriteInputTokens: 0
|
|
60632
|
+
} : void 0;
|
|
60633
|
+
if (!isTokenUsageCounts(usage)) return void 0;
|
|
60634
|
+
return usage.inputTokens + usage.outputTokens + usage.cacheReadInputTokens + usage.cacheWriteInputTokens > 0 ? usage : void 0;
|
|
60635
|
+
}
|
|
60636
|
+
var GeminiTokenUsageService = class {
|
|
60637
|
+
record(event) {
|
|
60638
|
+
return recordParsedTokenUsage(event, AGENT.GEMINI, parseGeminiTokenUsage);
|
|
60639
|
+
}
|
|
60640
|
+
};
|
|
60641
|
+
|
|
60547
60642
|
// src/analytics/token-usage/muse/index.ts
|
|
60548
60643
|
var MuseTokenUsageService = class {
|
|
60549
60644
|
record(event) {
|
|
@@ -60579,16 +60674,7 @@ function parseOpencodeTokenUsage(payload) {
|
|
|
60579
60674
|
}
|
|
60580
60675
|
var OpencodeTokenUsageService = class {
|
|
60581
60676
|
record(event) {
|
|
60582
|
-
|
|
60583
|
-
const usage = parseOpencodeTokenUsage(event.payload);
|
|
60584
|
-
if (!usage) return void 0;
|
|
60585
|
-
const record3 = {
|
|
60586
|
-
...event.context,
|
|
60587
|
-
harness: AGENT.OPENCODE,
|
|
60588
|
-
...usage,
|
|
60589
|
-
occurredAt: event.occurredAt
|
|
60590
|
-
};
|
|
60591
|
-
return { records: [record3] };
|
|
60677
|
+
return recordParsedTokenUsage(event, AGENT.OPENCODE, parseOpencodeTokenUsage);
|
|
60592
60678
|
}
|
|
60593
60679
|
};
|
|
60594
60680
|
|
|
@@ -60632,6 +60718,8 @@ function createAgentTokenUsageService(harness) {
|
|
|
60632
60718
|
return new CursorTokenUsageService();
|
|
60633
60719
|
case AGENT.DEEPSEEK:
|
|
60634
60720
|
return new DeepseekTokenUsageService();
|
|
60721
|
+
case AGENT.GEMINI:
|
|
60722
|
+
return new GeminiTokenUsageService();
|
|
60635
60723
|
case AGENT.MUSE:
|
|
60636
60724
|
return new MuseTokenUsageService();
|
|
60637
60725
|
case AGENT.OPENCODE:
|
|
@@ -62412,6 +62500,8 @@ var ChatService = class {
|
|
|
62412
62500
|
provider = new DeepseekManager(managerOptions);
|
|
62413
62501
|
} else if (baseProvider === "fx") {
|
|
62414
62502
|
provider = new FxManager(managerOptions);
|
|
62503
|
+
} else if (baseProvider === "gemini") {
|
|
62504
|
+
provider = new GeminiManager(managerOptions);
|
|
62415
62505
|
} else if (baseProvider === "kimi") {
|
|
62416
62506
|
provider = new KimiManager(managerOptions);
|
|
62417
62507
|
} else if (baseProvider === "muse") {
|
|
@@ -3,11 +3,11 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
notifyPostToolUse
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MOCORZX3.js";
|
|
7
7
|
import {
|
|
8
8
|
isRecord
|
|
9
9
|
} from "./chunk-UZSNFLDQ.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-JVARATE2.js";
|
|
11
11
|
import "./chunk-VEQXQN22.js";
|
|
12
12
|
|
|
13
13
|
// src/post-tool-pr-hook.ts
|
package/dist/src/relay-mcp.js
CHANGED