replicas-cli 0.3.428 → 0.3.430
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/index.cjs +464 -238
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -22942,10 +22942,11 @@ var init_types5 = __esm({
|
|
|
22942
22942
|
});
|
|
22943
22943
|
|
|
22944
22944
|
// ../shared/src/subagent-mcp.ts
|
|
22945
|
-
var SUBAGENT_MCP_TOOLS, SUBAGENT_MCP_TOOL_NAMES;
|
|
22945
|
+
var SUBAGENT_MCP_SERVER_NAME, SUBAGENT_MCP_TOOLS, SUBAGENT_MCP_TOOL_NAMES;
|
|
22946
22946
|
var init_subagent_mcp = __esm({
|
|
22947
22947
|
"../shared/src/subagent-mcp.ts"() {
|
|
22948
22948
|
"use strict";
|
|
22949
|
+
SUBAGENT_MCP_SERVER_NAME = "subagents";
|
|
22949
22950
|
SUBAGENT_MCP_TOOLS = {
|
|
22950
22951
|
getProviders: "get_providers",
|
|
22951
22952
|
spawnAgent: "spawn_agent",
|
|
@@ -23027,26 +23028,256 @@ var init_workspace_identity = __esm({
|
|
|
23027
23028
|
}
|
|
23028
23029
|
});
|
|
23029
23030
|
|
|
23031
|
+
// ../shared/src/format.ts
|
|
23032
|
+
function relativeParts(input2, now = Date.now()) {
|
|
23033
|
+
const then = new Date(input2).getTime();
|
|
23034
|
+
if (Number.isNaN(then)) return null;
|
|
23035
|
+
const seconds = Math.max(0, Math.floor((now - then) / 1e3));
|
|
23036
|
+
const minutes = Math.floor(seconds / 60);
|
|
23037
|
+
const hours = Math.floor(minutes / 60);
|
|
23038
|
+
const days = Math.floor(hours / 24);
|
|
23039
|
+
const months = Math.floor(days / 30);
|
|
23040
|
+
return { then, seconds, minutes, hours, days, months, years: Math.floor(months / 12) };
|
|
23041
|
+
}
|
|
23042
|
+
function compactTimeAgo(input2, options) {
|
|
23043
|
+
const p = relativeParts(input2, options?.now);
|
|
23044
|
+
if (!p) return "";
|
|
23045
|
+
if (p.seconds < 60) return options?.seconds === false ? "now" : `${p.seconds}s`;
|
|
23046
|
+
if (p.minutes < 60) return `${p.minutes}m`;
|
|
23047
|
+
if (p.hours < 24) return `${p.hours}h`;
|
|
23048
|
+
if (p.days < 30) return `${p.days}d`;
|
|
23049
|
+
if (p.months < 12) return `${p.months}mo`;
|
|
23050
|
+
return `${p.years}y`;
|
|
23051
|
+
}
|
|
23052
|
+
function formatCompactRelativeTime(input2, now = Date.now()) {
|
|
23053
|
+
const then = new Date(input2).getTime();
|
|
23054
|
+
if (Number.isNaN(then)) return "";
|
|
23055
|
+
if (Math.abs(then - now) < 6e4) return "just now";
|
|
23056
|
+
const future = then > now;
|
|
23057
|
+
const compact = compactTimeAgo(future ? now - (then - now) : then, { now });
|
|
23058
|
+
return future ? `in ${compact}` : `${compact} ago`;
|
|
23059
|
+
}
|
|
23060
|
+
var init_format = __esm({
|
|
23061
|
+
"../shared/src/format.ts"() {
|
|
23062
|
+
"use strict";
|
|
23063
|
+
}
|
|
23064
|
+
});
|
|
23065
|
+
|
|
23066
|
+
// ../shared/src/routes/environment-setups.ts
|
|
23067
|
+
function isEnvironmentSetupStepKey(value) {
|
|
23068
|
+
return ENVIRONMENT_SETUP_STEPS.some((step) => step.key === value);
|
|
23069
|
+
}
|
|
23070
|
+
function isEnvironmentSetupStepStatus(value) {
|
|
23071
|
+
return ENVIRONMENT_SETUP_STEP_STATUSES.some((status) => status === value);
|
|
23072
|
+
}
|
|
23073
|
+
function isEnvironmentSetupAuthoredTriggerType(type) {
|
|
23074
|
+
return ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES.some((authored) => authored === type);
|
|
23075
|
+
}
|
|
23076
|
+
function automationSchema(limits) {
|
|
23077
|
+
const authored = external_exports.object({
|
|
23078
|
+
name: text2(limits.nameChars),
|
|
23079
|
+
description: text2(limits.descriptionChars),
|
|
23080
|
+
prompt: text2(limits.automationPromptChars),
|
|
23081
|
+
triggers: list(proposalTriggerSchema, limits.automationTriggers)
|
|
23082
|
+
});
|
|
23083
|
+
const updated = authored.extend({ triggers: list(external_exports.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
|
|
23084
|
+
return external_exports.object({
|
|
23085
|
+
key: requiredText(limits.automationKeyChars),
|
|
23086
|
+
action: external_exports.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
|
|
23087
|
+
automation_id: external_exports.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
|
|
23088
|
+
name: text2().default(""),
|
|
23089
|
+
description: optionalText2().transform((value) => value ?? ""),
|
|
23090
|
+
prompt: text2().default(""),
|
|
23091
|
+
triggers: list(existingTriggerSchema).default([]),
|
|
23092
|
+
note: optionalText2(limits.automationNoteChars)
|
|
23093
|
+
}).superRefine((automation2, ctx) => {
|
|
23094
|
+
if (automation2.action === "create" && automation2.automation_id) {
|
|
23095
|
+
ctx.addIssue({ code: "custom", path: ["automation_id"], message: "belongs on an update, keep, or disable entry" });
|
|
23096
|
+
}
|
|
23097
|
+
if (automation2.action !== "create" && !automation2.automation_id) {
|
|
23098
|
+
ctx.addIssue({ code: "custom", path: ["automation_id"], message: "must be the id of an automation attached to this environment" });
|
|
23099
|
+
}
|
|
23100
|
+
if (automation2.action === "create" || automation2.action === "update") {
|
|
23101
|
+
if (!automation2.name) ctx.addIssue({ code: "custom", path: ["name"], message: "must not be empty" });
|
|
23102
|
+
if (!automation2.prompt) ctx.addIssue({ code: "custom", path: ["prompt"], message: "must not be empty" });
|
|
23103
|
+
if (automation2.triggers.length === 0) ctx.addIssue({ code: "custom", path: ["triggers"], message: "must not be empty" });
|
|
23104
|
+
}
|
|
23105
|
+
}).transform((automation2, ctx) => {
|
|
23106
|
+
if (automation2.action === "keep" || automation2.action === "disable") return automation2;
|
|
23107
|
+
const content = (automation2.action === "update" ? updated : authored).safeParse(automation2);
|
|
23108
|
+
if (content.success) return { ...automation2, ...content.data };
|
|
23109
|
+
for (const issue2 of content.error.issues) ctx.addIssue({ ...issue2, code: "custom" });
|
|
23110
|
+
return external_exports.NEVER;
|
|
23111
|
+
});
|
|
23112
|
+
}
|
|
23113
|
+
function automationListSchema(limits) {
|
|
23114
|
+
return list(automationSchema(limits)).default([]).superRefine((automations, ctx) => {
|
|
23115
|
+
if (new Set(automations.map((automation2) => automation2.key)).size !== automations.length) {
|
|
23116
|
+
ctx.addIssue({ code: "custom", message: "must have unique keys" });
|
|
23117
|
+
}
|
|
23118
|
+
const targets = automations.flatMap((automation2) => automation2.automation_id ?? []);
|
|
23119
|
+
if (new Set(targets).size !== targets.length) {
|
|
23120
|
+
ctx.addIssue({ code: "custom", message: "must mention each existing automation once" });
|
|
23121
|
+
}
|
|
23122
|
+
if (limits.automations !== void 0 && automations.filter((automation2) => automation2.action === "create").length > limits.automations) {
|
|
23123
|
+
ctx.addIssue({ code: "custom", message: `must create at most ${limits.automations} new automations` });
|
|
23124
|
+
}
|
|
23125
|
+
});
|
|
23126
|
+
}
|
|
23127
|
+
function environmentSchema(limits) {
|
|
23128
|
+
return external_exports.object({
|
|
23129
|
+
name: optionalText2(limits.nameChars).transform((value) => value ?? void 0),
|
|
23130
|
+
description: clearableText(limits.descriptionChars),
|
|
23131
|
+
system_prompt: clearableText(limits.systemPromptChars),
|
|
23132
|
+
start_hook: clearableText(limits.hookChars),
|
|
23133
|
+
warm_hook: clearableText(limits.hookChars)
|
|
23134
|
+
});
|
|
23135
|
+
}
|
|
23136
|
+
function proposalSchema(limits) {
|
|
23137
|
+
return external_exports.object({
|
|
23138
|
+
summary: requiredText(limits.summaryChars),
|
|
23139
|
+
stack: list(text2(), limits.stackItems).default([]).transform((items) => items.filter(Boolean)),
|
|
23140
|
+
environment: environmentSchema(limits),
|
|
23141
|
+
variables: list(external_exports.object({
|
|
23142
|
+
key: external_exports.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
|
|
23143
|
+
description: optionalText2(limits.variableDescriptionChars).transform((value) => value ?? ""),
|
|
23144
|
+
required: external_exports.boolean().default(false)
|
|
23145
|
+
}), limits.variables).default([]),
|
|
23146
|
+
automations: automationListSchema(limits),
|
|
23147
|
+
verification: list(external_exports.object({
|
|
23148
|
+
label: requiredText(limits.nameChars),
|
|
23149
|
+
status: external_exports.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
|
|
23150
|
+
detail: optionalText2(limits.verificationDetailChars).transform((value) => value ?? void 0)
|
|
23151
|
+
}), limits.verificationItems).default([]),
|
|
23152
|
+
media: list(external_exports.object({
|
|
23153
|
+
media_id: external_exports.string().regex(UUID_RE, "must be a media id"),
|
|
23154
|
+
title: requiredText(limits.nameChars)
|
|
23155
|
+
}), limits.mediaItems).default([])
|
|
23156
|
+
});
|
|
23157
|
+
}
|
|
23158
|
+
var ENVIRONMENT_SETUP_STEPS, ENVIRONMENT_SETUP_STEP_STATUSES, ENVIRONMENT_SETUP_RUN_STATUSES, ENVIRONMENT_SETUP_AUTOMATION_ACTIONS, ENVIRONMENT_SETUP_VERIFICATION_STATUSES, ENVIRONMENT_SETUP_LIMITS, VARIABLE_KEY_RE, text2, requiredText, optionalText2, clearableText, list, ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES, proposalTriggerSchema, existingTriggerSchema, carriedTriggerSchema, environmentSetupProposalSchema, environmentSetupProposalSubmissionSchema, environmentSetupRunStateSchema, applyEnvironmentSetupRequestSchema;
|
|
23159
|
+
var init_environment_setups = __esm({
|
|
23160
|
+
"../shared/src/routes/environment-setups.ts"() {
|
|
23161
|
+
"use strict";
|
|
23162
|
+
init_zod();
|
|
23163
|
+
init_trigger_schemas();
|
|
23164
|
+
init_format();
|
|
23165
|
+
init_type_guards();
|
|
23166
|
+
init_uuid();
|
|
23167
|
+
ENVIRONMENT_SETUP_STEPS = [
|
|
23168
|
+
{ key: "understand", label: "Understand the codebase" },
|
|
23169
|
+
{ key: "install", label: "Install dependencies and run the app" },
|
|
23170
|
+
{ key: "verify", label: "Verify checks and record a walkthrough" },
|
|
23171
|
+
{ key: "configure", label: "Draft hooks, system prompt, and automations" },
|
|
23172
|
+
{ key: "propose", label: "Propose the configuration for review" }
|
|
23173
|
+
];
|
|
23174
|
+
ENVIRONMENT_SETUP_STEP_STATUSES = ["pending", "in_progress", "completed", "skipped"];
|
|
23175
|
+
ENVIRONMENT_SETUP_RUN_STATUSES = ["running", "proposed", "applied", "failed", "cancelled", "expired"];
|
|
23176
|
+
ENVIRONMENT_SETUP_AUTOMATION_ACTIONS = ["create", "update", "keep", "disable"];
|
|
23177
|
+
ENVIRONMENT_SETUP_VERIFICATION_STATUSES = ["passed", "failed", "skipped"];
|
|
23178
|
+
ENVIRONMENT_SETUP_LIMITS = {
|
|
23179
|
+
summaryChars: 600,
|
|
23180
|
+
stackItems: 30,
|
|
23181
|
+
nameChars: 120,
|
|
23182
|
+
descriptionChars: 1e3,
|
|
23183
|
+
systemPromptChars: 2e4,
|
|
23184
|
+
hookChars: 5e4,
|
|
23185
|
+
variables: 50,
|
|
23186
|
+
variableKeyChars: 128,
|
|
23187
|
+
variableDescriptionChars: 500,
|
|
23188
|
+
automations: 8,
|
|
23189
|
+
automationKeyChars: 80,
|
|
23190
|
+
automationPromptChars: 1e4,
|
|
23191
|
+
automationTriggers: 5,
|
|
23192
|
+
automationNoteChars: 300,
|
|
23193
|
+
verificationItems: 8,
|
|
23194
|
+
verificationDetailChars: 300,
|
|
23195
|
+
mediaItems: 8,
|
|
23196
|
+
repositories: 20
|
|
23197
|
+
};
|
|
23198
|
+
VARIABLE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
23199
|
+
text2 = (max) => max === void 0 ? external_exports.string().trim() : external_exports.string().trim().max(max);
|
|
23200
|
+
requiredText = (max) => text2(max).min(1, "must not be empty");
|
|
23201
|
+
optionalText2 = (max) => text2(max).nullish().transform((value) => value || null);
|
|
23202
|
+
clearableText = (max) => text2(max).nullish().transform((value) => value === void 0 ? void 0 : value || null);
|
|
23203
|
+
list = (item, max) => max === void 0 ? external_exports.array(item) : external_exports.array(item).max(max);
|
|
23204
|
+
ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES = ["cron", "github", "gitlab"];
|
|
23205
|
+
proposalTriggerSchema = external_exports.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
|
|
23206
|
+
existingTriggerSchema = external_exports.custom(
|
|
23207
|
+
(value) => isRecord(value) && typeof value.type === "string" && isRecord(value.config),
|
|
23208
|
+
"must be an automation trigger"
|
|
23209
|
+
);
|
|
23210
|
+
carriedTriggerSchema = existingTriggerSchema.refine(
|
|
23211
|
+
(trigger) => !isEnvironmentSetupAuthoredTriggerType(trigger.type)
|
|
23212
|
+
);
|
|
23213
|
+
environmentSetupProposalSchema = proposalSchema({});
|
|
23214
|
+
environmentSetupProposalSubmissionSchema = proposalSchema(ENVIRONMENT_SETUP_LIMITS);
|
|
23215
|
+
environmentSetupRunStateSchema = external_exports.object({
|
|
23216
|
+
status: external_exports.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
|
|
23217
|
+
steps: external_exports.partialRecord(external_exports.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), external_exports.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
|
|
23218
|
+
proposal: environmentSetupProposalSchema.nullable().default(null),
|
|
23219
|
+
applied: external_exports.object({
|
|
23220
|
+
applied_at: external_exports.string(),
|
|
23221
|
+
automation_ids: external_exports.array(external_exports.string())
|
|
23222
|
+
}).nullable().default(null)
|
|
23223
|
+
});
|
|
23224
|
+
applyEnvironmentSetupRequestSchema = external_exports.object({
|
|
23225
|
+
environment: environmentSchema(ENVIRONMENT_SETUP_LIMITS).extend({ name: requiredText(ENVIRONMENT_SETUP_LIMITS.nameChars) }),
|
|
23226
|
+
variables: list(external_exports.object({ key: external_exports.string().regex(VARIABLE_KEY_RE), value: external_exports.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)),
|
|
23227
|
+
automations: automationListSchema(ENVIRONMENT_SETUP_LIMITS)
|
|
23228
|
+
});
|
|
23229
|
+
}
|
|
23230
|
+
});
|
|
23231
|
+
|
|
23030
23232
|
// ../shared/src/routes/environment.ts
|
|
23031
|
-
|
|
23233
|
+
function validateEnvironmentMcpAuthentication(transport, config3) {
|
|
23234
|
+
if (!config3.auth) return createSuccessResult();
|
|
23235
|
+
const url2 = new URL(config3.url);
|
|
23236
|
+
if (url2.search || url2.protocol !== "https:") {
|
|
23237
|
+
return createErrorResult({ code: "url", message: "OAuth and workspace identity authentication require an HTTPS MCP URL without query parameters" });
|
|
23238
|
+
}
|
|
23239
|
+
const dropped = getMcpProxyDroppedHeader({ ...config3.headers, ...config3.headersFrom });
|
|
23240
|
+
if (dropped) {
|
|
23241
|
+
return createErrorResult({ code: "headers", message: `Remove the ${dropped} header: OAuth and workspace identity MCPs don't send it` });
|
|
23242
|
+
}
|
|
23243
|
+
if (config3.auth.type === "oauth" && transport === "sse") {
|
|
23244
|
+
return createErrorResult({ code: "transport", message: "OAuth requires the HTTP transport" });
|
|
23245
|
+
}
|
|
23246
|
+
return createSuccessResult();
|
|
23247
|
+
}
|
|
23248
|
+
function isReservedMcpName(name) {
|
|
23249
|
+
return RESERVED_MCP_NAME_PREFIXES.some((prefix) => name.startsWith(prefix));
|
|
23250
|
+
}
|
|
23251
|
+
var ENVIRONMENT_MCP_TRANSPORTS, MCP_NAME_PATTERN, environmentMcpVariableReferenceSchema, getMcpProxyDroppedHeader, stringMap, environmentMcpStdioConfigSchema, environmentMcpHttpConfigSchema, createEnvironmentMcpRequestSchema, updateEnvironmentMcpRequestSchema, RESERVED_MCP_NAME_PREFIXES, screenPasswordSchema, hostSchema, createEnvironmentDeviceRequestSchema, updateEnvironmentDeviceRequestSchema, DEVICE_ONLINE_WINDOW_MS, isDeviceOnline, deviceConnectionResponseSchema, deviceHostKeysRequestSchema, DEVICE_CONNECT_COMMAND, provisionedDeviceSchema;
|
|
23032
23252
|
var init_environment = __esm({
|
|
23033
23253
|
"../shared/src/routes/environment.ts"() {
|
|
23034
23254
|
"use strict";
|
|
23035
23255
|
init_subagent_mcp();
|
|
23036
23256
|
init_zod();
|
|
23037
23257
|
init_workspace_identity();
|
|
23258
|
+
init_environment_setups();
|
|
23259
|
+
init_result();
|
|
23038
23260
|
init_urls();
|
|
23039
23261
|
ENVIRONMENT_MCP_TRANSPORTS = ["stdio", "http", "sse"];
|
|
23262
|
+
MCP_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
|
|
23263
|
+
environmentMcpVariableReferenceSchema = external_exports.strictObject({
|
|
23264
|
+
env: external_exports.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name"),
|
|
23265
|
+
prefix: external_exports.string().optional()
|
|
23266
|
+
});
|
|
23267
|
+
getMcpProxyDroppedHeader = (headers) => Object.keys(headers).find((name) => ["authorization", "proxy-authorization", "cookie"].includes(name.toLowerCase()));
|
|
23040
23268
|
stringMap = external_exports.record(external_exports.string(), external_exports.string());
|
|
23269
|
+
environmentMcpStdioConfigSchema = external_exports.object({ command: external_exports.string().min(1), args: external_exports.array(external_exports.string()).optional(), env: stringMap.optional(), envFrom: external_exports.record(external_exports.string().regex(VARIABLE_KEY_RE), environmentMcpVariableReferenceSchema).optional() });
|
|
23270
|
+
environmentMcpHttpConfigSchema = external_exports.object({ url: external_exports.url(), headers: stringMap.optional(), headersFrom: external_exports.record(external_exports.string(), environmentMcpVariableReferenceSchema).optional(), auth: mcpAuthSchema.optional() });
|
|
23041
23271
|
createEnvironmentMcpRequestSchema = external_exports.object({
|
|
23042
23272
|
name: external_exports.string(),
|
|
23043
23273
|
transport: external_exports.enum(ENVIRONMENT_MCP_TRANSPORTS),
|
|
23044
23274
|
config: external_exports.union([
|
|
23045
|
-
|
|
23046
|
-
|
|
23275
|
+
environmentMcpStdioConfigSchema,
|
|
23276
|
+
environmentMcpHttpConfigSchema
|
|
23047
23277
|
]).describe("stdio: `{ command, args, env }`. http/sse: `{ url, headers }`.")
|
|
23048
23278
|
});
|
|
23049
23279
|
updateEnvironmentMcpRequestSchema = createEnvironmentMcpRequestSchema.partial();
|
|
23280
|
+
RESERVED_MCP_NAME_PREFIXES = ["replicas-", SUBAGENT_MCP_SERVER_NAME];
|
|
23050
23281
|
screenPasswordSchema = external_exports.string().min(1, "Enter the screen password").max(256).describe('Screen Sharing password, for `replicas computer screen`. On a Mac, the "VNC viewers may control screen with password" password. Never returned.');
|
|
23051
23282
|
hostSchema = external_exports.string().max(253).regex(/^(?:[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?|[0-9A-Fa-f:]+)$/, "Enter a hostname or IP address");
|
|
23052
23283
|
createEnvironmentDeviceRequestSchema = external_exports.object({
|
|
@@ -23082,8 +23313,22 @@ var init_environment = __esm({
|
|
|
23082
23313
|
}
|
|
23083
23314
|
});
|
|
23084
23315
|
|
|
23316
|
+
// ../shared/src/routes/environment-config-source.ts
|
|
23317
|
+
var previewEnvironmentConfigSourceRequestSchema, applyEnvironmentConfigSourceRequestSchema;
|
|
23318
|
+
var init_environment_config_source = __esm({
|
|
23319
|
+
"../shared/src/routes/environment-config-source.ts"() {
|
|
23320
|
+
"use strict";
|
|
23321
|
+
init_zod();
|
|
23322
|
+
previewEnvironmentConfigSourceRequestSchema = external_exports.strictObject({ repository_id: external_exports.string().min(1).optional() });
|
|
23323
|
+
applyEnvironmentConfigSourceRequestSchema = previewEnvironmentConfigSourceRequestSchema.extend({
|
|
23324
|
+
commit_sha: external_exports.string().min(1),
|
|
23325
|
+
fingerprint: external_exports.string().min(1)
|
|
23326
|
+
});
|
|
23327
|
+
}
|
|
23328
|
+
});
|
|
23329
|
+
|
|
23085
23330
|
// ../shared/src/replicas-mcp.ts
|
|
23086
|
-
var REPLICAS_MCP_TOOLS, automationToolInputSchema, credentialUserIdDescription, automationBackgroundSchema, automationCreateToolInputSchema, automationUpdateToolInputSchema, chatPath, provider, model, thinkingLevel, title, message, createChatToolInputSchema, forkChatToolInputSchema, renameChatToolInputSchema, runCommandToolInputSchema, environmentMcpPath, createEnvironmentMcpToolInputSchema, updateEnvironmentMcpToolInputSchema, createEnvironmentDeviceToolInputSchema;
|
|
23331
|
+
var REPLICAS_MCP_TOOLS, automationToolInputSchema, credentialUserIdDescription, automationBackgroundSchema, automationCreateToolInputSchema, automationUpdateToolInputSchema, chatPath, provider, model, thinkingLevel, title, message, createChatToolInputSchema, forkChatToolInputSchema, renameChatToolInputSchema, runCommandToolInputSchema, environmentMcpPath, createEnvironmentMcpToolInputSchema, updateEnvironmentMcpToolInputSchema, createEnvironmentDeviceToolInputSchema, previewEnvironmentConfigSourceToolInputSchema, applyEnvironmentConfigSourceToolInputSchema;
|
|
23087
23332
|
var init_replicas_mcp = __esm({
|
|
23088
23333
|
"../shared/src/replicas-mcp.ts"() {
|
|
23089
23334
|
"use strict";
|
|
@@ -23095,6 +23340,7 @@ var init_replicas_mcp = __esm({
|
|
|
23095
23340
|
init_chat_fork();
|
|
23096
23341
|
init_v1();
|
|
23097
23342
|
init_environment();
|
|
23343
|
+
init_environment_config_source();
|
|
23098
23344
|
init_workspaces();
|
|
23099
23345
|
init_sandbox();
|
|
23100
23346
|
REPLICAS_MCP_TOOLS = {
|
|
@@ -23128,6 +23374,7 @@ var init_replicas_mcp = __esm({
|
|
|
23128
23374
|
getBoard: "get_board",
|
|
23129
23375
|
updateBoard: "update_board",
|
|
23130
23376
|
updateTicket: "update_ticket",
|
|
23377
|
+
replyOnTicket: "reply_on_ticket",
|
|
23131
23378
|
sendToChat: "send_to_chat",
|
|
23132
23379
|
getLinearRouting: "get_linear_routing",
|
|
23133
23380
|
setLinearRouting: "set_linear_routing",
|
|
@@ -23204,6 +23451,8 @@ var init_replicas_mcp = __esm({
|
|
|
23204
23451
|
...updateEnvironmentMcpRequestSchema.shape
|
|
23205
23452
|
});
|
|
23206
23453
|
createEnvironmentDeviceToolInputSchema = external_exports.object({ ...environmentMcpPath, ...createEnvironmentDeviceRequestSchema.shape });
|
|
23454
|
+
previewEnvironmentConfigSourceToolInputSchema = external_exports.object({ ...environmentMcpPath, ...previewEnvironmentConfigSourceRequestSchema.shape });
|
|
23455
|
+
applyEnvironmentConfigSourceToolInputSchema = external_exports.object({ ...environmentMcpPath, ...applyEnvironmentConfigSourceRequestSchema.shape });
|
|
23207
23456
|
}
|
|
23208
23457
|
});
|
|
23209
23458
|
|
|
@@ -23669,207 +23918,6 @@ until docker info >/dev/null 2>&1; do sleep 0.2; done
|
|
|
23669
23918
|
}
|
|
23670
23919
|
});
|
|
23671
23920
|
|
|
23672
|
-
// ../shared/src/format.ts
|
|
23673
|
-
function relativeParts(input2, now = Date.now()) {
|
|
23674
|
-
const then = new Date(input2).getTime();
|
|
23675
|
-
if (Number.isNaN(then)) return null;
|
|
23676
|
-
const seconds = Math.max(0, Math.floor((now - then) / 1e3));
|
|
23677
|
-
const minutes = Math.floor(seconds / 60);
|
|
23678
|
-
const hours = Math.floor(minutes / 60);
|
|
23679
|
-
const days = Math.floor(hours / 24);
|
|
23680
|
-
const months = Math.floor(days / 30);
|
|
23681
|
-
return { then, seconds, minutes, hours, days, months, years: Math.floor(months / 12) };
|
|
23682
|
-
}
|
|
23683
|
-
function compactTimeAgo(input2, options) {
|
|
23684
|
-
const p = relativeParts(input2, options?.now);
|
|
23685
|
-
if (!p) return "";
|
|
23686
|
-
if (p.seconds < 60) return options?.seconds === false ? "now" : `${p.seconds}s`;
|
|
23687
|
-
if (p.minutes < 60) return `${p.minutes}m`;
|
|
23688
|
-
if (p.hours < 24) return `${p.hours}h`;
|
|
23689
|
-
if (p.days < 30) return `${p.days}d`;
|
|
23690
|
-
if (p.months < 12) return `${p.months}mo`;
|
|
23691
|
-
return `${p.years}y`;
|
|
23692
|
-
}
|
|
23693
|
-
function formatCompactRelativeTime(input2, now = Date.now()) {
|
|
23694
|
-
const then = new Date(input2).getTime();
|
|
23695
|
-
if (Number.isNaN(then)) return "";
|
|
23696
|
-
if (Math.abs(then - now) < 6e4) return "just now";
|
|
23697
|
-
const future = then > now;
|
|
23698
|
-
const compact = compactTimeAgo(future ? now - (then - now) : then, { now });
|
|
23699
|
-
return future ? `in ${compact}` : `${compact} ago`;
|
|
23700
|
-
}
|
|
23701
|
-
var init_format = __esm({
|
|
23702
|
-
"../shared/src/format.ts"() {
|
|
23703
|
-
"use strict";
|
|
23704
|
-
}
|
|
23705
|
-
});
|
|
23706
|
-
|
|
23707
|
-
// ../shared/src/routes/environment-setups.ts
|
|
23708
|
-
function isEnvironmentSetupStepKey(value) {
|
|
23709
|
-
return ENVIRONMENT_SETUP_STEPS.some((step) => step.key === value);
|
|
23710
|
-
}
|
|
23711
|
-
function isEnvironmentSetupStepStatus(value) {
|
|
23712
|
-
return ENVIRONMENT_SETUP_STEP_STATUSES.some((status) => status === value);
|
|
23713
|
-
}
|
|
23714
|
-
function isEnvironmentSetupAuthoredTriggerType(type) {
|
|
23715
|
-
return ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES.some((authored) => authored === type);
|
|
23716
|
-
}
|
|
23717
|
-
function automationSchema(limits) {
|
|
23718
|
-
const authored = external_exports.object({
|
|
23719
|
-
name: text2(limits.nameChars),
|
|
23720
|
-
description: text2(limits.descriptionChars),
|
|
23721
|
-
prompt: text2(limits.automationPromptChars),
|
|
23722
|
-
triggers: list(proposalTriggerSchema, limits.automationTriggers)
|
|
23723
|
-
});
|
|
23724
|
-
const updated = authored.extend({ triggers: list(external_exports.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
|
|
23725
|
-
return external_exports.object({
|
|
23726
|
-
key: requiredText(limits.automationKeyChars),
|
|
23727
|
-
action: external_exports.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
|
|
23728
|
-
automation_id: external_exports.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
|
|
23729
|
-
name: text2().default(""),
|
|
23730
|
-
description: optionalText2().transform((value) => value ?? ""),
|
|
23731
|
-
prompt: text2().default(""),
|
|
23732
|
-
triggers: list(existingTriggerSchema).default([]),
|
|
23733
|
-
note: optionalText2(limits.automationNoteChars)
|
|
23734
|
-
}).superRefine((automation2, ctx) => {
|
|
23735
|
-
if (automation2.action === "create" && automation2.automation_id) {
|
|
23736
|
-
ctx.addIssue({ code: "custom", path: ["automation_id"], message: "belongs on an update, keep, or disable entry" });
|
|
23737
|
-
}
|
|
23738
|
-
if (automation2.action !== "create" && !automation2.automation_id) {
|
|
23739
|
-
ctx.addIssue({ code: "custom", path: ["automation_id"], message: "must be the id of an automation attached to this environment" });
|
|
23740
|
-
}
|
|
23741
|
-
if (automation2.action === "create" || automation2.action === "update") {
|
|
23742
|
-
if (!automation2.name) ctx.addIssue({ code: "custom", path: ["name"], message: "must not be empty" });
|
|
23743
|
-
if (!automation2.prompt) ctx.addIssue({ code: "custom", path: ["prompt"], message: "must not be empty" });
|
|
23744
|
-
if (automation2.triggers.length === 0) ctx.addIssue({ code: "custom", path: ["triggers"], message: "must not be empty" });
|
|
23745
|
-
}
|
|
23746
|
-
}).transform((automation2, ctx) => {
|
|
23747
|
-
if (automation2.action === "keep" || automation2.action === "disable") return automation2;
|
|
23748
|
-
const content = (automation2.action === "update" ? updated : authored).safeParse(automation2);
|
|
23749
|
-
if (content.success) return { ...automation2, ...content.data };
|
|
23750
|
-
for (const issue2 of content.error.issues) ctx.addIssue({ ...issue2, code: "custom" });
|
|
23751
|
-
return external_exports.NEVER;
|
|
23752
|
-
});
|
|
23753
|
-
}
|
|
23754
|
-
function automationListSchema(limits) {
|
|
23755
|
-
return list(automationSchema(limits)).default([]).superRefine((automations, ctx) => {
|
|
23756
|
-
if (new Set(automations.map((automation2) => automation2.key)).size !== automations.length) {
|
|
23757
|
-
ctx.addIssue({ code: "custom", message: "must have unique keys" });
|
|
23758
|
-
}
|
|
23759
|
-
const targets = automations.flatMap((automation2) => automation2.automation_id ?? []);
|
|
23760
|
-
if (new Set(targets).size !== targets.length) {
|
|
23761
|
-
ctx.addIssue({ code: "custom", message: "must mention each existing automation once" });
|
|
23762
|
-
}
|
|
23763
|
-
if (limits.automations !== void 0 && automations.filter((automation2) => automation2.action === "create").length > limits.automations) {
|
|
23764
|
-
ctx.addIssue({ code: "custom", message: `must create at most ${limits.automations} new automations` });
|
|
23765
|
-
}
|
|
23766
|
-
});
|
|
23767
|
-
}
|
|
23768
|
-
function environmentSchema(limits) {
|
|
23769
|
-
return external_exports.object({
|
|
23770
|
-
name: optionalText2(limits.nameChars).transform((value) => value ?? void 0),
|
|
23771
|
-
description: clearableText(limits.descriptionChars),
|
|
23772
|
-
system_prompt: clearableText(limits.systemPromptChars),
|
|
23773
|
-
start_hook: clearableText(limits.hookChars),
|
|
23774
|
-
warm_hook: clearableText(limits.hookChars)
|
|
23775
|
-
});
|
|
23776
|
-
}
|
|
23777
|
-
function proposalSchema(limits) {
|
|
23778
|
-
return external_exports.object({
|
|
23779
|
-
summary: requiredText(limits.summaryChars),
|
|
23780
|
-
stack: list(text2(), limits.stackItems).default([]).transform((items) => items.filter(Boolean)),
|
|
23781
|
-
environment: environmentSchema(limits),
|
|
23782
|
-
variables: list(external_exports.object({
|
|
23783
|
-
key: external_exports.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
|
|
23784
|
-
description: optionalText2(limits.variableDescriptionChars).transform((value) => value ?? ""),
|
|
23785
|
-
required: external_exports.boolean().default(false)
|
|
23786
|
-
}), limits.variables).default([]),
|
|
23787
|
-
automations: automationListSchema(limits),
|
|
23788
|
-
verification: list(external_exports.object({
|
|
23789
|
-
label: requiredText(limits.nameChars),
|
|
23790
|
-
status: external_exports.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
|
|
23791
|
-
detail: optionalText2(limits.verificationDetailChars).transform((value) => value ?? void 0)
|
|
23792
|
-
}), limits.verificationItems).default([]),
|
|
23793
|
-
media: list(external_exports.object({
|
|
23794
|
-
media_id: external_exports.string().regex(UUID_RE, "must be a media id"),
|
|
23795
|
-
title: requiredText(limits.nameChars)
|
|
23796
|
-
}), limits.mediaItems).default([])
|
|
23797
|
-
});
|
|
23798
|
-
}
|
|
23799
|
-
var ENVIRONMENT_SETUP_STEPS, ENVIRONMENT_SETUP_STEP_STATUSES, ENVIRONMENT_SETUP_RUN_STATUSES, ENVIRONMENT_SETUP_AUTOMATION_ACTIONS, ENVIRONMENT_SETUP_VERIFICATION_STATUSES, ENVIRONMENT_SETUP_LIMITS, VARIABLE_KEY_RE, text2, requiredText, optionalText2, clearableText, list, ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES, proposalTriggerSchema, existingTriggerSchema, carriedTriggerSchema, environmentSetupProposalSchema, environmentSetupProposalSubmissionSchema, environmentSetupRunStateSchema, applyEnvironmentSetupRequestSchema;
|
|
23800
|
-
var init_environment_setups = __esm({
|
|
23801
|
-
"../shared/src/routes/environment-setups.ts"() {
|
|
23802
|
-
"use strict";
|
|
23803
|
-
init_zod();
|
|
23804
|
-
init_trigger_schemas();
|
|
23805
|
-
init_format();
|
|
23806
|
-
init_type_guards();
|
|
23807
|
-
init_uuid();
|
|
23808
|
-
ENVIRONMENT_SETUP_STEPS = [
|
|
23809
|
-
{ key: "understand", label: "Understand the codebase" },
|
|
23810
|
-
{ key: "install", label: "Install dependencies and run the app" },
|
|
23811
|
-
{ key: "verify", label: "Verify checks and record a walkthrough" },
|
|
23812
|
-
{ key: "configure", label: "Draft hooks, system prompt, and automations" },
|
|
23813
|
-
{ key: "propose", label: "Propose the configuration for review" }
|
|
23814
|
-
];
|
|
23815
|
-
ENVIRONMENT_SETUP_STEP_STATUSES = ["pending", "in_progress", "completed", "skipped"];
|
|
23816
|
-
ENVIRONMENT_SETUP_RUN_STATUSES = ["running", "proposed", "applied", "failed", "cancelled", "expired"];
|
|
23817
|
-
ENVIRONMENT_SETUP_AUTOMATION_ACTIONS = ["create", "update", "keep", "disable"];
|
|
23818
|
-
ENVIRONMENT_SETUP_VERIFICATION_STATUSES = ["passed", "failed", "skipped"];
|
|
23819
|
-
ENVIRONMENT_SETUP_LIMITS = {
|
|
23820
|
-
summaryChars: 600,
|
|
23821
|
-
stackItems: 30,
|
|
23822
|
-
nameChars: 120,
|
|
23823
|
-
descriptionChars: 1e3,
|
|
23824
|
-
systemPromptChars: 2e4,
|
|
23825
|
-
hookChars: 5e4,
|
|
23826
|
-
variables: 50,
|
|
23827
|
-
variableKeyChars: 128,
|
|
23828
|
-
variableDescriptionChars: 500,
|
|
23829
|
-
automations: 8,
|
|
23830
|
-
automationKeyChars: 80,
|
|
23831
|
-
automationPromptChars: 1e4,
|
|
23832
|
-
automationTriggers: 5,
|
|
23833
|
-
automationNoteChars: 300,
|
|
23834
|
-
verificationItems: 8,
|
|
23835
|
-
verificationDetailChars: 300,
|
|
23836
|
-
mediaItems: 8,
|
|
23837
|
-
repositories: 20
|
|
23838
|
-
};
|
|
23839
|
-
VARIABLE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
23840
|
-
text2 = (max) => max === void 0 ? external_exports.string().trim() : external_exports.string().trim().max(max);
|
|
23841
|
-
requiredText = (max) => text2(max).min(1, "must not be empty");
|
|
23842
|
-
optionalText2 = (max) => text2(max).nullish().transform((value) => value || null);
|
|
23843
|
-
clearableText = (max) => text2(max).nullish().transform((value) => value === void 0 ? void 0 : value || null);
|
|
23844
|
-
list = (item, max) => max === void 0 ? external_exports.array(item) : external_exports.array(item).max(max);
|
|
23845
|
-
ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES = ["cron", "github", "gitlab"];
|
|
23846
|
-
proposalTriggerSchema = external_exports.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
|
|
23847
|
-
existingTriggerSchema = external_exports.custom(
|
|
23848
|
-
(value) => isRecord(value) && typeof value.type === "string" && isRecord(value.config),
|
|
23849
|
-
"must be an automation trigger"
|
|
23850
|
-
);
|
|
23851
|
-
carriedTriggerSchema = existingTriggerSchema.refine(
|
|
23852
|
-
(trigger) => !isEnvironmentSetupAuthoredTriggerType(trigger.type)
|
|
23853
|
-
);
|
|
23854
|
-
environmentSetupProposalSchema = proposalSchema({});
|
|
23855
|
-
environmentSetupProposalSubmissionSchema = proposalSchema(ENVIRONMENT_SETUP_LIMITS);
|
|
23856
|
-
environmentSetupRunStateSchema = external_exports.object({
|
|
23857
|
-
status: external_exports.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
|
|
23858
|
-
steps: external_exports.partialRecord(external_exports.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), external_exports.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
|
|
23859
|
-
proposal: environmentSetupProposalSchema.nullable().default(null),
|
|
23860
|
-
applied: external_exports.object({
|
|
23861
|
-
applied_at: external_exports.string(),
|
|
23862
|
-
automation_ids: external_exports.array(external_exports.string())
|
|
23863
|
-
}).nullable().default(null)
|
|
23864
|
-
});
|
|
23865
|
-
applyEnvironmentSetupRequestSchema = external_exports.object({
|
|
23866
|
-
environment: environmentSchema(ENVIRONMENT_SETUP_LIMITS).extend({ name: requiredText(ENVIRONMENT_SETUP_LIMITS.nameChars) }),
|
|
23867
|
-
variables: list(external_exports.object({ key: external_exports.string().regex(VARIABLE_KEY_RE), value: external_exports.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)),
|
|
23868
|
-
automations: automationListSchema(ENVIRONMENT_SETUP_LIMITS)
|
|
23869
|
-
});
|
|
23870
|
-
}
|
|
23871
|
-
});
|
|
23872
|
-
|
|
23873
23921
|
// ../shared/src/default-skills/replicas-agent/abilities/environment-setup.ts
|
|
23874
23922
|
var SECTION3, REFERENCE3, ENVIRONMENT_SETUP_ABILITY;
|
|
23875
23923
|
var init_environment_setup = __esm({
|
|
@@ -26552,7 +26600,7 @@ function stripAgentInstructionBlocks(text4) {
|
|
|
26552
26600
|
else spans(prose, text4.length);
|
|
26553
26601
|
return stripInstructionBlocksOutside(text4, quoted);
|
|
26554
26602
|
}
|
|
26555
|
-
var REPLICAS_INSTRUCTIONS_TAG, MOTHERSHIP_INSTRUCTIONS_TAG, fenceMarker, INSTRUCTIONS_OPEN, INSTRUCTIONS_CLOSE, MOTHERSHIP_EVENT_CHAT_NOTE, BOARD_ANSWER_NOTE, BOARD_RULES, MOTHERSHIP_INSTRUCTIONS_BLOCK, T, SCOUT_LINEAR_RULES, SCOUT_MUTED_RULES, SCOUT_PRIOR_UNTAGGED_RULES, SCOUT_JOINED_RULES, SCOUT_REACTION_RULES;
|
|
26603
|
+
var REPLICAS_INSTRUCTIONS_TAG, MOTHERSHIP_INSTRUCTIONS_TAG, fenceMarker, INSTRUCTIONS_OPEN, INSTRUCTIONS_CLOSE, MOTHERSHIP_EVENT_CHAT_NOTE, BOARD_ANSWER_NOTE, BOARD_RULES, MOTHERSHIP_INSTRUCTIONS_BLOCK, MOTHERSHIP_TICKET_MESSAGE_NOTE, MOTHERSHIP_TICKET_REPLY_NUDGE, T, SCOUT_LINEAR_RULES, SCOUT_MUTED_RULES, SCOUT_PRIOR_UNTAGGED_RULES, SCOUT_JOINED_RULES, SCOUT_REACTION_RULES;
|
|
26556
26604
|
var init_prompts = __esm({
|
|
26557
26605
|
"../shared/src/prompts.ts"() {
|
|
26558
26606
|
"use strict";
|
|
@@ -26588,6 +26636,8 @@ var init_prompts = __esm({
|
|
|
26588
26636
|
- The chat is like texting an assistant: the user sees only your final reply to each message they type, plus what you send with \`${REPLICAS_MCP_TOOLS.sendToChat}\`, never your tool calls or earlier text. Answer every message they type in chat, even one that arrives during a ship event or board answer, and never only on the board: if they ask something while you handle an event, answer that question, not just the event. Write in a line or two with links, and include any media inline. Never restate the board in chat: no status tables, per-ship lists or summaries of what ships did.
|
|
26589
26637
|
`;
|
|
26590
26638
|
MOTHERSHIP_INSTRUCTIONS_BLOCK = new RegExp(`\\s*<${MOTHERSHIP_INSTRUCTIONS_TAG}>\\n([\\s\\S]*?)\\n</${MOTHERSHIP_INSTRUCTIONS_TAG}>`);
|
|
26639
|
+
MOTHERSHIP_TICKET_MESSAGE_NOTE = `The user sent this from your ticket on the Mothership's board and reads your answer there, not in this chat. Answer them with \`${REPLICAS_MCP_TOOLS.replyOnTicket}\`: briefly, with a link or screenshot if it helps, and a follow-up question only if you need one. Keep longer work and detail in this chat.`;
|
|
26640
|
+
MOTHERSHIP_TICKET_REPLY_NUDGE = `The user is still waiting for your answer on your ticket, and they only read the ticket. Answer them now with \`${REPLICAS_MCP_TOOLS.replyOnTicket}\`, briefly.`;
|
|
26591
26641
|
T = REPLICAS_MCP_TOOLS;
|
|
26592
26642
|
SCOUT_LINEAR_RULES = `Linear issue triage: team instructions define what is actionable. Use \`replicas.linear.graphql\` from \`@replicas/sdk\` for every Linear read and mutation, never a Replicas CLI command. Choose exactly one:
|
|
26593
26643
|
1. **Ignore** issues the team instructions leave to humans or that should not start work: do nothing and write nothing to Linear. If \`agent_session_id\` is set because you asked a question earlier, create a \`response\` Agent Activity on it with one short closing response.
|
|
@@ -26668,6 +26718,7 @@ function extractMothershipEvents(text4) {
|
|
|
26668
26718
|
summary: summary.trim(),
|
|
26669
26719
|
...detail ? { detail } : {},
|
|
26670
26720
|
...attributes.chat_id ? { chatId: attributes.chat_id } : {},
|
|
26721
|
+
...attributes.ticket_id ? { ticket: { id: attributes.ticket_id, title: attributes.ticket ?? "" } } : {},
|
|
26671
26722
|
...attributes.noticed === "true" ? { noticed: true } : {}
|
|
26672
26723
|
}];
|
|
26673
26724
|
});
|
|
@@ -26688,7 +26739,7 @@ var init_mothership_events = __esm({
|
|
|
26688
26739
|
init_prompts();
|
|
26689
26740
|
init_message_origin();
|
|
26690
26741
|
init_urls();
|
|
26691
|
-
MOTHERSHIP_EVENT_KINDS = ["finished", "ready", "needs_attention", "approved", "merged", "closed", "archived"];
|
|
26742
|
+
MOTHERSHIP_EVENT_KINDS = ["finished", "ready", "needs_attention", "approved", "merged", "closed", "archived", "replied"];
|
|
26692
26743
|
UNKNOWN_EVENT_KIND = "update";
|
|
26693
26744
|
MOTHERSHIP_EVENT_TYPE = "multitask-event";
|
|
26694
26745
|
mothershipEventSchema = external_exports.object({
|
|
@@ -26701,6 +26752,7 @@ var init_mothership_events = __esm({
|
|
|
26701
26752
|
detail: external_exports.string().optional(),
|
|
26702
26753
|
// Set when the subagent is a chat in this workspace rather than a ship; agentId is then that chat's id.
|
|
26703
26754
|
chatId: external_exports.string().optional(),
|
|
26755
|
+
ticket: external_exports.object({ id: external_exports.string(), title: external_exports.string() }).optional(),
|
|
26704
26756
|
// Set on events recorded before every kind woke the orchestrator, which were shown as a row when they happened.
|
|
26705
26757
|
noticed: external_exports.boolean().optional()
|
|
26706
26758
|
});
|
|
@@ -34808,7 +34860,7 @@ var init_workspace_target = __esm({
|
|
|
34808
34860
|
});
|
|
34809
34861
|
|
|
34810
34862
|
// ../shared/src/mothership-board.ts
|
|
34811
|
-
var MOTHERSHIP_TICKET_LIMITS, L, tooLong, text3, clearable, httpsUrl, inlineMarkdown, markdown, linearIdentifier, mediaSchema, questionSchema, mothershipTicketTitleSchema, mothershipTicketTaskSchema, mothershipTicketMediaSchema, mothershipTicketQuestionsSchema, issueSchema, fixSchema, updateMothershipTicketRequestSchema, updateMothershipBoardRequestSchema, answerMothershipTicketRequestSchema, mothershipTicketAnswerRefSchema, LINEAR_ISSUE_SUMMARIES_MAX, linearIssueSummariesRequestSchema;
|
|
34863
|
+
var MOTHERSHIP_TICKET_LIMITS, L, tooLong, text3, clearable, httpsUrl, inlineMarkdown, markdown, linearIdentifier, mediaSchema, questionSchema, mothershipTicketTitleSchema, mothershipTicketTaskSchema, mothershipTicketMediaSchema, mothershipTicketQuestionsSchema, issueSchema, fixSchema, updateMothershipTicketRequestSchema, updateMothershipBoardRequestSchema, answerMothershipTicketRequestSchema, mothershipTicketAnswerRefSchema, replyOnMothershipTicketRequestSchema, mothershipTicketReplyRefSchema, mothershipTicketThreadSchema, LINEAR_ISSUE_SUMMARIES_MAX, linearIssueSummariesRequestSchema;
|
|
34812
34864
|
var init_mothership_board = __esm({
|
|
34813
34865
|
"../shared/src/mothership-board.ts"() {
|
|
34814
34866
|
"use strict";
|
|
@@ -34816,6 +34868,7 @@ var init_mothership_board = __esm({
|
|
|
34816
34868
|
init_mothership();
|
|
34817
34869
|
init_mothership_events();
|
|
34818
34870
|
init_urls();
|
|
34871
|
+
init_format();
|
|
34819
34872
|
MOTHERSHIP_TICKET_LIMITS = {
|
|
34820
34873
|
title: 80,
|
|
34821
34874
|
task: 1e3,
|
|
@@ -34830,7 +34883,8 @@ var init_mothership_board = __esm({
|
|
|
34830
34883
|
blocked: 200,
|
|
34831
34884
|
media: 6,
|
|
34832
34885
|
caption: 80,
|
|
34833
|
-
answer: 2e3
|
|
34886
|
+
answer: 2e3,
|
|
34887
|
+
reply: 600
|
|
34834
34888
|
};
|
|
34835
34889
|
L = MOTHERSHIP_TICKET_LIMITS;
|
|
34836
34890
|
tooLong = (max) => `At most ${max} characters. Keep it short; the user should take it in at a glance`;
|
|
@@ -34889,6 +34943,21 @@ var init_mothership_board = __esm({
|
|
|
34889
34943
|
answer: text3(L.answer)
|
|
34890
34944
|
});
|
|
34891
34945
|
mothershipTicketAnswerRefSchema = external_exports.object({ mothershipId: external_exports.uuid(), ticketId: external_exports.uuid(), questionId: external_exports.string().min(1) });
|
|
34946
|
+
replyOnMothershipTicketRequestSchema = external_exports.object({
|
|
34947
|
+
reply: text3(L.reply).describe(`Your answer to the user's latest message on the ticket, in a few sentences. ${markdown} Link a screenshot or recording uploaded with \`replicas media upload\` if it helps. At most ${L.reply} characters; keep longer detail in your chat.`),
|
|
34948
|
+
question: questionSchema.optional().describe("A follow-up question only if you need the user to decide something. It shows on the ticket with its options, and their answer comes back to you.")
|
|
34949
|
+
});
|
|
34950
|
+
mothershipTicketReplyRefSchema = external_exports.object({ ticketId: external_exports.uuid(), text: text3(L.answer) });
|
|
34951
|
+
mothershipTicketThreadSchema = external_exports.array(external_exports.object({
|
|
34952
|
+
id: external_exports.string(),
|
|
34953
|
+
from: external_exports.enum(["user", "ship"]),
|
|
34954
|
+
name: external_exports.string(),
|
|
34955
|
+
ship_id: external_exports.string(),
|
|
34956
|
+
chat_id: external_exports.string(),
|
|
34957
|
+
text: external_exports.string(),
|
|
34958
|
+
at: external_exports.string(),
|
|
34959
|
+
nudge: external_exports.enum(["sent", "missed"]).optional()
|
|
34960
|
+
}));
|
|
34892
34961
|
LINEAR_ISSUE_SUMMARIES_MAX = 50;
|
|
34893
34962
|
linearIssueSummariesRequestSchema = external_exports.object({ identifiers: external_exports.array(linearIdentifier).min(1).max(LINEAR_ISSUE_SUMMARIES_MAX) });
|
|
34894
34963
|
}
|
|
@@ -34999,6 +35068,7 @@ var init_steps = __esm({
|
|
|
34999
35068
|
[REPLICAS_MCP_TOOLS.getBoard]: { icon: "book", live: "Reading board", done: "Read board" },
|
|
35000
35069
|
[REPLICAS_MCP_TOOLS.updateBoard]: { icon: "file-pen", live: "Updating board", done: "Updated board" },
|
|
35001
35070
|
[REPLICAS_MCP_TOOLS.updateTicket]: { icon: "file-pen", live: "Updating ticket", done: "Updated ticket" },
|
|
35071
|
+
[REPLICAS_MCP_TOOLS.replyOnTicket]: { icon: "file-pen", live: "Replying on ticket", done: "Replied on ticket" },
|
|
35002
35072
|
[REPLICAS_MCP_TOOLS.sendToChat]: { icon: "message", live: "Sending to chat", done: "Sent to chat" },
|
|
35003
35073
|
[REPLICAS_MCP_TOOLS.mergeWhenReady]: { icon: "target", live: "Setting merge when ready", done: "Set merge when ready" }
|
|
35004
35074
|
};
|
|
@@ -38253,6 +38323,63 @@ var init_warm_hooks = __esm({
|
|
|
38253
38323
|
}
|
|
38254
38324
|
});
|
|
38255
38325
|
|
|
38326
|
+
// ../shared/src/environment-config.ts
|
|
38327
|
+
var variableNameSchema, mcpValueSchema, mcpValuesSchema, httpConfigSchema, replicasMcpDefinitionSchema, replicasEnvironmentConfigSchema;
|
|
38328
|
+
var init_environment_config = __esm({
|
|
38329
|
+
"../shared/src/environment-config.ts"() {
|
|
38330
|
+
"use strict";
|
|
38331
|
+
init_zod();
|
|
38332
|
+
init_environment();
|
|
38333
|
+
init_environment_setups();
|
|
38334
|
+
variableNameSchema = external_exports.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name");
|
|
38335
|
+
mcpValueSchema = external_exports.union([
|
|
38336
|
+
external_exports.string(),
|
|
38337
|
+
environmentMcpVariableReferenceSchema
|
|
38338
|
+
]);
|
|
38339
|
+
mcpValuesSchema = external_exports.record(external_exports.string(), mcpValueSchema);
|
|
38340
|
+
httpConfigSchema = environmentMcpHttpConfigSchema.pick({ url: true, auth: true }).extend({
|
|
38341
|
+
headers: mcpValuesSchema.default({})
|
|
38342
|
+
}).strict();
|
|
38343
|
+
replicasMcpDefinitionSchema = external_exports.discriminatedUnion("transport", [
|
|
38344
|
+
external_exports.strictObject({
|
|
38345
|
+
transport: external_exports.literal("stdio"),
|
|
38346
|
+
config: environmentMcpStdioConfigSchema.pick({ command: true }).extend({
|
|
38347
|
+
args: environmentMcpStdioConfigSchema.shape.args.unwrap().default([]),
|
|
38348
|
+
env: external_exports.record(variableNameSchema, mcpValueSchema).default({})
|
|
38349
|
+
}).strict()
|
|
38350
|
+
}),
|
|
38351
|
+
external_exports.strictObject({ transport: external_exports.literal("http"), config: httpConfigSchema }),
|
|
38352
|
+
external_exports.strictObject({ transport: external_exports.literal("sse"), config: httpConfigSchema })
|
|
38353
|
+
]).superRefine((definition, context) => {
|
|
38354
|
+
if (definition.transport === "stdio") return;
|
|
38355
|
+
const result = validateEnvironmentMcpAuthentication(definition.transport, definition.config);
|
|
38356
|
+
if (!result.ok) context.addIssue({ code: "custom", path: result.error.code === "transport" ? ["transport"] : ["config", result.error.code ?? "auth"], message: result.error.message });
|
|
38357
|
+
});
|
|
38358
|
+
replicasEnvironmentConfigSchema = external_exports.strictObject({
|
|
38359
|
+
systemPrompt: external_exports.string().optional(),
|
|
38360
|
+
warmHook: external_exports.string().optional(),
|
|
38361
|
+
startHook: external_exports.string().optional(),
|
|
38362
|
+
variables: external_exports.record(variableNameSchema, external_exports.string()).optional(),
|
|
38363
|
+
requiredSecrets: external_exports.array(variableNameSchema).optional(),
|
|
38364
|
+
mcps: external_exports.record(external_exports.string().regex(MCP_NAME_PATTERN, "must be 1\u201364 letters, digits, underscores or hyphens, starting with a letter or digit").refine((name) => !isReservedMcpName(name), "is reserved for Replicas"), replicasMcpDefinitionSchema).optional()
|
|
38365
|
+
}).superRefine((config3, context) => {
|
|
38366
|
+
const names = /* @__PURE__ */ new Set();
|
|
38367
|
+
for (const name of Object.keys(config3.mcps ?? {})) {
|
|
38368
|
+
const normalized = name.toLowerCase();
|
|
38369
|
+
if (names.has(normalized)) {
|
|
38370
|
+
context.addIssue({ code: "custom", path: ["mcps", name], message: "MCP names must be unique regardless of case" });
|
|
38371
|
+
}
|
|
38372
|
+
names.add(normalized);
|
|
38373
|
+
}
|
|
38374
|
+
for (const key of config3.requiredSecrets ?? []) {
|
|
38375
|
+
if (config3.variables && Object.hasOwn(config3.variables, key)) {
|
|
38376
|
+
context.addIssue({ code: "custom", path: ["requiredSecrets"], message: `"${key}" cannot also be declared as a non-secret variable` });
|
|
38377
|
+
}
|
|
38378
|
+
}
|
|
38379
|
+
});
|
|
38380
|
+
}
|
|
38381
|
+
});
|
|
38382
|
+
|
|
38256
38383
|
// ../shared/src/replicas-config.ts
|
|
38257
38384
|
var import_yaml2, REPLICAS_CONFIG_FILENAMES;
|
|
38258
38385
|
var init_replicas_config = __esm({
|
|
@@ -38260,6 +38387,7 @@ var init_replicas_config = __esm({
|
|
|
38260
38387
|
"use strict";
|
|
38261
38388
|
import_yaml2 = __toESM(require_dist());
|
|
38262
38389
|
init_warm_hooks();
|
|
38390
|
+
init_environment_config();
|
|
38263
38391
|
REPLICAS_CONFIG_FILENAMES = ["replicas.json", "replicas.yaml", "replicas.yml"];
|
|
38264
38392
|
}
|
|
38265
38393
|
});
|
|
@@ -38369,7 +38497,7 @@ var CLI_VERSION;
|
|
|
38369
38497
|
var init_cli_version = __esm({
|
|
38370
38498
|
"../shared/src/cli-version.ts"() {
|
|
38371
38499
|
"use strict";
|
|
38372
|
-
CLI_VERSION = "0.3.
|
|
38500
|
+
CLI_VERSION = "0.3.430";
|
|
38373
38501
|
}
|
|
38374
38502
|
});
|
|
38375
38503
|
|
|
@@ -49605,6 +49733,8 @@ var init_src = __esm({
|
|
|
49605
49733
|
init_image_attachments();
|
|
49606
49734
|
init_scout();
|
|
49607
49735
|
init_replicas_config();
|
|
49736
|
+
init_environment_config();
|
|
49737
|
+
init_environment_config_source();
|
|
49608
49738
|
init_warm_hooks();
|
|
49609
49739
|
init_hook_failure();
|
|
49610
49740
|
init_start_hook_network();
|
|
@@ -55630,6 +55760,95 @@ var init_gpu2 = __esm({
|
|
|
55630
55760
|
}
|
|
55631
55761
|
});
|
|
55632
55762
|
|
|
55763
|
+
// src/commands/environment-config.ts
|
|
55764
|
+
function printSource({ source }) {
|
|
55765
|
+
if (!source) {
|
|
55766
|
+
console.log("No Git configuration linked. Use replicas environment config link <env> --repository <name-or-id>.");
|
|
55767
|
+
return;
|
|
55768
|
+
}
|
|
55769
|
+
console.log(`${source.repository_name}/${source.filename} @ ${source.commit_sha}`);
|
|
55770
|
+
console.log(source.source_url);
|
|
55771
|
+
console.log(`Synced: ${source.synced_at}`);
|
|
55772
|
+
console.log(`Managed settings: ${source.managed.fields.join(", ") || "(none)"}`);
|
|
55773
|
+
console.log(`Managed variables: ${source.managed.variables.join(", ") || "(none)"}`);
|
|
55774
|
+
console.log(`Managed MCPs: ${source.managed.mcps.join(", ") || "(none)"}`);
|
|
55775
|
+
if (source.required_secrets.length) console.log(`Required secrets: ${source.required_secrets.join(", ")}`);
|
|
55776
|
+
if (source.pending_rebuild) console.log(import_chalk29.default.yellow("Configuration saved; environment rebuild pending."));
|
|
55777
|
+
if (source.last_error) console.log(import_chalk29.default.red(source.last_error));
|
|
55778
|
+
}
|
|
55779
|
+
function printPreview({ preview: preview2 }) {
|
|
55780
|
+
console.log(`${preview2.repository_name}/${preview2.filename} @ ${preview2.commit_sha}`);
|
|
55781
|
+
console.log(preview2.source_url);
|
|
55782
|
+
if (!preview2.changes.length) console.log("No setting changes. Applying records this commit.");
|
|
55783
|
+
for (const change of preview2.changes) console.log(` ${change.operation}: ${change.kind} ${change.key}`);
|
|
55784
|
+
if (preview2.missing_secrets.length) console.log(import_chalk29.default.yellow(`Missing required secrets: ${preview2.missing_secrets.join(", ")}`));
|
|
55785
|
+
for (const blocker of preview2.blockers) console.log(import_chalk29.default.red(` Cannot apply: ${blocker}`));
|
|
55786
|
+
}
|
|
55787
|
+
async function previewSource(id, repository) {
|
|
55788
|
+
const [repositoryId] = repository ? await resolveRepositoryIds([repository]) : [];
|
|
55789
|
+
return orgAuthenticatedFetch(`/v1/environments/${id}/config-source/preview`, {
|
|
55790
|
+
method: "POST",
|
|
55791
|
+
body: repositoryId ? { repository_id: repositoryId } : {}
|
|
55792
|
+
});
|
|
55793
|
+
}
|
|
55794
|
+
async function environmentConfigGetCommand(environment2) {
|
|
55795
|
+
ensureOrgApiAuthenticated();
|
|
55796
|
+
const id = await resolveEnvironmentId(environment2);
|
|
55797
|
+
output2(await orgAuthenticatedFetch(`/v1/environments/${id}/config-source`), printSource);
|
|
55798
|
+
}
|
|
55799
|
+
async function environmentConfigPreviewCommand(environment2, options) {
|
|
55800
|
+
ensureOrgApiAuthenticated();
|
|
55801
|
+
output2(await previewSource(await resolveEnvironmentId(environment2), options.repository), printPreview);
|
|
55802
|
+
}
|
|
55803
|
+
async function applySource(environment2, options, operation) {
|
|
55804
|
+
ensureOrgApiAuthenticated();
|
|
55805
|
+
const id = await resolveEnvironmentId(environment2);
|
|
55806
|
+
const response = await previewSource(id, options.repository);
|
|
55807
|
+
if (!isJsonMode()) printPreview(response);
|
|
55808
|
+
const { preview: preview2 } = response;
|
|
55809
|
+
if (preview2.blockers.length || preview2.missing_secrets.length) {
|
|
55810
|
+
throw new Error([
|
|
55811
|
+
...preview2.blockers,
|
|
55812
|
+
...preview2.missing_secrets.length ? [`Missing required secrets: ${preview2.missing_secrets.join(", ")}`] : []
|
|
55813
|
+
].join("; "));
|
|
55814
|
+
}
|
|
55815
|
+
if (!options.yes) {
|
|
55816
|
+
if (!isInteractive()) throw new Error("Preview the changes with replicas environment config preview, then pass --yes to apply without a terminal.");
|
|
55817
|
+
if (!await confirmAction(`${operation === "link" ? "Link and apply" : "Apply"} this configuration to ${environment2}?`)) return;
|
|
55818
|
+
}
|
|
55819
|
+
const body = { repository_id: preview2.repository_id, commit_sha: preview2.commit_sha, fingerprint: preview2.fingerprint };
|
|
55820
|
+
output2(await orgAuthenticatedFetch(`/v1/environments/${id}/config-source${operation === "sync" ? "/sync" : ""}`, { method: "POST", body }), printSource);
|
|
55821
|
+
}
|
|
55822
|
+
async function environmentConfigLinkCommand(environment2, options) {
|
|
55823
|
+
await applySource(environment2, options, "link");
|
|
55824
|
+
}
|
|
55825
|
+
async function environmentConfigSyncCommand(environment2, options) {
|
|
55826
|
+
await applySource(environment2, options, "sync");
|
|
55827
|
+
}
|
|
55828
|
+
async function environmentConfigDisconnectCommand(environment2, options) {
|
|
55829
|
+
ensureOrgApiAuthenticated();
|
|
55830
|
+
const id = await resolveEnvironmentId(environment2);
|
|
55831
|
+
if (!options.yes) {
|
|
55832
|
+
if (!isInteractive()) throw new Error("Pass --yes to disconnect without a terminal. Current settings will be preserved.");
|
|
55833
|
+
if (!await confirmAction(`Disconnect Git configuration for ${environment2}? Current settings will be preserved.`)) return;
|
|
55834
|
+
}
|
|
55835
|
+
output2(await orgAuthenticatedFetch(`/v1/environments/${id}/config-source`, { method: "DELETE" }), () => {
|
|
55836
|
+
console.log("Git configuration disconnected. Current settings preserved.");
|
|
55837
|
+
});
|
|
55838
|
+
}
|
|
55839
|
+
var import_chalk29;
|
|
55840
|
+
var init_environment_config2 = __esm({
|
|
55841
|
+
"src/commands/environment-config.ts"() {
|
|
55842
|
+
"use strict";
|
|
55843
|
+
import_chalk29 = __toESM(require("chalk"));
|
|
55844
|
+
init_api2();
|
|
55845
|
+
init_command_utils();
|
|
55846
|
+
init_output();
|
|
55847
|
+
init_environment3();
|
|
55848
|
+
init_repositories2();
|
|
55849
|
+
}
|
|
55850
|
+
});
|
|
55851
|
+
|
|
55633
55852
|
// src/commands/history.ts
|
|
55634
55853
|
async function historyTranscriptCommand(name) {
|
|
55635
55854
|
const session = name.trim().replace(/\.md$/, "");
|
|
@@ -55673,12 +55892,12 @@ async function skillsSuggestCommand(file2, options) {
|
|
|
55673
55892
|
async function skillsListCommand() {
|
|
55674
55893
|
output2(await orgAuthenticatedFetch("/v1/learned-skills"), ({ skills: skills2, suggestions }) => {
|
|
55675
55894
|
for (const skill of skills2) console.log(`${skill.id} ${skill.name} ${skill.title}`);
|
|
55676
|
-
if (suggestions.length > 0) console.log(
|
|
55895
|
+
if (suggestions.length > 0) console.log(import_chalk30.default.gray(`${suggestions.length} pending suggestion(s) to review in the dashboard.`));
|
|
55677
55896
|
});
|
|
55678
55897
|
}
|
|
55679
55898
|
async function skillsCreateCommand(file2, options) {
|
|
55680
55899
|
const body = { content: (0, import_node_fs4.readFileSync)(file2, "utf-8"), title: options.title };
|
|
55681
|
-
output2(await orgAuthenticatedFetch("/v1/learned-skills", { method: "POST", body }), ({ id, name }) => console.log(
|
|
55900
|
+
output2(await orgAuthenticatedFetch("/v1/learned-skills", { method: "POST", body }), ({ id, name }) => console.log(import_chalk30.default.green(`Saved learning '${name}' (${id})`)));
|
|
55682
55901
|
}
|
|
55683
55902
|
async function skillsUpdateCommand(id, options) {
|
|
55684
55903
|
const { skills: skills2 } = await orgAuthenticatedFetch("/v1/learned-skills");
|
|
@@ -55688,18 +55907,18 @@ async function skillsUpdateCommand(id, options) {
|
|
|
55688
55907
|
title: options.title ?? existing.title,
|
|
55689
55908
|
content: options.file ? (0, import_node_fs4.readFileSync)(options.file, "utf-8") : existing.content
|
|
55690
55909
|
};
|
|
55691
|
-
output2(await orgAuthenticatedFetch(`/v1/learned-skills/${existing.id}`, { method: "PUT", body }), ({ name }) => console.log(
|
|
55910
|
+
output2(await orgAuthenticatedFetch(`/v1/learned-skills/${existing.id}`, { method: "PUT", body }), ({ name }) => console.log(import_chalk30.default.green(`Updated learning '${name}'`)));
|
|
55692
55911
|
}
|
|
55693
55912
|
async function skillsDeleteCommand(id) {
|
|
55694
55913
|
await orgAuthenticatedFetch(`/v1/learned-skills/${id}`, { method: "DELETE" });
|
|
55695
55914
|
outputSuccess(`Deleted learning ${id}`);
|
|
55696
55915
|
}
|
|
55697
|
-
var import_node_fs4,
|
|
55916
|
+
var import_node_fs4, import_chalk30;
|
|
55698
55917
|
var init_skills = __esm({
|
|
55699
55918
|
"src/commands/skills.ts"() {
|
|
55700
55919
|
"use strict";
|
|
55701
55920
|
import_node_fs4 = require("fs");
|
|
55702
|
-
|
|
55921
|
+
import_chalk30 = __toESM(require("chalk"));
|
|
55703
55922
|
init_agent_api();
|
|
55704
55923
|
init_api2();
|
|
55705
55924
|
init_monolith_url();
|
|
@@ -55725,10 +55944,10 @@ async function attachThread(request) {
|
|
|
55725
55944
|
body: request
|
|
55726
55945
|
});
|
|
55727
55946
|
output2(response, ({ thread, workspace }) => {
|
|
55728
|
-
console.log(
|
|
55729
|
-
console.log(
|
|
55730
|
-
console.log(
|
|
55731
|
-
console.log(
|
|
55947
|
+
console.log(import_chalk31.default.green("Slack thread attached."));
|
|
55948
|
+
console.log(import_chalk31.default.gray(` Channel: ${thread.channel_id}`));
|
|
55949
|
+
console.log(import_chalk31.default.gray(` Thread: ${thread.thread_ts}`));
|
|
55950
|
+
console.log(import_chalk31.default.gray(` Workspace: ${workspace.name} (${workspace.id})`));
|
|
55732
55951
|
});
|
|
55733
55952
|
}
|
|
55734
55953
|
async function slackThreadAttachCommand(options) {
|
|
@@ -55756,11 +55975,11 @@ async function slackThreadSwitchCommand(workspace, options) {
|
|
|
55756
55975
|
workspace_id: workspaceId
|
|
55757
55976
|
});
|
|
55758
55977
|
}
|
|
55759
|
-
var
|
|
55978
|
+
var import_chalk31;
|
|
55760
55979
|
var init_slack4 = __esm({
|
|
55761
55980
|
"src/commands/slack.ts"() {
|
|
55762
55981
|
"use strict";
|
|
55763
|
-
|
|
55982
|
+
import_chalk31 = __toESM(require("chalk"));
|
|
55764
55983
|
init_api2();
|
|
55765
55984
|
init_config();
|
|
55766
55985
|
init_output();
|
|
@@ -55915,7 +56134,7 @@ async function serviceListCommand() {
|
|
|
55915
56134
|
return;
|
|
55916
56135
|
}
|
|
55917
56136
|
for (const service of services) {
|
|
55918
|
-
const status = service.running ?
|
|
56137
|
+
const status = service.running ? import_chalk32.default.green("running") : import_chalk32.default.red("stopped");
|
|
55919
56138
|
console.log(`${service.name} ${status} pid ${service.pid} started ${service.startedAt}`);
|
|
55920
56139
|
console.log(` command: ${service.command} (cwd: ${service.cwd})`);
|
|
55921
56140
|
console.log(` logs: ${service.logFile}`);
|
|
@@ -55935,11 +56154,11 @@ async function serviceLogsCommand(name, options) {
|
|
|
55935
56154
|
console.log(logs || "(no log output yet)");
|
|
55936
56155
|
});
|
|
55937
56156
|
}
|
|
55938
|
-
var
|
|
56157
|
+
var import_chalk32, import_node_child_process3, import_node_fs5, import_node_os3, import_node_path4, SERVICES_DIR, NAME_PATTERN, LOG_KEEP_BYTES, LOG_TRIM_LOOP;
|
|
55939
56158
|
var init_service = __esm({
|
|
55940
56159
|
"src/commands/service.ts"() {
|
|
55941
56160
|
"use strict";
|
|
55942
|
-
|
|
56161
|
+
import_chalk32 = __toESM(require("chalk"));
|
|
55943
56162
|
import_node_child_process3 = require("child_process");
|
|
55944
56163
|
import_node_fs5 = require("fs");
|
|
55945
56164
|
import_node_os3 = require("os");
|
|
@@ -55996,7 +56215,7 @@ async function deviceConnectCommand() {
|
|
|
55996
56215
|
stream.destroy();
|
|
55997
56216
|
};
|
|
55998
56217
|
sshd.once("error", (error62) => {
|
|
55999
|
-
console.log(
|
|
56218
|
+
console.log(import_chalk33.default.yellow(`A workspace couldn't reach SSH on port ${port} here (${error62.message}). ${REMOTE_LOGIN_HINT}`));
|
|
56000
56219
|
});
|
|
56001
56220
|
sshd.on("error", close).on("close", close);
|
|
56002
56221
|
stream.on("error", close).on("close", close);
|
|
@@ -56040,16 +56259,16 @@ async function deviceConnectCommand() {
|
|
|
56040
56259
|
}
|
|
56041
56260
|
}
|
|
56042
56261
|
const next = problem ?? `\u2713 ${device?.name}: ready for ${waiting.size} ${waiting.size === 1 ? "workspace" : "workspaces"}, forwarding to SSH on port ${port}`;
|
|
56043
|
-
if (next !== summary) console.log(problem ?
|
|
56262
|
+
if (next !== summary) console.log(problem ? import_chalk33.default.yellow(next) : import_chalk33.default.green(next));
|
|
56044
56263
|
summary = next;
|
|
56045
56264
|
await (0, import_promises2.setTimeout)(POLL_INTERVAL_MS);
|
|
56046
56265
|
}
|
|
56047
56266
|
}
|
|
56048
|
-
var
|
|
56267
|
+
var import_chalk33, import_node_child_process4, import_node_net, import_promises2, import_node_util, import_ws, POLL_INTERVAL_MS, HEARTBEAT_MS, MAX_RETRY_DELAY_MS, REMOTE_LOGIN_HINT;
|
|
56049
56268
|
var init_device = __esm({
|
|
56050
56269
|
"src/commands/device.ts"() {
|
|
56051
56270
|
"use strict";
|
|
56052
|
-
|
|
56271
|
+
import_chalk33 = __toESM(require("chalk"));
|
|
56053
56272
|
import_node_child_process4 = require("child_process");
|
|
56054
56273
|
import_node_net = require("net");
|
|
56055
56274
|
import_promises2 = require("timers/promises");
|
|
@@ -56080,8 +56299,8 @@ async function localControlRequestCommand(options) {
|
|
|
56080
56299
|
await orgAuthenticatedFetch("/v1/local-control-request", { method: "DELETE" });
|
|
56081
56300
|
output2({ status: "connected", computers: computers2 }, () => {
|
|
56082
56301
|
console.log(`
|
|
56083
|
-
${
|
|
56084
|
-
console.log(
|
|
56302
|
+
${import_chalk34.default.green("Connected:")} ${computers2.join(", ")}`);
|
|
56303
|
+
console.log(import_chalk34.default.gray(` Run commands there with: ssh ${computers2[0]} '<command>'
|
|
56085
56304
|
`));
|
|
56086
56305
|
});
|
|
56087
56306
|
};
|
|
@@ -56109,10 +56328,10 @@ async function localControlRequestCommand(options) {
|
|
|
56109
56328
|
}
|
|
56110
56329
|
output2({ status: pending ? "pending" : "declined", computers: [], url: created.url }, () => {
|
|
56111
56330
|
if (!pending) {
|
|
56112
|
-
console.log(
|
|
56331
|
+
console.log(import_chalk34.default.yellow("\n The user declined. Continue without their computer, or ask how they want to proceed.\n"));
|
|
56113
56332
|
return;
|
|
56114
56333
|
}
|
|
56115
|
-
console.log(
|
|
56334
|
+
console.log(import_chalk34.default.gray(options.wait === false ? `
|
|
56116
56335
|
Asked above the chat composer (${created.url}). Keep working, and run this command again when you need the computer.
|
|
56117
56336
|
` : created.wait ? `
|
|
56118
56337
|
The request stays open above the chat composer (${created.url}). End your turn and say what you need the computer for. When the user answers, you get a message; run this command again then.
|
|
@@ -56122,7 +56341,7 @@ async function localControlRequestCommand(options) {
|
|
|
56122
56341
|
`));
|
|
56123
56342
|
});
|
|
56124
56343
|
}
|
|
56125
|
-
var import_child_process6, import_fs11, import_os5, import_path10, import_util10,
|
|
56344
|
+
var import_child_process6, import_fs11, import_os5, import_path10, import_util10, import_chalk34, execFileAsync2;
|
|
56126
56345
|
var init_local_control = __esm({
|
|
56127
56346
|
"src/commands/local-control.ts"() {
|
|
56128
56347
|
"use strict";
|
|
@@ -56131,7 +56350,7 @@ var init_local_control = __esm({
|
|
|
56131
56350
|
import_os5 = __toESM(require("os"));
|
|
56132
56351
|
import_path10 = __toESM(require("path"));
|
|
56133
56352
|
import_util10 = require("util");
|
|
56134
|
-
|
|
56353
|
+
import_chalk34 = __toESM(require("chalk"));
|
|
56135
56354
|
init_src();
|
|
56136
56355
|
init_api2();
|
|
56137
56356
|
init_command_utils();
|
|
@@ -56173,7 +56392,7 @@ function registerEnvironmentHookCommands(parent, config3) {
|
|
|
56173
56392
|
}
|
|
56174
56393
|
hooks.command("repository-hooks <env>").description(`List per-repo ${config3.kind} hooks defined in replicas.json / replicas.yaml`).action(run(config3.repositoryHooks));
|
|
56175
56394
|
}
|
|
56176
|
-
var import_config20, import_commander, collect, program, organizationOptionalCommands, interactiveCommands, org, config2, chat, chatQueue, share, pr, canvas, credentials, automation, repos, plugins, skills, media, environment, envVars, envFiles, envSkills, envMcps, parsePortOption, envDevices, envWarmPool, preview, authenticatedPreviewHelp;
|
|
56395
|
+
var import_config20, import_commander, collect, program, organizationOptionalCommands, interactiveCommands, org, config2, chat, chatQueue, share, pr, canvas, credentials, automation, repos, plugins, skills, media, environment, envConfig, envVars, envFiles, envSkills, envMcps, parsePortOption, envDevices, envWarmPool, preview, authenticatedPreviewHelp;
|
|
56177
56396
|
var init_src2 = __esm({
|
|
56178
56397
|
"src/index.ts"() {
|
|
56179
56398
|
"use strict";
|
|
@@ -56206,6 +56425,7 @@ var init_src2 = __esm({
|
|
|
56206
56425
|
init_media_gif();
|
|
56207
56426
|
init_visualize();
|
|
56208
56427
|
init_gpu2();
|
|
56428
|
+
init_environment_config2();
|
|
56209
56429
|
init_history();
|
|
56210
56430
|
init_skills();
|
|
56211
56431
|
init_slack4();
|
|
@@ -56374,6 +56594,12 @@ var init_src2 = __esm({
|
|
|
56374
56594
|
environment.command("create [name]").description("Create a new environment").option("-d, --description <description>", "Environment description").option("-r, --repository <names>", "Repositories to clone (comma-separated names or IDs)").option("--system-prompt <prompt>", "System prompt for agents started in this environment").action(run(environmentCreateCommand));
|
|
56375
56595
|
environment.command("edit <id-or-name>").description("Edit an environment").option("-n, --name <name>", "New name").option("-d, --description <description>", "New description").option("-r, --repository <names>", "Replace the repositories (comma-separated names or IDs; empty string for none)").option("--system-prompt <prompt>", "System prompt").action(run(environmentEditCommand));
|
|
56376
56596
|
environment.command("delete <id-or-name>").description("Delete an environment").option("-f, --force", "Skip confirmation prompt").action(run(environmentDeleteCommand));
|
|
56597
|
+
envConfig = environment.command("config").description("Link and sync environment configuration from Git");
|
|
56598
|
+
envConfig.command("get <env>").description("Show the linked configuration source and sync status").action(run(environmentConfigGetCommand));
|
|
56599
|
+
envConfig.command("preview <env>").description("Preview committed configuration changes without applying them").option("-r, --repository <name-or-id>", "Repository containing the configuration").action(run(environmentConfigPreviewCommand));
|
|
56600
|
+
envConfig.command("link <env>").description("Preview, link, and apply configuration from a repository").option("-r, --repository <name-or-id>", "Repository containing the configuration").option("-y, --yes", "Apply the preview without a confirmation prompt").action(run(environmentConfigLinkCommand));
|
|
56601
|
+
envConfig.command("sync <env>").description("Preview and apply changes from the linked configuration").option("-y, --yes", "Apply the preview without a confirmation prompt").action(run(environmentConfigSyncCommand));
|
|
56602
|
+
envConfig.command("disconnect <env>").description("Disconnect Git configuration and preserve current settings").option("-y, --yes", "Disconnect without a confirmation prompt").action(run(environmentConfigDisconnectCommand));
|
|
56377
56603
|
envVars = environment.command("vars").description("Manage environment variables");
|
|
56378
56604
|
envVars.command("list <env>").description("List variables in an environment (values masked by default)").option("--reveal", "Show full variable values instead of masking them").action(run(envVarsListCommand));
|
|
56379
56605
|
envVars.command("set <env> <key> <value>").description("Create or update a variable").action(run(envVarsSetCommand));
|
|
@@ -56538,11 +56764,11 @@ ${VISUAL_PAGE_RULES}`).action(run(visualizeCommand));
|
|
|
56538
56764
|
|
|
56539
56765
|
// src/bin.ts
|
|
56540
56766
|
var import_node_child_process5 = require("child_process");
|
|
56541
|
-
var
|
|
56767
|
+
var import_chalk35 = __toESM(require("chalk"));
|
|
56542
56768
|
init_config();
|
|
56543
56769
|
if (process.argv[2] === "computer" && isAgentMode()) {
|
|
56544
56770
|
const result = (0, import_node_child_process5.spawnSync)("replicas-computer", process.argv.slice(3), { stdio: "inherit" });
|
|
56545
|
-
if (result.error) console.error(
|
|
56771
|
+
if (result.error) console.error(import_chalk35.default.red(`
|
|
56546
56772
|
\u2717 replicas-computer is unavailable in this workspace image
|
|
56547
56773
|
`));
|
|
56548
56774
|
process.exitCode = result.error ? 1 : result.status ?? 1;
|