replicas-engine 0.1.972 → 0.1.974
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-EMHKC7MS.js → asp-host-QVTM4VFE.js} +5 -5
- package/dist/src/{chunk-4KMPRAV6.js → chunk-32UPBL5I.js} +222 -144
- package/dist/src/{chunk-MHGSYSA2.js → chunk-AWKW6SD6.js} +1 -1
- package/dist/src/{chunk-H3TOWSYM.js → chunk-BXCLRUIK.js} +6 -6
- package/dist/src/{chunk-EUMRQH4J.js → chunk-D4BDGH53.js} +1 -1
- package/dist/src/{chunk-ZRCBGXER.js → chunk-ETEMP3CF.js} +3 -3
- package/dist/src/{chunk-TKL6YDX4.js → chunk-FEOJV72E.js} +3 -3
- package/dist/src/{chunk-JH2UMGOT.js → chunk-HLLDPEDK.js} +1 -1
- package/dist/src/{chunk-UPCC4BX5.js → chunk-P73LGPQO.js} +2 -0
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +4 -4
- package/dist/src/index.js +64 -9
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/subagent-mcp.js +1 -1
- package/package.json +1 -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-BXCLRUIK.js";
|
|
9
|
+
import "./chunk-HLLDPEDK.js";
|
|
10
|
+
import "./chunk-FEOJV72E.js";
|
|
11
|
+
import "./chunk-D4BDGH53.js";
|
|
12
12
|
import "./chunk-UZSNFLDQ.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-32UPBL5I.js";
|
|
14
14
|
import "./chunk-VEQXQN22.js";
|
|
15
15
|
export {
|
|
16
16
|
getCodexAspHost,
|
|
@@ -2637,6 +2637,57 @@ function buildCodeHostPrUrl(repoUrl, provider, prNumber) {
|
|
|
2637
2637
|
return `${normalizedRepoUrl}/pull/${prNumber}`;
|
|
2638
2638
|
}
|
|
2639
2639
|
|
|
2640
|
+
// ../shared/src/replicas-mcp.ts
|
|
2641
|
+
import { z as z10 } from "zod";
|
|
2642
|
+
|
|
2643
|
+
// ../shared/src/automations/trigger-schemas.ts
|
|
2644
|
+
import { z as z9 } from "zod";
|
|
2645
|
+
|
|
2646
|
+
// ../shared/src/uuid.ts
|
|
2647
|
+
function createUuidFromHex(value) {
|
|
2648
|
+
return `${value.slice(0, 8)}-${value.slice(8, 12)}-5${value.slice(13, 16)}-${(Number.parseInt(value.slice(16, 17), 16) & 3 | 8).toString(16)}${value.slice(17, 20)}-${value.slice(20, 32)}`;
|
|
2649
|
+
}
|
|
2650
|
+
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
2651
|
+
|
|
2652
|
+
// ../shared/src/automations/trigger-schemas.ts
|
|
2653
|
+
var repositoryTriggerConfigSchema = z9.object({
|
|
2654
|
+
event: z9.string(),
|
|
2655
|
+
repository_ids: z9.array(z9.string().regex(UUID_RE, "must be a repository id")).optional(),
|
|
2656
|
+
group_pr_events: z9.boolean().optional(),
|
|
2657
|
+
excluded_actors: z9.array(z9.string()).optional()
|
|
2658
|
+
});
|
|
2659
|
+
var cronTriggerSchema = z9.object({ type: z9.literal("cron"), config: z9.object({ schedule: z9.string(), timezone: z9.string().optional() }) });
|
|
2660
|
+
var githubTriggerSchema = z9.object({ type: z9.literal("github"), config: repositoryTriggerConfigSchema });
|
|
2661
|
+
var gitlabTriggerSchema = z9.object({ type: z9.literal("gitlab"), config: repositoryTriggerConfigSchema });
|
|
2662
|
+
var automationTriggerSchema = z9.discriminatedUnion("type", [
|
|
2663
|
+
cronTriggerSchema,
|
|
2664
|
+
githubTriggerSchema,
|
|
2665
|
+
gitlabTriggerSchema,
|
|
2666
|
+
z9.object({ type: z9.literal("slack"), config: z9.object({ event: z9.string(), channel_ids: z9.array(z9.string()).optional(), group_thread_replies: z9.boolean().optional() }) }),
|
|
2667
|
+
z9.object({ type: z9.literal("sentry"), config: z9.object({ event: z9.string(), project_slugs: z9.array(z9.string()).optional(), min_level: z9.string().optional() }) }),
|
|
2668
|
+
z9.object({ type: z9.literal("custom"), config: z9.object({}) })
|
|
2669
|
+
]);
|
|
2670
|
+
|
|
2671
|
+
// ../shared/src/replicas-mcp.ts
|
|
2672
|
+
var REPLICAS_MCP_SERVER_NAME = "replicas-mcp";
|
|
2673
|
+
var REPLICAS_MCP_TOOLS = {
|
|
2674
|
+
listEnvironments: "list_environments",
|
|
2675
|
+
createAutomation: "create_automation",
|
|
2676
|
+
spawn: "spawn_workspace",
|
|
2677
|
+
relay: "relay_to_workspace",
|
|
2678
|
+
linearStart: "start_linear_session",
|
|
2679
|
+
linearSessionIntent: "register_linear_session_intent"
|
|
2680
|
+
};
|
|
2681
|
+
var automationToolInputSchema = z10.object({
|
|
2682
|
+
name: z10.string().describe("Short automation name."),
|
|
2683
|
+
prompt: z10.string().describe("Prompt each automation run starts with."),
|
|
2684
|
+
environment_id: z10.string().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.`),
|
|
2685
|
+
triggers: z10.array(automationTriggerSchema).min(1).describe(
|
|
2686
|
+
'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>"] } }`.'
|
|
2687
|
+
),
|
|
2688
|
+
description: z10.string().optional().describe("One-line summary shown in the dashboard.")
|
|
2689
|
+
});
|
|
2690
|
+
|
|
2640
2691
|
// ../shared/src/default-skills/replicas-agent/abilities/computer.ts
|
|
2641
2692
|
var SECTION = `### Computer use (Linux desktop control)
|
|
2642
2693
|
Drive the workspace's Linux desktop - open a browser, click, type, scroll, screenshot, record - via the \`replicas computer\` CLI. Every Replicas workspace boots with a live H.264 and Opus stream published as an authenticated preview, so a \`Desktop\` tab is always available in the dashboard. Use \`replicas computer info\` to get the viewer URL when you want to share it (e.g. point a user on Slack at the live stream).
|
|
@@ -2907,15 +2958,7 @@ var DOCKER_ABILITY = {
|
|
|
2907
2958
|
};
|
|
2908
2959
|
|
|
2909
2960
|
// ../shared/src/routes/environment-setups.ts
|
|
2910
|
-
import { z as
|
|
2911
|
-
|
|
2912
|
-
// ../shared/src/uuid.ts
|
|
2913
|
-
function createUuidFromHex(value) {
|
|
2914
|
-
return `${value.slice(0, 8)}-${value.slice(8, 12)}-5${value.slice(13, 16)}-${(Number.parseInt(value.slice(16, 17), 16) & 3 | 8).toString(16)}${value.slice(17, 20)}-${value.slice(20, 32)}`;
|
|
2915
|
-
}
|
|
2916
|
-
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
2917
|
-
|
|
2918
|
-
// ../shared/src/routes/environment-setups.ts
|
|
2961
|
+
import { z as z11 } from "zod";
|
|
2919
2962
|
var ENVIRONMENT_SETUP_STEPS = [
|
|
2920
2963
|
{ key: "understand", label: "Understand the codebase" },
|
|
2921
2964
|
{ key: "install", label: "Install dependencies and run the app" },
|
|
@@ -2949,27 +2992,17 @@ var ENVIRONMENT_SETUP_LIMITS = {
|
|
|
2949
2992
|
};
|
|
2950
2993
|
var ENVIRONMENT_SETUP_VARIABLE_WAIT = { defaultMs: 5 * 6e4, maxMs: 15 * 6e4, pollMs: 5e3 };
|
|
2951
2994
|
var VARIABLE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
2952
|
-
var text = (max) => max === void 0 ?
|
|
2995
|
+
var text = (max) => max === void 0 ? z11.string().trim() : z11.string().trim().max(max);
|
|
2953
2996
|
var requiredText = (max) => text(max).min(1, "must not be empty");
|
|
2954
2997
|
var optionalText = (max) => text(max).nullish().transform((value) => value || null);
|
|
2955
2998
|
var clearableText = (max) => text(max).nullish().transform((value) => value === void 0 ? void 0 : value || null);
|
|
2956
|
-
var list = (item, max) => max === void 0 ?
|
|
2999
|
+
var list = (item, max) => max === void 0 ? z11.array(item) : z11.array(item).max(max);
|
|
2957
3000
|
var ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES = ["cron", "github", "gitlab"];
|
|
2958
3001
|
function isEnvironmentSetupAuthoredTriggerType(type) {
|
|
2959
3002
|
return ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES.some((authored) => authored === type);
|
|
2960
3003
|
}
|
|
2961
|
-
var
|
|
2962
|
-
|
|
2963
|
-
repository_ids: z9.array(z9.string().regex(UUID_RE, "must be a repository id")).optional(),
|
|
2964
|
-
group_pr_events: z9.boolean().optional(),
|
|
2965
|
-
excluded_actors: z9.array(z9.string()).optional()
|
|
2966
|
-
});
|
|
2967
|
-
var proposalTriggerSchema = z9.discriminatedUnion("type", [
|
|
2968
|
-
z9.object({ type: z9.literal("cron"), config: z9.object({ schedule: z9.string(), timezone: z9.string().optional() }) }),
|
|
2969
|
-
z9.object({ type: z9.literal("github"), config: repositoryTriggerConfigSchema }),
|
|
2970
|
-
z9.object({ type: z9.literal("gitlab"), config: repositoryTriggerConfigSchema })
|
|
2971
|
-
]);
|
|
2972
|
-
var existingTriggerSchema = z9.custom(
|
|
3004
|
+
var proposalTriggerSchema = z11.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
|
|
3005
|
+
var existingTriggerSchema = z11.custom(
|
|
2973
3006
|
(value) => isRecord(value) && typeof value.type === "string" && isRecord(value.config),
|
|
2974
3007
|
"must be an automation trigger"
|
|
2975
3008
|
);
|
|
@@ -2977,17 +3010,17 @@ var carriedTriggerSchema = existingTriggerSchema.refine(
|
|
|
2977
3010
|
(trigger) => !isEnvironmentSetupAuthoredTriggerType(trigger.type)
|
|
2978
3011
|
);
|
|
2979
3012
|
function automationSchema(limits) {
|
|
2980
|
-
const authored =
|
|
3013
|
+
const authored = z11.object({
|
|
2981
3014
|
name: text(limits.nameChars),
|
|
2982
3015
|
description: text(limits.descriptionChars),
|
|
2983
3016
|
prompt: text(limits.automationPromptChars),
|
|
2984
3017
|
triggers: list(proposalTriggerSchema, limits.automationTriggers)
|
|
2985
3018
|
});
|
|
2986
|
-
const updated = authored.extend({ triggers: list(
|
|
2987
|
-
return
|
|
3019
|
+
const updated = authored.extend({ triggers: list(z11.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
|
|
3020
|
+
return z11.object({
|
|
2988
3021
|
key: requiredText(limits.automationKeyChars),
|
|
2989
|
-
action:
|
|
2990
|
-
automation_id:
|
|
3022
|
+
action: z11.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
|
|
3023
|
+
automation_id: z11.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
|
|
2991
3024
|
name: text().default(""),
|
|
2992
3025
|
description: optionalText().transform((value) => value ?? ""),
|
|
2993
3026
|
prompt: text().default(""),
|
|
@@ -3010,7 +3043,7 @@ function automationSchema(limits) {
|
|
|
3010
3043
|
const content = (automation.action === "update" ? updated : authored).safeParse(automation);
|
|
3011
3044
|
if (content.success) return { ...automation, ...content.data };
|
|
3012
3045
|
for (const issue of content.error.issues) ctx.addIssue({ ...issue, code: "custom" });
|
|
3013
|
-
return
|
|
3046
|
+
return z11.NEVER;
|
|
3014
3047
|
});
|
|
3015
3048
|
}
|
|
3016
3049
|
function automationListSchema(limits) {
|
|
@@ -3028,7 +3061,7 @@ function automationListSchema(limits) {
|
|
|
3028
3061
|
});
|
|
3029
3062
|
}
|
|
3030
3063
|
function environmentSchema(limits) {
|
|
3031
|
-
return
|
|
3064
|
+
return z11.object({
|
|
3032
3065
|
name: optionalText(limits.nameChars).transform((value) => value ?? void 0),
|
|
3033
3066
|
description: clearableText(limits.descriptionChars),
|
|
3034
3067
|
system_prompt: clearableText(limits.systemPromptChars),
|
|
@@ -3037,26 +3070,26 @@ function environmentSchema(limits) {
|
|
|
3037
3070
|
});
|
|
3038
3071
|
}
|
|
3039
3072
|
function variableSchema(limits, requiredDefault) {
|
|
3040
|
-
return
|
|
3041
|
-
key:
|
|
3073
|
+
return z11.object({
|
|
3074
|
+
key: z11.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
|
|
3042
3075
|
description: optionalText(limits.variableDescriptionChars).transform((value) => value ?? ""),
|
|
3043
|
-
required:
|
|
3076
|
+
required: z11.boolean().default(requiredDefault)
|
|
3044
3077
|
});
|
|
3045
3078
|
}
|
|
3046
3079
|
function proposalSchema(limits) {
|
|
3047
|
-
return
|
|
3080
|
+
return z11.object({
|
|
3048
3081
|
summary: requiredText(limits.summaryChars),
|
|
3049
3082
|
stack: list(text(), limits.stackItems).default([]).transform((items) => items.filter(Boolean)),
|
|
3050
3083
|
environment: environmentSchema(limits),
|
|
3051
3084
|
variables: list(variableSchema(limits, false), limits.variables).default([]),
|
|
3052
3085
|
automations: automationListSchema(limits),
|
|
3053
|
-
verification: list(
|
|
3086
|
+
verification: list(z11.object({
|
|
3054
3087
|
label: requiredText(limits.nameChars),
|
|
3055
|
-
status:
|
|
3088
|
+
status: z11.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
|
|
3056
3089
|
detail: optionalText(limits.verificationDetailChars).transform((value) => value ?? void 0)
|
|
3057
3090
|
}), limits.verificationItems).default([]),
|
|
3058
|
-
media: list(
|
|
3059
|
-
media_id:
|
|
3091
|
+
media: list(z11.object({
|
|
3092
|
+
media_id: z11.string().regex(UUID_RE, "must be a media id"),
|
|
3060
3093
|
title: requiredText(limits.nameChars)
|
|
3061
3094
|
}), limits.mediaItems).default([])
|
|
3062
3095
|
});
|
|
@@ -3064,35 +3097,35 @@ function proposalSchema(limits) {
|
|
|
3064
3097
|
var environmentSetupProposalSchema = proposalSchema({});
|
|
3065
3098
|
var environmentSetupProposalSubmissionSchema = proposalSchema(ENVIRONMENT_SETUP_LIMITS);
|
|
3066
3099
|
var environmentSetupVariableRequestSchema = variableSchema({}, false).extend({
|
|
3067
|
-
status:
|
|
3068
|
-
requested_at:
|
|
3069
|
-
resolved_at:
|
|
3100
|
+
status: z11.enum(["pending", "provided", "skipped"]),
|
|
3101
|
+
requested_at: z11.string(),
|
|
3102
|
+
resolved_at: z11.string().nullable().default(null)
|
|
3070
3103
|
});
|
|
3071
|
-
var environmentSetupRunStateSchema =
|
|
3072
|
-
status:
|
|
3073
|
-
steps:
|
|
3104
|
+
var environmentSetupRunStateSchema = z11.object({
|
|
3105
|
+
status: z11.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
|
|
3106
|
+
steps: z11.partialRecord(z11.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), z11.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
|
|
3074
3107
|
proposal: environmentSetupProposalSchema.nullable().default(null),
|
|
3075
|
-
applied:
|
|
3076
|
-
applied_at:
|
|
3077
|
-
automation_ids:
|
|
3108
|
+
applied: z11.object({
|
|
3109
|
+
applied_at: z11.string(),
|
|
3110
|
+
automation_ids: z11.array(z11.string())
|
|
3078
3111
|
}).nullable().default(null),
|
|
3079
|
-
variable_requests:
|
|
3112
|
+
variable_requests: z11.array(environmentSetupVariableRequestSchema).default([])
|
|
3080
3113
|
});
|
|
3081
|
-
var applyEnvironmentSetupRequestSchema =
|
|
3114
|
+
var applyEnvironmentSetupRequestSchema = z11.object({
|
|
3082
3115
|
environment: environmentSchema(ENVIRONMENT_SETUP_LIMITS).extend({ name: requiredText(ENVIRONMENT_SETUP_LIMITS.nameChars) }),
|
|
3083
|
-
variables: list(
|
|
3116
|
+
variables: list(z11.object({ key: z11.string().regex(VARIABLE_KEY_RE), value: z11.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)),
|
|
3084
3117
|
automations: automationListSchema(ENVIRONMENT_SETUP_LIMITS)
|
|
3085
3118
|
});
|
|
3086
|
-
var requestEnvironmentSetupVariablesSchema =
|
|
3119
|
+
var requestEnvironmentSetupVariablesSchema = z11.object({
|
|
3087
3120
|
variables: list(variableSchema(ENVIRONMENT_SETUP_LIMITS, true), ENVIRONMENT_SETUP_LIMITS.variables).min(1, "must not be empty")
|
|
3088
3121
|
}).superRefine(({ variables }, ctx) => {
|
|
3089
3122
|
if (new Set(variables.map((variable) => variable.key)).size !== variables.length) {
|
|
3090
3123
|
ctx.addIssue({ code: "custom", path: ["variables"], message: "must have unique keys" });
|
|
3091
3124
|
}
|
|
3092
3125
|
});
|
|
3093
|
-
var respondEnvironmentSetupVariablesSchema =
|
|
3094
|
-
values:
|
|
3095
|
-
skipped:
|
|
3126
|
+
var respondEnvironmentSetupVariablesSchema = z11.object({
|
|
3127
|
+
values: z11.record(z11.string().regex(VARIABLE_KEY_RE), z11.string()).default({}),
|
|
3128
|
+
skipped: z11.array(z11.string().regex(VARIABLE_KEY_RE)).default([])
|
|
3096
3129
|
});
|
|
3097
3130
|
|
|
3098
3131
|
// ../shared/src/default-skills/replicas-agent/abilities/environment-setup.ts
|
|
@@ -4563,7 +4596,7 @@ var SENTRY_ABILITY = {
|
|
|
4563
4596
|
};
|
|
4564
4597
|
|
|
4565
4598
|
// ../shared/src/memory.ts
|
|
4566
|
-
import { z as
|
|
4599
|
+
import { z as z12 } from "zod";
|
|
4567
4600
|
|
|
4568
4601
|
// ../shared/src/sandbox.ts
|
|
4569
4602
|
var SANDBOX_LIFECYCLE = {
|
|
@@ -4585,11 +4618,11 @@ var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZ
|
|
|
4585
4618
|
// ../shared/src/memory.ts
|
|
4586
4619
|
var HISTORY_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/history`;
|
|
4587
4620
|
var HISTORY_INDEX_FILENAME = "INDEX.md";
|
|
4588
|
-
var memoryExtractionResultSchema =
|
|
4589
|
-
summary:
|
|
4590
|
-
indexEntry:
|
|
4621
|
+
var memoryExtractionResultSchema = z12.object({
|
|
4622
|
+
summary: z12.string().nullable(),
|
|
4623
|
+
indexEntry: z12.string().nullable()
|
|
4591
4624
|
});
|
|
4592
|
-
var { $schema: _, ...MEMORY_EXTRACTION_SCHEMA } =
|
|
4625
|
+
var { $schema: _, ...MEMORY_EXTRACTION_SCHEMA } = z12.toJSONSchema(memoryExtractionResultSchema);
|
|
4593
4626
|
|
|
4594
4627
|
// ../shared/src/default-skills/replicas-agent/abilities/session-history.ts
|
|
4595
4628
|
var SECTION12 = `### Session history
|
|
@@ -4813,6 +4846,13 @@ function removeTag(text2, tag) {
|
|
|
4813
4846
|
function removeReplicasInstructions(text2) {
|
|
4814
4847
|
return removeTag(text2, REPLICAS_INSTRUCTIONS_TAG);
|
|
4815
4848
|
}
|
|
4849
|
+
var mothershipMcpActions = `These are tools of the \`${REPLICAS_MCP_SERVER_NAME}\` MCP server; their argument names match the envelope fields. Call them directly as tools, never through a shell or the Replicas CLI.
|
|
4850
|
+
- **Spawn** a dedicated workspace for the thread and hand off: \`${REPLICAS_MCP_TOOLS.spawn}\`, with \`environment_id\` when you chose one.
|
|
4851
|
+
- **Relay** a follow-up that is clearly meant for you into the workspace already bound to the thread (pass the envelope's \`user_id\` so it's attributed to its author): \`${REPLICAS_MCP_TOOLS.relay}\`, with \`queue: true\` to queue it.
|
|
4852
|
+
- **List environments**: \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.
|
|
4853
|
+
- **Create an automation**: \`${REPLICAS_MCP_TOOLS.createAutomation}\`, filling its \`confirmation_*\` arguments from the accepting message's envelope.
|
|
4854
|
+
- **Register a Linear session intent**: \`${REPLICAS_MCP_TOOLS.linearSessionIntent}\` with \`comment_id\` and \`action\`.
|
|
4855
|
+
- **Start a Linear session**: \`${REPLICAS_MCP_TOOLS.linearStart}\` with \`issue_id\`, \`agent_session_id\`, and \`prompt\`.`;
|
|
4816
4856
|
|
|
4817
4857
|
// ../shared/src/user-message-attachments.ts
|
|
4818
4858
|
var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
|
|
@@ -7786,7 +7826,7 @@ var CLAUDE_AUTH_ENV_KEYS_BY_METHOD = {
|
|
|
7786
7826
|
};
|
|
7787
7827
|
|
|
7788
7828
|
// ../shared/src/routes/command-protection.ts
|
|
7789
|
-
import { z as
|
|
7829
|
+
import { z as z13 } from "zod";
|
|
7790
7830
|
|
|
7791
7831
|
// ../shared/src/git-invocations.ts
|
|
7792
7832
|
var COMMIT_VALUE_OPTIONS = /* @__PURE__ */ new Set(["message", "file", "trailer", "reuse-message", "reedit-message", "fixup", "squash", "template", "author", "date", "cleanup", "pathspec-from-file"]);
|
|
@@ -7877,27 +7917,27 @@ function findCheckoutTarget(args) {
|
|
|
7877
7917
|
}
|
|
7878
7918
|
|
|
7879
7919
|
// ../shared/src/routes/command-protection.ts
|
|
7880
|
-
var commandProtectionRepoStateSchema =
|
|
7881
|
-
branch:
|
|
7882
|
-
defaultBranch:
|
|
7883
|
-
pushBranch:
|
|
7884
|
-
pushConfig:
|
|
7885
|
-
headMessage:
|
|
7886
|
-
mergeInProgress:
|
|
7920
|
+
var commandProtectionRepoStateSchema = z13.object({
|
|
7921
|
+
branch: z13.string().nullable(),
|
|
7922
|
+
defaultBranch: z13.string().nullable(),
|
|
7923
|
+
pushBranch: z13.string().nullable(),
|
|
7924
|
+
pushConfig: z13.string().nullable(),
|
|
7925
|
+
headMessage: z13.string().nullable(),
|
|
7926
|
+
mergeInProgress: z13.boolean().optional()
|
|
7887
7927
|
});
|
|
7888
|
-
var commandProtectionEvaluateRequestSchema =
|
|
7889
|
-
provider:
|
|
7890
|
-
source:
|
|
7891
|
-
toolName:
|
|
7892
|
-
toolInput:
|
|
7893
|
-
command:
|
|
7894
|
-
cwd:
|
|
7895
|
-
toolUseId:
|
|
7928
|
+
var commandProtectionEvaluateRequestSchema = z13.object({
|
|
7929
|
+
provider: z13.enum(["claude", "codex", "cursor", "opencode", "pi"]),
|
|
7930
|
+
source: z13.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call"]),
|
|
7931
|
+
toolName: z13.string(),
|
|
7932
|
+
toolInput: z13.unknown(),
|
|
7933
|
+
command: z13.string().nullish(),
|
|
7934
|
+
cwd: z13.string().nullish(),
|
|
7935
|
+
toolUseId: z13.string().nullish(),
|
|
7896
7936
|
// Read by the engine before the command runs, keyed by absolute path, so the
|
|
7897
7937
|
// policy can see branches and commit messages the command text only references.
|
|
7898
|
-
gitContext:
|
|
7899
|
-
repos:
|
|
7900
|
-
messageFiles:
|
|
7938
|
+
gitContext: z13.object({
|
|
7939
|
+
repos: z13.record(z13.string(), commandProtectionRepoStateSchema),
|
|
7940
|
+
messageFiles: z13.record(z13.string(), z13.string())
|
|
7901
7941
|
}).optional()
|
|
7902
7942
|
});
|
|
7903
7943
|
var COMMAND_PROTECTION_COMMAND_KEYS = ["command", "cmd", "script", "query", "endpoint", "path", "url", "mutation"];
|
|
@@ -8094,41 +8134,77 @@ function shouldRefreshPullRequests(toolName, toolInput) {
|
|
|
8094
8134
|
}
|
|
8095
8135
|
|
|
8096
8136
|
// ../shared/src/routes/linear.ts
|
|
8097
|
-
import { z as
|
|
8098
|
-
var linearSessionMetadataSchema =
|
|
8099
|
-
via_mothership:
|
|
8100
|
-
issue_id:
|
|
8101
|
-
issue_identifier:
|
|
8102
|
-
issue_title:
|
|
8103
|
-
issue_description:
|
|
8104
|
-
issue_url:
|
|
8105
|
-
comment_id:
|
|
8106
|
-
comment_body:
|
|
8107
|
-
triggered_by_id:
|
|
8108
|
-
triggered_by_name:
|
|
8109
|
-
triggered_by_email:
|
|
8110
|
-
linear_workspace_id:
|
|
8111
|
-
creator_id:
|
|
8112
|
-
creator_name:
|
|
8113
|
-
creator_email:
|
|
8114
|
-
assignee_id:
|
|
8115
|
-
assignee_name:
|
|
8116
|
-
assignee_email:
|
|
8117
|
-
issue_state:
|
|
8118
|
-
parent_issue:
|
|
8119
|
-
id:
|
|
8120
|
-
identifier:
|
|
8121
|
-
title:
|
|
8122
|
-
description:
|
|
8137
|
+
import { z as z14 } from "zod";
|
|
8138
|
+
var linearSessionMetadataSchema = z14.object({
|
|
8139
|
+
via_mothership: z14.boolean().optional(),
|
|
8140
|
+
issue_id: z14.string(),
|
|
8141
|
+
issue_identifier: z14.string(),
|
|
8142
|
+
issue_title: z14.string(),
|
|
8143
|
+
issue_description: z14.string(),
|
|
8144
|
+
issue_url: z14.string(),
|
|
8145
|
+
comment_id: z14.string(),
|
|
8146
|
+
comment_body: z14.string(),
|
|
8147
|
+
triggered_by_id: z14.string().optional(),
|
|
8148
|
+
triggered_by_name: z14.string().optional(),
|
|
8149
|
+
triggered_by_email: z14.string().optional(),
|
|
8150
|
+
linear_workspace_id: z14.string().optional(),
|
|
8151
|
+
creator_id: z14.string().optional(),
|
|
8152
|
+
creator_name: z14.string().optional(),
|
|
8153
|
+
creator_email: z14.string().optional(),
|
|
8154
|
+
assignee_id: z14.string().optional(),
|
|
8155
|
+
assignee_name: z14.string().optional(),
|
|
8156
|
+
assignee_email: z14.string().optional(),
|
|
8157
|
+
issue_state: z14.string().optional(),
|
|
8158
|
+
parent_issue: z14.object({
|
|
8159
|
+
id: z14.string(),
|
|
8160
|
+
identifier: z14.string(),
|
|
8161
|
+
title: z14.string(),
|
|
8162
|
+
description: z14.string().nullable()
|
|
8123
8163
|
}).optional(),
|
|
8124
|
-
workspace:
|
|
8125
|
-
id:
|
|
8126
|
-
coding_agent:
|
|
8127
|
-
task_description:
|
|
8128
|
-
created_at:
|
|
8164
|
+
workspace: z14.object({
|
|
8165
|
+
id: z14.string(),
|
|
8166
|
+
coding_agent: z14.custom((value) => typeof value === "string" && isValidAgentProvider(value)),
|
|
8167
|
+
task_description: z14.string(),
|
|
8168
|
+
created_at: z14.string()
|
|
8129
8169
|
}).optional()
|
|
8130
8170
|
});
|
|
8131
8171
|
|
|
8172
|
+
// ../shared/src/routes/mothership.ts
|
|
8173
|
+
import { z as z15 } from "zod";
|
|
8174
|
+
var MOTHERSHIP_LINEAR_ACTIONS = ["ask", "start"];
|
|
8175
|
+
var mothershipLinearSessionIntentRequestSchema = z15.object({
|
|
8176
|
+
comment_id: z15.string().trim().min(1).describe("Id of the Linear comment the session will be created on."),
|
|
8177
|
+
action: z15.enum(MOTHERSHIP_LINEAR_ACTIONS).describe("`ask` when the comment is a clarifying question, `start` when it is the complete task prompt.")
|
|
8178
|
+
});
|
|
8179
|
+
var mothershipLinearStartRequestSchema = z15.object({
|
|
8180
|
+
issue_id: z15.string().describe("Linear issue id from the envelope's `issue_id`."),
|
|
8181
|
+
agent_session_id: z15.string().describe("Existing Linear agent session id from the envelope's `agent_session_id`."),
|
|
8182
|
+
prompt: z15.string().trim().min(1).describe("Complete task prompt for the coding workspace.")
|
|
8183
|
+
});
|
|
8184
|
+
var slackChannelIdSchema = z15.string().describe("Slack channel id from the envelope's `channel_id`.");
|
|
8185
|
+
var slackThreadTsSchema = z15.string().describe("Slack thread timestamp from the envelope's `thread_ts`.");
|
|
8186
|
+
var mothershipSlackSpawnRequestSchema = z15.object({
|
|
8187
|
+
channel_id: slackChannelIdSchema,
|
|
8188
|
+
thread_ts: slackThreadTsSchema,
|
|
8189
|
+
message_ts: z15.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."),
|
|
8190
|
+
user_id: z15.string().describe("Slack user id of that message's author (the envelope's `user_id`). The workspace is attributed to them."),
|
|
8191
|
+
prompt: z15.string().describe("Complete task for the new workspace, written so it stands on its own."),
|
|
8192
|
+
environment_id: z15.string().optional().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`. Pass it only when clearly confident it fits; omit it to let routing choose or ask the person.`)
|
|
8193
|
+
});
|
|
8194
|
+
var mothershipSlackRelayRequestSchema = z15.object({
|
|
8195
|
+
channel_id: slackChannelIdSchema,
|
|
8196
|
+
thread_ts: slackThreadTsSchema,
|
|
8197
|
+
message: z15.string().describe("The follow-up to deliver, combining every fresh message that belongs to this update."),
|
|
8198
|
+
user_id: z15.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."),
|
|
8199
|
+
queue: z15.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.")
|
|
8200
|
+
});
|
|
8201
|
+
var mothershipAutomationToolInputSchema = automationToolInputSchema.extend({
|
|
8202
|
+
confirmation_channel_id: z15.string().describe("`channel_id` from the envelope of the Slack message that accepted the offer."),
|
|
8203
|
+
confirmation_thread_ts: z15.string().describe("`thread_ts` from that message's envelope."),
|
|
8204
|
+
confirmation_message_ts: z15.string().describe("`message_ts` from that message's envelope."),
|
|
8205
|
+
confirmation_user_id: z15.string().describe("`user_id` from that message's envelope.")
|
|
8206
|
+
});
|
|
8207
|
+
|
|
8132
8208
|
// ../shared/src/routes/plugin-catalog.ts
|
|
8133
8209
|
var EXPLICIT_PLUGIN_CATALOG = [
|
|
8134
8210
|
{
|
|
@@ -8435,7 +8511,7 @@ var MAX_CLIENT_STATE_REQUEST_BYTES = 5 * 1024 * 1024;
|
|
|
8435
8511
|
var MAX_CLIENT_STATE_BYTES_PER_USER = 10 * 1024 * 1024;
|
|
8436
8512
|
|
|
8437
8513
|
// ../shared/src/routes/workspaces.ts
|
|
8438
|
-
import { z as
|
|
8514
|
+
import { z as z16 } from "zod";
|
|
8439
8515
|
var WORKSPACE_STATUSES = ["active", "sleeping", "archived", "preparing", "error"];
|
|
8440
8516
|
var WORKSPACE_STATUS_FILTERS = WORKSPACE_STATUSES.map((status) => status === "error" ? "failed" : status);
|
|
8441
8517
|
var WORKSPACE_SORT_CHOICES = [
|
|
@@ -8459,56 +8535,56 @@ var DEFAULT_WORKSPACE_FILTERS = {
|
|
|
8459
8535
|
activity: "any"
|
|
8460
8536
|
};
|
|
8461
8537
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
8462
|
-
var terminalRtcCandidateSchema =
|
|
8463
|
-
var terminalSocketServerMessageSchema =
|
|
8464
|
-
|
|
8465
|
-
|
|
8538
|
+
var terminalRtcCandidateSchema = z16.object({ type: z16.literal("rtc-candidate"), candidate: z16.string(), mid: z16.string() });
|
|
8539
|
+
var terminalSocketServerMessageSchema = z16.discriminatedUnion("type", [
|
|
8540
|
+
z16.object({ type: z16.literal("output"), data: z16.string() }),
|
|
8541
|
+
z16.object({ type: z16.literal("rtc-answer"), sdp: z16.string() }),
|
|
8466
8542
|
terminalRtcCandidateSchema,
|
|
8467
|
-
|
|
8543
|
+
z16.object({ type: z16.literal("rtc-switch") })
|
|
8468
8544
|
]);
|
|
8469
8545
|
var TERMINAL_RTC_ICE_SERVER = "stun:stun.l.google.com:19302";
|
|
8470
8546
|
|
|
8471
8547
|
// ../shared/src/routes/workspace-events.ts
|
|
8472
|
-
import { z as
|
|
8473
|
-
var workspaceChangedEventSchema =
|
|
8474
|
-
|
|
8475
|
-
type:
|
|
8476
|
-
workspaceId:
|
|
8477
|
-
completion:
|
|
8478
|
-
workspaceName:
|
|
8479
|
-
completedAt:
|
|
8480
|
-
processing:
|
|
8548
|
+
import { z as z17 } from "zod";
|
|
8549
|
+
var workspaceChangedEventSchema = z17.discriminatedUnion("type", [
|
|
8550
|
+
z17.object({
|
|
8551
|
+
type: z17.literal("workspace.changed"),
|
|
8552
|
+
workspaceId: z17.string(),
|
|
8553
|
+
completion: z17.object({
|
|
8554
|
+
workspaceName: z17.string(),
|
|
8555
|
+
completedAt: z17.string(),
|
|
8556
|
+
processing: z17.boolean().optional()
|
|
8481
8557
|
}).optional(),
|
|
8482
|
-
ts:
|
|
8558
|
+
ts: z17.string()
|
|
8483
8559
|
}),
|
|
8484
|
-
|
|
8485
|
-
type:
|
|
8486
|
-
workspaceId:
|
|
8487
|
-
chatId:
|
|
8488
|
-
ts:
|
|
8560
|
+
z17.object({
|
|
8561
|
+
type: z17.literal("workspace.chat.changed"),
|
|
8562
|
+
workspaceId: z17.string(),
|
|
8563
|
+
chatId: z17.string(),
|
|
8564
|
+
ts: z17.string()
|
|
8489
8565
|
}),
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
type:
|
|
8493
|
-
workspaceId:
|
|
8494
|
-
ts:
|
|
8566
|
+
z17.object({ type: z17.literal("presence.changed"), ts: z17.string() }),
|
|
8567
|
+
z17.object({
|
|
8568
|
+
type: z17.literal("mobile-testing.changed"),
|
|
8569
|
+
workspaceId: z17.string(),
|
|
8570
|
+
ts: z17.string()
|
|
8495
8571
|
})
|
|
8496
8572
|
]);
|
|
8497
8573
|
|
|
8498
8574
|
// ../shared/src/routes/presence.ts
|
|
8499
|
-
import { z as
|
|
8500
|
-
var presenceStatusSchema =
|
|
8501
|
-
var presenceLocationSchema =
|
|
8502
|
-
environmentId:
|
|
8503
|
-
workspaceId:
|
|
8575
|
+
import { z as z18 } from "zod";
|
|
8576
|
+
var presenceStatusSchema = z18.enum(["online", "typing"]);
|
|
8577
|
+
var presenceLocationSchema = z18.object({
|
|
8578
|
+
environmentId: z18.string().optional(),
|
|
8579
|
+
workspaceId: z18.string().optional()
|
|
8504
8580
|
});
|
|
8505
|
-
var presenceEntrySchema =
|
|
8506
|
-
userId:
|
|
8581
|
+
var presenceEntrySchema = z18.object({
|
|
8582
|
+
userId: z18.string(),
|
|
8507
8583
|
status: presenceStatusSchema,
|
|
8508
8584
|
location: presenceLocationSchema,
|
|
8509
|
-
ts:
|
|
8585
|
+
ts: z18.string()
|
|
8510
8586
|
});
|
|
8511
|
-
var updatePresenceRequestSchema =
|
|
8587
|
+
var updatePresenceRequestSchema = z18.object({
|
|
8512
8588
|
status: presenceStatusSchema,
|
|
8513
8589
|
location: presenceLocationSchema.optional()
|
|
8514
8590
|
});
|
|
@@ -8935,6 +9011,7 @@ export {
|
|
|
8935
9011
|
REMOVED_MESSAGE_IDS_PAYLOAD_KEY,
|
|
8936
9012
|
USER_MESSAGE_ID_PAYLOAD_KEY,
|
|
8937
9013
|
CODEX_ASP_ITEM_ID_PAYLOAD_KEY,
|
|
9014
|
+
CODEX_ITEM_EVENT_TYPE,
|
|
8938
9015
|
CODEX_HISTORY_FORMAT_EVENT_TYPE,
|
|
8939
9016
|
getEventStreamId,
|
|
8940
9017
|
CODEX_QUOTA_STATUS_EVENT_TYPE,
|
|
@@ -8965,6 +9042,7 @@ export {
|
|
|
8965
9042
|
createAcceptedUserMessageEvent,
|
|
8966
9043
|
codexItemEvent,
|
|
8967
9044
|
codexTurnEvent,
|
|
9045
|
+
codexItemFromEvent,
|
|
8968
9046
|
codexTurnFromEvent,
|
|
8969
9047
|
codexTranscriptToEvents,
|
|
8970
9048
|
isLatestChatHistoryPage,
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
ENGINE_ENV,
|
|
6
6
|
monolithRequest,
|
|
7
7
|
setAgentCredentialSnapshot
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-HLLDPEDK.js";
|
|
9
9
|
import {
|
|
10
10
|
AppServerProcess,
|
|
11
11
|
buildCodexAgentEnv
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-FEOJV72E.js";
|
|
13
13
|
import {
|
|
14
14
|
SUBPROCESS_MAX_BUFFER,
|
|
15
15
|
execFileAsync
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-D4BDGH53.js";
|
|
17
17
|
import {
|
|
18
18
|
isRecord
|
|
19
19
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
listOpenAICompatibleModels,
|
|
28
28
|
readOllamaAuthEnv,
|
|
29
29
|
resolveOpenAICompatibleModelsUrl
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-32UPBL5I.js";
|
|
31
31
|
|
|
32
32
|
// src/managers/codex-token-manager.ts
|
|
33
33
|
import { promises as fs } from "fs";
|
|
@@ -260,7 +260,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
260
260
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
261
261
|
await this.applyCredentialsResponse(data);
|
|
262
262
|
setAgentCredentialSnapshot("codex", data);
|
|
263
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
263
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-QVTM4VFE.js");
|
|
264
264
|
await restartCodexAspHostIfRunning2();
|
|
265
265
|
});
|
|
266
266
|
await this.start(true);
|
|
@@ -280,7 +280,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
280
280
|
await this.applyCredentialUpdate(generation, async () => {
|
|
281
281
|
await this.applyCredentialsResponse(data);
|
|
282
282
|
if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
|
|
283
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
283
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-QVTM4VFE.js");
|
|
284
284
|
await restartCodexAspHostIfRunning2();
|
|
285
285
|
}
|
|
286
286
|
setAgentCredentialSnapshot("codex", data);
|
|
@@ -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-32UPBL5I.js";
|
|
7
7
|
|
|
8
8
|
// src/utils/exec.ts
|
|
9
9
|
import { exec, execFile } from "child_process";
|
|
@@ -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-HLLDPEDK.js";
|
|
7
7
|
import {
|
|
8
8
|
SUBPROCESS_MAX_BUFFER,
|
|
9
9
|
execFileAsync
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-D4BDGH53.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-32UPBL5I.js";
|
|
18
18
|
|
|
19
19
|
// src/services/command-protection-service.ts
|
|
20
20
|
import { readFile, stat } from "fs/promises";
|
|
@@ -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-D4BDGH53.js";
|
|
7
7
|
import {
|
|
8
8
|
isVersionBelow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-32UPBL5I.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.974";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -20,6 +20,7 @@ var ACCOUNT_RATE_LIMITS_UPDATED_METHOD = "account/rateLimits/updated";
|
|
|
20
20
|
var THREAD_TOKEN_USAGE_UPDATED_METHOD = "thread/tokenUsage/updated";
|
|
21
21
|
var THREAD_COMPACTED_METHOD = "thread/compacted";
|
|
22
22
|
var MODEL_REROUTED_METHOD = "model/rerouted";
|
|
23
|
+
var THREAD_STATUS_CHANGED_METHOD = "thread/status/changed";
|
|
23
24
|
function dispatchAspNotification(notification, handlers) {
|
|
24
25
|
const handler = handlers[notification.method];
|
|
25
26
|
if (!handler) return;
|
|
@@ -58,6 +59,7 @@ export {
|
|
|
58
59
|
THREAD_TOKEN_USAGE_UPDATED_METHOD,
|
|
59
60
|
THREAD_COMPACTED_METHOD,
|
|
60
61
|
MODEL_REROUTED_METHOD,
|
|
62
|
+
THREAD_STATUS_CHANGED_METHOD,
|
|
61
63
|
dispatchAspNotification,
|
|
62
64
|
recoverCompletedTurn
|
|
63
65
|
};
|
|
@@ -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-ETEMP3CF.js";
|
|
7
|
+
import "./chunk-HLLDPEDK.js";
|
|
8
|
+
import "./chunk-D4BDGH53.js";
|
|
9
9
|
import {
|
|
10
10
|
isRecord
|
|
11
11
|
} from "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-32UPBL5I.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/command-protection-hook.ts
|
|
@@ -3,16 +3,16 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
recoverCompletedTurn
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-P73LGPQO.js";
|
|
7
7
|
import {
|
|
8
8
|
AppServerProcess,
|
|
9
9
|
buildCodexAgentEnv
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-FEOJV72E.js";
|
|
11
|
+
import "./chunk-D4BDGH53.js";
|
|
12
12
|
import {
|
|
13
13
|
AGENT,
|
|
14
14
|
headlessAgentRequestSchema
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-32UPBL5I.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-ETEMP3CF.js";
|
|
36
36
|
import {
|
|
37
37
|
ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
|
|
38
38
|
AGENT_MESSAGE_DELTA_METHOD,
|
|
@@ -47,16 +47,17 @@ import {
|
|
|
47
47
|
THREAD_COMPACTED_METHOD,
|
|
48
48
|
THREAD_GOAL_CLEARED_METHOD,
|
|
49
49
|
THREAD_GOAL_UPDATED_METHOD,
|
|
50
|
+
THREAD_STATUS_CHANGED_METHOD,
|
|
50
51
|
THREAD_TOKEN_USAGE_UPDATED_METHOD,
|
|
51
52
|
TURN_COMPLETED_METHOD,
|
|
52
53
|
TURN_PLAN_UPDATED_METHOD,
|
|
53
54
|
TURN_STARTED_METHOD,
|
|
54
55
|
dispatchAspNotification,
|
|
55
56
|
recoverCompletedTurn
|
|
56
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-P73LGPQO.js";
|
|
57
58
|
import {
|
|
58
59
|
publishedPullRequestUrls
|
|
59
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-AWKW6SD6.js";
|
|
60
61
|
import {
|
|
61
62
|
BaseRefreshManager,
|
|
62
63
|
CodexAspAuthMethodChangedError,
|
|
@@ -71,7 +72,7 @@ import {
|
|
|
71
72
|
refreshDelayMs,
|
|
72
73
|
restartCodexAspHost,
|
|
73
74
|
routineRefreshExclusions
|
|
74
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-BXCLRUIK.js";
|
|
75
76
|
import {
|
|
76
77
|
ENGINE_ENV,
|
|
77
78
|
monolithRequest,
|
|
@@ -79,16 +80,16 @@ import {
|
|
|
79
80
|
readRuntimeEnvFile,
|
|
80
81
|
reloadEngineEnv,
|
|
81
82
|
setAgentCredentialSnapshot
|
|
82
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-HLLDPEDK.js";
|
|
83
84
|
import {
|
|
84
85
|
AspClient,
|
|
85
86
|
getCodexModelProvider
|
|
86
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-FEOJV72E.js";
|
|
87
88
|
import {
|
|
88
89
|
SUBPROCESS_MAX_BUFFER,
|
|
89
90
|
execAsync,
|
|
90
91
|
execFileAsync
|
|
91
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-D4BDGH53.js";
|
|
92
93
|
import {
|
|
93
94
|
isRecord as isRecord2
|
|
94
95
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -116,6 +117,7 @@ import {
|
|
|
116
117
|
CLAUDE_SONNET_5_BEDROCK_MODEL,
|
|
117
118
|
CODEX_ASP_ITEM_ID_PAYLOAD_KEY,
|
|
118
119
|
CODEX_HISTORY_FORMAT_EVENT_TYPE,
|
|
120
|
+
CODEX_ITEM_EVENT_TYPE,
|
|
119
121
|
CODEX_QUOTA_STATUS_EVENT_TYPE,
|
|
120
122
|
COMPACTION_STATUS_EVENT_TYPE,
|
|
121
123
|
CONTEXT_USAGE_EVENT_TYPE,
|
|
@@ -192,6 +194,7 @@ import {
|
|
|
192
194
|
claudeAuthEnvFromResponse,
|
|
193
195
|
codexHistoryFormatEvent,
|
|
194
196
|
codexItemEvent,
|
|
197
|
+
codexItemFromEvent,
|
|
195
198
|
codexReasoningEffortForThinkingLevel,
|
|
196
199
|
codexTranscriptToEvents,
|
|
197
200
|
codexTurnEvent,
|
|
@@ -307,7 +310,7 @@ import {
|
|
|
307
310
|
workspaceCredentialProviderSchema,
|
|
308
311
|
workspaceTokenRequestSchema,
|
|
309
312
|
workspaceTokenResponseSchema
|
|
310
|
-
} from "./chunk-
|
|
313
|
+
} from "./chunk-32UPBL5I.js";
|
|
311
314
|
import {
|
|
312
315
|
cloneMcpConfig,
|
|
313
316
|
ensureCompatibilityImports,
|
|
@@ -12941,6 +12944,20 @@ var CodexHistoryFile = class {
|
|
|
12941
12944
|
}
|
|
12942
12945
|
return found;
|
|
12943
12946
|
}
|
|
12947
|
+
async findSubagentItems() {
|
|
12948
|
+
const found = /* @__PURE__ */ new Map();
|
|
12949
|
+
try {
|
|
12950
|
+
for await (const line of createInterface({ input: createReadStream(this.filePath), crlfDelay: Infinity })) {
|
|
12951
|
+
if (!line.includes('"subagent"')) continue;
|
|
12952
|
+
const event = parseAgentEventJsonlLine(line);
|
|
12953
|
+
const payload = event?.type === CODEX_ITEM_EVENT_TYPE ? codexItemFromEvent(event) : null;
|
|
12954
|
+
if (payload?.item.type === "subagent") found.set(payload.item.id, { turnId: payload.turnId, item: payload.item });
|
|
12955
|
+
}
|
|
12956
|
+
} catch (error) {
|
|
12957
|
+
if (!isMissingFile(error)) throw error;
|
|
12958
|
+
}
|
|
12959
|
+
return found;
|
|
12960
|
+
}
|
|
12944
12961
|
async loadAll() {
|
|
12945
12962
|
const folder = new CodexHistoryEventFolder();
|
|
12946
12963
|
try {
|
|
@@ -15255,6 +15272,7 @@ var CodexAspManager = class extends CodingAgentManager {
|
|
|
15255
15272
|
attachedDeveloperInstructions = null;
|
|
15256
15273
|
historyFile;
|
|
15257
15274
|
liveTurn = null;
|
|
15275
|
+
codexSubagents = /* @__PURE__ */ new Map();
|
|
15258
15276
|
quotaStatus = new CodexQuotaStatusTracker();
|
|
15259
15277
|
currentGoal = null;
|
|
15260
15278
|
goalHistoryKnown = false;
|
|
@@ -15292,6 +15310,9 @@ var CodexAspManager = class extends CodingAgentManager {
|
|
|
15292
15310
|
this.currentGoal = coerceChatGoalPayload(goalEvent.payload);
|
|
15293
15311
|
this.goalHistoryKnown = true;
|
|
15294
15312
|
}
|
|
15313
|
+
for (const { turnId, item } of (await this.historyFile?.findSubagentItems())?.values() ?? []) {
|
|
15314
|
+
if (item.status === "in_progress") this.updateCodexSubagent({ turnId, item, active: /* @__PURE__ */ new Set(), failed: false });
|
|
15315
|
+
}
|
|
15295
15316
|
}
|
|
15296
15317
|
getHistorySink() {
|
|
15297
15318
|
return {
|
|
@@ -15634,6 +15655,9 @@ var CodexAspManager = class extends CodingAgentManager {
|
|
|
15634
15655
|
if (this.attachedClient !== host.client) {
|
|
15635
15656
|
this.skillRegistriesApplied = false;
|
|
15636
15657
|
this.modelServiceTierCache = null;
|
|
15658
|
+
this.closeCodexSubagents();
|
|
15659
|
+
host.client.off("notification", this.onSubagentThreadStatus);
|
|
15660
|
+
host.client.on("notification", this.onSubagentThreadStatus);
|
|
15637
15661
|
}
|
|
15638
15662
|
await this.applySkillRegistries(host);
|
|
15639
15663
|
const existingThreadId = this.currentThreadId;
|
|
@@ -16161,10 +16185,41 @@ ${text.slice(-24e3)}`
|
|
|
16161
16185
|
const live = turn.items.get(item.id);
|
|
16162
16186
|
turn.items.delete(item.id);
|
|
16163
16187
|
turn.persistedItemIds.add(item.id);
|
|
16164
|
-
const
|
|
16188
|
+
const timestamp = live?.timestamp ?? item.timestamp;
|
|
16189
|
+
const persisted = item.type === "subagent" && item.status === "completed" ? { ...item, timestamp, status: "in_progress" } : { ...item, timestamp };
|
|
16190
|
+
if (persisted.type === "subagent" && persisted.status === "in_progress") {
|
|
16191
|
+
const subagent = { turnId, item: persisted, active: new Set(persisted.receiverThreadIds), failed: false };
|
|
16192
|
+
for (const threadId of subagent.active) this.codexSubagents.set(threadId, subagent);
|
|
16193
|
+
}
|
|
16194
|
+
const event = codexItemEvent(turnId, persisted);
|
|
16195
|
+
this.historyFile?.append(event);
|
|
16196
|
+
this.onEvent(event);
|
|
16197
|
+
}
|
|
16198
|
+
updateCodexSubagent(subagent) {
|
|
16199
|
+
const status = normalizeCodexAspTranscriptStatus(subagent.active.size > 0 ? "inProgress" : "completed", subagent.failed);
|
|
16200
|
+
if (subagent.item.status === status) return;
|
|
16201
|
+
subagent.item = { ...subagent.item, status };
|
|
16202
|
+
const event = codexItemEvent(subagent.turnId, subagent.item);
|
|
16165
16203
|
this.historyFile?.append(event);
|
|
16166
16204
|
this.onEvent(event);
|
|
16167
16205
|
}
|
|
16206
|
+
closeCodexSubagents() {
|
|
16207
|
+
for (const subagent of new Set(this.codexSubagents.values())) {
|
|
16208
|
+
subagent.active.clear();
|
|
16209
|
+
this.updateCodexSubagent(subagent);
|
|
16210
|
+
}
|
|
16211
|
+
this.codexSubagents.clear();
|
|
16212
|
+
}
|
|
16213
|
+
onSubagentThreadStatus = (notification) => {
|
|
16214
|
+
if (notification.method !== THREAD_STATUS_CHANGED_METHOD) return;
|
|
16215
|
+
const { threadId, status: { type } } = notification.params;
|
|
16216
|
+
const subagent = this.codexSubagents.get(threadId);
|
|
16217
|
+
if (!subagent) return;
|
|
16218
|
+
if (type === "active") subagent.active.add(threadId);
|
|
16219
|
+
else subagent.active.delete(threadId);
|
|
16220
|
+
subagent.failed ||= type === "systemError";
|
|
16221
|
+
this.updateCodexSubagent(subagent);
|
|
16222
|
+
};
|
|
16168
16223
|
completeTurn(turn) {
|
|
16169
16224
|
const live = this.ensureLiveTurn(turn.id);
|
|
16170
16225
|
const completedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -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-AWKW6SD6.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-32UPBL5I.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