replicas-cli 0.3.429 → 0.3.431
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 +449 -242
- 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 = {
|
|
@@ -23205,6 +23451,8 @@ var init_replicas_mcp = __esm({
|
|
|
23205
23451
|
...updateEnvironmentMcpRequestSchema.shape
|
|
23206
23452
|
});
|
|
23207
23453
|
createEnvironmentDeviceToolInputSchema = external_exports.object({ ...environmentMcpPath, ...createEnvironmentDeviceRequestSchema.shape });
|
|
23454
|
+
previewEnvironmentConfigSourceToolInputSchema = external_exports.object({ ...environmentMcpPath, ...previewEnvironmentConfigSourceRequestSchema.shape });
|
|
23455
|
+
applyEnvironmentConfigSourceToolInputSchema = external_exports.object({ ...environmentMcpPath, ...applyEnvironmentConfigSourceRequestSchema.shape });
|
|
23208
23456
|
}
|
|
23209
23457
|
});
|
|
23210
23458
|
|
|
@@ -23257,7 +23505,7 @@ var init_scout_settings = __esm({
|
|
|
23257
23505
|
SCOUT_SETTINGS_SKILL_NAME = "scout-settings";
|
|
23258
23506
|
CONTENT = `---
|
|
23259
23507
|
name: ${SCOUT_SETTINGS_SKILL_NAME}
|
|
23260
|
-
description: Use when someone asks what Replicas can do or what they can change ("what can you do?", "what can I change here?"), asks to change or explain how Replicas behaves in Slack or Linear (channel levels, "be quieter", "only reply when tagged", mute, channel or team instructions, presets, monitored Linear teams, Slack Connect defaults, Slack agent defaults), when someone is annoyed that Scout replied unasked ("not you", "nobody asked", a thumbs-down), when making or answering a settings or automation offer, or when setting up an automation. Not for routing ordinary requests.
|
|
23508
|
+
description: Use when someone asks what Replicas can do or what they can change ("what can you do?", "what can I change here?"), asks to change or explain how Replicas behaves in Slack or Linear (channel levels, "be quieter", "only reply when tagged", silent mode, mute, channel or team instructions, presets, monitored Linear teams, Slack Connect defaults, Slack agent defaults), when someone is annoyed that Scout replied unasked ("not you", "nobody asked", a thumbs-down), when making or answering a settings or automation offer, or when setting up an automation. Not for routing ordinary requests.
|
|
23261
23509
|
---
|
|
23262
23510
|
|
|
23263
23511
|
# Scout settings
|
|
@@ -23269,10 +23517,10 @@ There is no settings page: people change how Replicas behaves by asking you, and
|
|
|
23269
23517
|
| --- | --- | --- |
|
|
23270
23518
|
| How much you speak up in a channel or group DM (Mentions only, Low, Balanced, High) | \`${REPLICAS_MCP_TOOLS.updateChannelSettings}\` \`proactivity\` | Any member, except that raising one from Mentions only needs an admin |
|
|
23271
23519
|
| How much you speak up in every channel | \`${REPLICAS_MCP_TOOLS.setOrganizationProactivity}\` | Admin |
|
|
23272
|
-
|
|
|
23520
|
+
| Silent mode for a channel, also asked as muting you there (you still read it and follow its instructions, but never post there) | \`${REPLICAS_MCP_TOOLS.updateChannelSettings}\` \`silent\` | Admin |
|
|
23273
23521
|
| Instructions for a channel or Linear team, such as "file bugs in Linear and post them in #triage", "send actionable messages to App Support", or "mobile requests go to the mobile-ios environment" | \`${REPLICAS_MCP_TOOLS.updateChannelSettings}\` \`instructions\` | Any member |
|
|
23274
23522
|
| Create, edit, or delete a preset (reusable instructions), or assign one | \`${REPLICAS_MCP_TOOLS.saveChannelPreset}\`, \`${REPLICAS_MCP_TOOLS.deleteChannelPreset}\`, \`${REPLICAS_MCP_TOOLS.updateChannelSettings}\` \`preset_id\` | Any member |
|
|
23275
|
-
| Defaults for every channel shared with another company: preset, instructions, level,
|
|
23523
|
+
| Defaults for every channel shared with another company: preset, instructions, level, silent mode | \`${REPLICAS_MCP_TOOLS.setSlackConnectDefaults}\` | Admin |
|
|
23276
23524
|
| Triage new issues in a Linear team, or stop | \`${REPLICAS_MCP_TOOLS.updateChannelSettings}\` \`source: linear\`, \`monitored\` | Admin starts; any member stops |
|
|
23277
23525
|
| Agent, model, thinking level, goal mode, and fast mode for tasks started from Slack | \`${REPLICAS_MCP_TOOLS.setSlackAgentDefaults}\` | Admin |
|
|
23278
23526
|
| Stay quiet in this thread, or come back | \`${REPLICAS_MCP_TOOLS.setThreadMuted}\` | Anyone in the thread |
|
|
@@ -23282,7 +23530,7 @@ You also answer questions, start a workspace for a task (in a separate thread wh
|
|
|
23282
23530
|
|
|
23283
23531
|
A person's own defaults (agent, model, environment) and the organization's general defaults are changed in the Replicas app, not by you; Slack tasks use them unless the Slack agent defaults above say otherwise.
|
|
23284
23532
|
|
|
23285
|
-
You can't add yourself to or remove yourself from a channel: people type \`/invite @Replicas\` or \`/remove @Replicas\` there, and an admin can pick channels under Integrations, Slack, Configure. To keep you in a channel but out of the way, lower it to Mentions only or
|
|
23533
|
+
You can't add yourself to or remove yourself from a channel: people type \`/invite @Replicas\` or \`/remove @Replicas\` there, and an admin can pick channels under Integrations, Slack, Configure. To keep you in a channel but out of the way, lower it to Mentions only or put it in silent mode. A channel becomes a Mothership's own channel from that Mothership, not here; any channel's instructions can still send its messages to a Mothership.
|
|
23286
23534
|
|
|
23287
23535
|
## Tools
|
|
23288
23536
|
Read presets, channel instructions, and levels with \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`. Change them with \`${REPLICAS_MCP_TOOLS.updateChannelSettings}\`, \`${REPLICAS_MCP_TOOLS.saveChannelPreset}\`, \`${REPLICAS_MCP_TOOLS.deleteChannelPreset}\`, \`${REPLICAS_MCP_TOOLS.setOrganizationProactivity}\`, \`${REPLICAS_MCP_TOOLS.setSlackConnectDefaults}\`, or \`${REPLICAS_MCP_TOOLS.setSlackAgentDefaults}\`. Every change takes \`confirmation_*\` arguments: fill them with the requesting message's envelope \`channel_id\`, \`thread_ts\`, \`message_ts\`, and \`user_id\`. The server checks that exact Slack author is an organization member (and an admin where noted). If it refuses, say why briefly and change nothing.
|
|
@@ -23293,11 +23541,12 @@ Read presets, channel instructions, and levels with \`${REPLICAS_MCP_TOOLS.listC
|
|
|
23293
23541
|
- The organization has one level for its whole Slack workspace, which only an admin can set with \`${REPLICAS_MCP_TOOLS.setOrganizationProactivity}\`. A channel or group DM can override it with \`${REPLICAS_MCP_TOOLS.updateChannelSettings}\` and \`proactivity\`. 1:1 DMs are always addressed to you. Any member can lower a channel; raising one above \`tagged\` needs an admin.
|
|
23294
23542
|
- A request that points at a channel ("here", "in #eng", "stop replying in #random") changes that channel only. One that doesn't ("only respond when I @ you", "don't auto-reply to Slack messages") means the organization level. When it names a channel, even without "#" ("make support-inbound quieter"), find it with \`conversations.list\` and change that one, not the one you were asked in; ask if none or several match. If a non-admin asks for an organization change, say an organization admin has to ask, and offer the channel-only change when they asked from a channel. Instructions don't substitute for a level.
|
|
23295
23543
|
- **Instructions and presets:** prefer changing the channel's own instructions; edit a shared preset only when asked, since every channel using it changes. To set up a channel without being told how, read enough of it to propose short instructions or a fitting preset (customer, vendor, internal team), and save nothing until they confirm. Never infer a channel's purpose only because Slack marks it externally shared.
|
|
23544
|
+
- **Silent mode** is what people mean by muting you in a channel. A channel in silent mode still reaches you as its level allows, and you follow its instructions anywhere but there. For "watch #alerts and report to #team", an admin turns on \`silent\` for the watched channel, raises it to Balanced or High so untagged messages reach you, and its instructions name where to report. It is separate from a thread mute, which lasts hours and only quiets one thread.
|
|
23296
23545
|
- **Linear teams:** set \`monitored: true\` to start triaging a team (admin only) and \`monitored: false\` to stop. Teams take a preset or instructions like channels.
|
|
23297
23546
|
- **Slack Connect** channels shared with another company follow the organization's shared-channel defaults (\`tagged\` with no preset unless an admin set them with \`${REPLICAS_MCP_TOOLS.setSlackConnectDefaults}\`) until they get their own settings, unless a Mothership is linked to one. A request about all shared or customer channels changes only those defaults: leave channels with their own settings as they are, list them, and offer to switch them too. Asked why you stay quiet in one, say it's external and an admin can ask you to raise its level.
|
|
23298
23547
|
- **Slack agent defaults:** to change the agent, model, thinking level, goal mode, or fast mode for tasks started from Slack ("use Codex for Slack tasks"), call \`${REPLICAS_MCP_TOOLS.setSlackAgentDefaults}\` (admin only).
|
|
23299
23548
|
- **"What can you do?"** Keep it short: one line on what you do (answer questions, start a workspace for a task, hand work to a Mothership, file Linear tickets, set up recurring tasks), two or three example requests in backticks drawn from both work and behavior (like \`fix the flaky login test\`, \`only reply here when tagged\`, \`every Monday, summarize open PRs\`), then "Ask me what you can change here to see every setting." No settings list or current values.
|
|
23300
|
-
- **"What can I change?"** Read the current settings, then reply in a few short lines from **What you can do**: what applies here with its current value (this channel's level,
|
|
23549
|
+
- **"What can I change?"** Read the current settings, then reply in a few short lines from **What you can do**: what applies here with its current value (this channel's level, silent mode, instructions or preset), then what applies everywhere (the every-channel level, shared-channel defaults, Linear teams, Slack agent defaults), marking what needs an admin. Give one example phrasing, like "only reply here when tagged".
|
|
23301
23550
|
- After any change, say what changed and its scope ("every channel", or "#eng only"). Confirm only after the tool succeeded and only what it changed; say so when it failed or did less than asked.
|
|
23302
23551
|
|
|
23303
23552
|
## Offers
|
|
@@ -23670,207 +23919,6 @@ until docker info >/dev/null 2>&1; do sleep 0.2; done
|
|
|
23670
23919
|
}
|
|
23671
23920
|
});
|
|
23672
23921
|
|
|
23673
|
-
// ../shared/src/format.ts
|
|
23674
|
-
function relativeParts(input2, now = Date.now()) {
|
|
23675
|
-
const then = new Date(input2).getTime();
|
|
23676
|
-
if (Number.isNaN(then)) return null;
|
|
23677
|
-
const seconds = Math.max(0, Math.floor((now - then) / 1e3));
|
|
23678
|
-
const minutes = Math.floor(seconds / 60);
|
|
23679
|
-
const hours = Math.floor(minutes / 60);
|
|
23680
|
-
const days = Math.floor(hours / 24);
|
|
23681
|
-
const months = Math.floor(days / 30);
|
|
23682
|
-
return { then, seconds, minutes, hours, days, months, years: Math.floor(months / 12) };
|
|
23683
|
-
}
|
|
23684
|
-
function compactTimeAgo(input2, options) {
|
|
23685
|
-
const p = relativeParts(input2, options?.now);
|
|
23686
|
-
if (!p) return "";
|
|
23687
|
-
if (p.seconds < 60) return options?.seconds === false ? "now" : `${p.seconds}s`;
|
|
23688
|
-
if (p.minutes < 60) return `${p.minutes}m`;
|
|
23689
|
-
if (p.hours < 24) return `${p.hours}h`;
|
|
23690
|
-
if (p.days < 30) return `${p.days}d`;
|
|
23691
|
-
if (p.months < 12) return `${p.months}mo`;
|
|
23692
|
-
return `${p.years}y`;
|
|
23693
|
-
}
|
|
23694
|
-
function formatCompactRelativeTime(input2, now = Date.now()) {
|
|
23695
|
-
const then = new Date(input2).getTime();
|
|
23696
|
-
if (Number.isNaN(then)) return "";
|
|
23697
|
-
if (Math.abs(then - now) < 6e4) return "just now";
|
|
23698
|
-
const future = then > now;
|
|
23699
|
-
const compact = compactTimeAgo(future ? now - (then - now) : then, { now });
|
|
23700
|
-
return future ? `in ${compact}` : `${compact} ago`;
|
|
23701
|
-
}
|
|
23702
|
-
var init_format = __esm({
|
|
23703
|
-
"../shared/src/format.ts"() {
|
|
23704
|
-
"use strict";
|
|
23705
|
-
}
|
|
23706
|
-
});
|
|
23707
|
-
|
|
23708
|
-
// ../shared/src/routes/environment-setups.ts
|
|
23709
|
-
function isEnvironmentSetupStepKey(value) {
|
|
23710
|
-
return ENVIRONMENT_SETUP_STEPS.some((step) => step.key === value);
|
|
23711
|
-
}
|
|
23712
|
-
function isEnvironmentSetupStepStatus(value) {
|
|
23713
|
-
return ENVIRONMENT_SETUP_STEP_STATUSES.some((status) => status === value);
|
|
23714
|
-
}
|
|
23715
|
-
function isEnvironmentSetupAuthoredTriggerType(type) {
|
|
23716
|
-
return ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES.some((authored) => authored === type);
|
|
23717
|
-
}
|
|
23718
|
-
function automationSchema(limits) {
|
|
23719
|
-
const authored = external_exports.object({
|
|
23720
|
-
name: text2(limits.nameChars),
|
|
23721
|
-
description: text2(limits.descriptionChars),
|
|
23722
|
-
prompt: text2(limits.automationPromptChars),
|
|
23723
|
-
triggers: list(proposalTriggerSchema, limits.automationTriggers)
|
|
23724
|
-
});
|
|
23725
|
-
const updated = authored.extend({ triggers: list(external_exports.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
|
|
23726
|
-
return external_exports.object({
|
|
23727
|
-
key: requiredText(limits.automationKeyChars),
|
|
23728
|
-
action: external_exports.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
|
|
23729
|
-
automation_id: external_exports.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
|
|
23730
|
-
name: text2().default(""),
|
|
23731
|
-
description: optionalText2().transform((value) => value ?? ""),
|
|
23732
|
-
prompt: text2().default(""),
|
|
23733
|
-
triggers: list(existingTriggerSchema).default([]),
|
|
23734
|
-
note: optionalText2(limits.automationNoteChars)
|
|
23735
|
-
}).superRefine((automation2, ctx) => {
|
|
23736
|
-
if (automation2.action === "create" && automation2.automation_id) {
|
|
23737
|
-
ctx.addIssue({ code: "custom", path: ["automation_id"], message: "belongs on an update, keep, or disable entry" });
|
|
23738
|
-
}
|
|
23739
|
-
if (automation2.action !== "create" && !automation2.automation_id) {
|
|
23740
|
-
ctx.addIssue({ code: "custom", path: ["automation_id"], message: "must be the id of an automation attached to this environment" });
|
|
23741
|
-
}
|
|
23742
|
-
if (automation2.action === "create" || automation2.action === "update") {
|
|
23743
|
-
if (!automation2.name) ctx.addIssue({ code: "custom", path: ["name"], message: "must not be empty" });
|
|
23744
|
-
if (!automation2.prompt) ctx.addIssue({ code: "custom", path: ["prompt"], message: "must not be empty" });
|
|
23745
|
-
if (automation2.triggers.length === 0) ctx.addIssue({ code: "custom", path: ["triggers"], message: "must not be empty" });
|
|
23746
|
-
}
|
|
23747
|
-
}).transform((automation2, ctx) => {
|
|
23748
|
-
if (automation2.action === "keep" || automation2.action === "disable") return automation2;
|
|
23749
|
-
const content = (automation2.action === "update" ? updated : authored).safeParse(automation2);
|
|
23750
|
-
if (content.success) return { ...automation2, ...content.data };
|
|
23751
|
-
for (const issue2 of content.error.issues) ctx.addIssue({ ...issue2, code: "custom" });
|
|
23752
|
-
return external_exports.NEVER;
|
|
23753
|
-
});
|
|
23754
|
-
}
|
|
23755
|
-
function automationListSchema(limits) {
|
|
23756
|
-
return list(automationSchema(limits)).default([]).superRefine((automations, ctx) => {
|
|
23757
|
-
if (new Set(automations.map((automation2) => automation2.key)).size !== automations.length) {
|
|
23758
|
-
ctx.addIssue({ code: "custom", message: "must have unique keys" });
|
|
23759
|
-
}
|
|
23760
|
-
const targets = automations.flatMap((automation2) => automation2.automation_id ?? []);
|
|
23761
|
-
if (new Set(targets).size !== targets.length) {
|
|
23762
|
-
ctx.addIssue({ code: "custom", message: "must mention each existing automation once" });
|
|
23763
|
-
}
|
|
23764
|
-
if (limits.automations !== void 0 && automations.filter((automation2) => automation2.action === "create").length > limits.automations) {
|
|
23765
|
-
ctx.addIssue({ code: "custom", message: `must create at most ${limits.automations} new automations` });
|
|
23766
|
-
}
|
|
23767
|
-
});
|
|
23768
|
-
}
|
|
23769
|
-
function environmentSchema(limits) {
|
|
23770
|
-
return external_exports.object({
|
|
23771
|
-
name: optionalText2(limits.nameChars).transform((value) => value ?? void 0),
|
|
23772
|
-
description: clearableText(limits.descriptionChars),
|
|
23773
|
-
system_prompt: clearableText(limits.systemPromptChars),
|
|
23774
|
-
start_hook: clearableText(limits.hookChars),
|
|
23775
|
-
warm_hook: clearableText(limits.hookChars)
|
|
23776
|
-
});
|
|
23777
|
-
}
|
|
23778
|
-
function proposalSchema(limits) {
|
|
23779
|
-
return external_exports.object({
|
|
23780
|
-
summary: requiredText(limits.summaryChars),
|
|
23781
|
-
stack: list(text2(), limits.stackItems).default([]).transform((items) => items.filter(Boolean)),
|
|
23782
|
-
environment: environmentSchema(limits),
|
|
23783
|
-
variables: list(external_exports.object({
|
|
23784
|
-
key: external_exports.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
|
|
23785
|
-
description: optionalText2(limits.variableDescriptionChars).transform((value) => value ?? ""),
|
|
23786
|
-
required: external_exports.boolean().default(false)
|
|
23787
|
-
}), limits.variables).default([]),
|
|
23788
|
-
automations: automationListSchema(limits),
|
|
23789
|
-
verification: list(external_exports.object({
|
|
23790
|
-
label: requiredText(limits.nameChars),
|
|
23791
|
-
status: external_exports.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
|
|
23792
|
-
detail: optionalText2(limits.verificationDetailChars).transform((value) => value ?? void 0)
|
|
23793
|
-
}), limits.verificationItems).default([]),
|
|
23794
|
-
media: list(external_exports.object({
|
|
23795
|
-
media_id: external_exports.string().regex(UUID_RE, "must be a media id"),
|
|
23796
|
-
title: requiredText(limits.nameChars)
|
|
23797
|
-
}), limits.mediaItems).default([])
|
|
23798
|
-
});
|
|
23799
|
-
}
|
|
23800
|
-
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;
|
|
23801
|
-
var init_environment_setups = __esm({
|
|
23802
|
-
"../shared/src/routes/environment-setups.ts"() {
|
|
23803
|
-
"use strict";
|
|
23804
|
-
init_zod();
|
|
23805
|
-
init_trigger_schemas();
|
|
23806
|
-
init_format();
|
|
23807
|
-
init_type_guards();
|
|
23808
|
-
init_uuid();
|
|
23809
|
-
ENVIRONMENT_SETUP_STEPS = [
|
|
23810
|
-
{ key: "understand", label: "Understand the codebase" },
|
|
23811
|
-
{ key: "install", label: "Install dependencies and run the app" },
|
|
23812
|
-
{ key: "verify", label: "Verify checks and record a walkthrough" },
|
|
23813
|
-
{ key: "configure", label: "Draft hooks, system prompt, and automations" },
|
|
23814
|
-
{ key: "propose", label: "Propose the configuration for review" }
|
|
23815
|
-
];
|
|
23816
|
-
ENVIRONMENT_SETUP_STEP_STATUSES = ["pending", "in_progress", "completed", "skipped"];
|
|
23817
|
-
ENVIRONMENT_SETUP_RUN_STATUSES = ["running", "proposed", "applied", "failed", "cancelled", "expired"];
|
|
23818
|
-
ENVIRONMENT_SETUP_AUTOMATION_ACTIONS = ["create", "update", "keep", "disable"];
|
|
23819
|
-
ENVIRONMENT_SETUP_VERIFICATION_STATUSES = ["passed", "failed", "skipped"];
|
|
23820
|
-
ENVIRONMENT_SETUP_LIMITS = {
|
|
23821
|
-
summaryChars: 600,
|
|
23822
|
-
stackItems: 30,
|
|
23823
|
-
nameChars: 120,
|
|
23824
|
-
descriptionChars: 1e3,
|
|
23825
|
-
systemPromptChars: 2e4,
|
|
23826
|
-
hookChars: 5e4,
|
|
23827
|
-
variables: 50,
|
|
23828
|
-
variableKeyChars: 128,
|
|
23829
|
-
variableDescriptionChars: 500,
|
|
23830
|
-
automations: 8,
|
|
23831
|
-
automationKeyChars: 80,
|
|
23832
|
-
automationPromptChars: 1e4,
|
|
23833
|
-
automationTriggers: 5,
|
|
23834
|
-
automationNoteChars: 300,
|
|
23835
|
-
verificationItems: 8,
|
|
23836
|
-
verificationDetailChars: 300,
|
|
23837
|
-
mediaItems: 8,
|
|
23838
|
-
repositories: 20
|
|
23839
|
-
};
|
|
23840
|
-
VARIABLE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
23841
|
-
text2 = (max) => max === void 0 ? external_exports.string().trim() : external_exports.string().trim().max(max);
|
|
23842
|
-
requiredText = (max) => text2(max).min(1, "must not be empty");
|
|
23843
|
-
optionalText2 = (max) => text2(max).nullish().transform((value) => value || null);
|
|
23844
|
-
clearableText = (max) => text2(max).nullish().transform((value) => value === void 0 ? void 0 : value || null);
|
|
23845
|
-
list = (item, max) => max === void 0 ? external_exports.array(item) : external_exports.array(item).max(max);
|
|
23846
|
-
ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES = ["cron", "github", "gitlab"];
|
|
23847
|
-
proposalTriggerSchema = external_exports.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
|
|
23848
|
-
existingTriggerSchema = external_exports.custom(
|
|
23849
|
-
(value) => isRecord(value) && typeof value.type === "string" && isRecord(value.config),
|
|
23850
|
-
"must be an automation trigger"
|
|
23851
|
-
);
|
|
23852
|
-
carriedTriggerSchema = existingTriggerSchema.refine(
|
|
23853
|
-
(trigger) => !isEnvironmentSetupAuthoredTriggerType(trigger.type)
|
|
23854
|
-
);
|
|
23855
|
-
environmentSetupProposalSchema = proposalSchema({});
|
|
23856
|
-
environmentSetupProposalSubmissionSchema = proposalSchema(ENVIRONMENT_SETUP_LIMITS);
|
|
23857
|
-
environmentSetupRunStateSchema = external_exports.object({
|
|
23858
|
-
status: external_exports.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
|
|
23859
|
-
steps: external_exports.partialRecord(external_exports.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), external_exports.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
|
|
23860
|
-
proposal: environmentSetupProposalSchema.nullable().default(null),
|
|
23861
|
-
applied: external_exports.object({
|
|
23862
|
-
applied_at: external_exports.string(),
|
|
23863
|
-
automation_ids: external_exports.array(external_exports.string())
|
|
23864
|
-
}).nullable().default(null)
|
|
23865
|
-
});
|
|
23866
|
-
applyEnvironmentSetupRequestSchema = external_exports.object({
|
|
23867
|
-
environment: environmentSchema(ENVIRONMENT_SETUP_LIMITS).extend({ name: requiredText(ENVIRONMENT_SETUP_LIMITS.nameChars) }),
|
|
23868
|
-
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)),
|
|
23869
|
-
automations: automationListSchema(ENVIRONMENT_SETUP_LIMITS)
|
|
23870
|
-
});
|
|
23871
|
-
}
|
|
23872
|
-
});
|
|
23873
|
-
|
|
23874
23922
|
// ../shared/src/default-skills/replicas-agent/abilities/environment-setup.ts
|
|
23875
23923
|
var SECTION3, REFERENCE3, ENVIRONMENT_SETUP_ABILITY;
|
|
23876
23924
|
var init_environment_setup = __esm({
|
|
@@ -38276,6 +38324,63 @@ var init_warm_hooks = __esm({
|
|
|
38276
38324
|
}
|
|
38277
38325
|
});
|
|
38278
38326
|
|
|
38327
|
+
// ../shared/src/environment-config.ts
|
|
38328
|
+
var variableNameSchema, mcpValueSchema, mcpValuesSchema, httpConfigSchema, replicasMcpDefinitionSchema, replicasEnvironmentConfigSchema;
|
|
38329
|
+
var init_environment_config = __esm({
|
|
38330
|
+
"../shared/src/environment-config.ts"() {
|
|
38331
|
+
"use strict";
|
|
38332
|
+
init_zod();
|
|
38333
|
+
init_environment();
|
|
38334
|
+
init_environment_setups();
|
|
38335
|
+
variableNameSchema = external_exports.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name");
|
|
38336
|
+
mcpValueSchema = external_exports.union([
|
|
38337
|
+
external_exports.string(),
|
|
38338
|
+
environmentMcpVariableReferenceSchema
|
|
38339
|
+
]);
|
|
38340
|
+
mcpValuesSchema = external_exports.record(external_exports.string(), mcpValueSchema);
|
|
38341
|
+
httpConfigSchema = environmentMcpHttpConfigSchema.pick({ url: true, auth: true }).extend({
|
|
38342
|
+
headers: mcpValuesSchema.default({})
|
|
38343
|
+
}).strict();
|
|
38344
|
+
replicasMcpDefinitionSchema = external_exports.discriminatedUnion("transport", [
|
|
38345
|
+
external_exports.strictObject({
|
|
38346
|
+
transport: external_exports.literal("stdio"),
|
|
38347
|
+
config: environmentMcpStdioConfigSchema.pick({ command: true }).extend({
|
|
38348
|
+
args: environmentMcpStdioConfigSchema.shape.args.unwrap().default([]),
|
|
38349
|
+
env: external_exports.record(variableNameSchema, mcpValueSchema).default({})
|
|
38350
|
+
}).strict()
|
|
38351
|
+
}),
|
|
38352
|
+
external_exports.strictObject({ transport: external_exports.literal("http"), config: httpConfigSchema }),
|
|
38353
|
+
external_exports.strictObject({ transport: external_exports.literal("sse"), config: httpConfigSchema })
|
|
38354
|
+
]).superRefine((definition, context) => {
|
|
38355
|
+
if (definition.transport === "stdio") return;
|
|
38356
|
+
const result = validateEnvironmentMcpAuthentication(definition.transport, definition.config);
|
|
38357
|
+
if (!result.ok) context.addIssue({ code: "custom", path: result.error.code === "transport" ? ["transport"] : ["config", result.error.code ?? "auth"], message: result.error.message });
|
|
38358
|
+
});
|
|
38359
|
+
replicasEnvironmentConfigSchema = external_exports.strictObject({
|
|
38360
|
+
systemPrompt: external_exports.string().optional(),
|
|
38361
|
+
warmHook: external_exports.string().optional(),
|
|
38362
|
+
startHook: external_exports.string().optional(),
|
|
38363
|
+
variables: external_exports.record(variableNameSchema, external_exports.string()).optional(),
|
|
38364
|
+
requiredSecrets: external_exports.array(variableNameSchema).optional(),
|
|
38365
|
+
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()
|
|
38366
|
+
}).superRefine((config3, context) => {
|
|
38367
|
+
const names = /* @__PURE__ */ new Set();
|
|
38368
|
+
for (const name of Object.keys(config3.mcps ?? {})) {
|
|
38369
|
+
const normalized = name.toLowerCase();
|
|
38370
|
+
if (names.has(normalized)) {
|
|
38371
|
+
context.addIssue({ code: "custom", path: ["mcps", name], message: "MCP names must be unique regardless of case" });
|
|
38372
|
+
}
|
|
38373
|
+
names.add(normalized);
|
|
38374
|
+
}
|
|
38375
|
+
for (const key of config3.requiredSecrets ?? []) {
|
|
38376
|
+
if (config3.variables && Object.hasOwn(config3.variables, key)) {
|
|
38377
|
+
context.addIssue({ code: "custom", path: ["requiredSecrets"], message: `"${key}" cannot also be declared as a non-secret variable` });
|
|
38378
|
+
}
|
|
38379
|
+
}
|
|
38380
|
+
});
|
|
38381
|
+
}
|
|
38382
|
+
});
|
|
38383
|
+
|
|
38279
38384
|
// ../shared/src/replicas-config.ts
|
|
38280
38385
|
var import_yaml2, REPLICAS_CONFIG_FILENAMES;
|
|
38281
38386
|
var init_replicas_config = __esm({
|
|
@@ -38283,6 +38388,7 @@ var init_replicas_config = __esm({
|
|
|
38283
38388
|
"use strict";
|
|
38284
38389
|
import_yaml2 = __toESM(require_dist());
|
|
38285
38390
|
init_warm_hooks();
|
|
38391
|
+
init_environment_config();
|
|
38286
38392
|
REPLICAS_CONFIG_FILENAMES = ["replicas.json", "replicas.yaml", "replicas.yml"];
|
|
38287
38393
|
}
|
|
38288
38394
|
});
|
|
@@ -38392,7 +38498,7 @@ var CLI_VERSION;
|
|
|
38392
38498
|
var init_cli_version = __esm({
|
|
38393
38499
|
"../shared/src/cli-version.ts"() {
|
|
38394
38500
|
"use strict";
|
|
38395
|
-
CLI_VERSION = "0.3.
|
|
38501
|
+
CLI_VERSION = "0.3.431";
|
|
38396
38502
|
}
|
|
38397
38503
|
});
|
|
38398
38504
|
|
|
@@ -38720,15 +38826,18 @@ var init_scout2 = __esm({
|
|
|
38720
38826
|
preset_id: external_exports.string().nullable().optional().describe("Preset to assign; `null` removes the preset. Omit to keep it."),
|
|
38721
38827
|
instructions: external_exports.string().nullable().optional().describe("Complete channel-specific instructions, applied after the preset; replaces the existing text. `null` clears them. Omit to keep them."),
|
|
38722
38828
|
proactivity: external_exports.enum([...SCOUT_PROACTIVITY_LEVELS, "organization"]).optional().describe("Slack only: this channel's or group DM's own level, overriding the organization's here alone. `organization` makes it follow the organization's level again. Omit to keep it. 1:1 DMs are always addressed to Replicas, so they take no level."),
|
|
38723
|
-
|
|
38829
|
+
silent: external_exports.enum(["on", "off", "default"]).optional().describe(`Slack only, organization admins only: \`on\` puts this channel in silent mode, where Replicas reads it and follows its instructions but never posts, reacts, or starts work there. \`off\` turns silent mode off here, \`default\` follows the Slack Connect default from \`${REPLICAS_MCP_TOOLS.setSlackConnectDefaults}\`. Omit to keep it.`),
|
|
38830
|
+
muted: external_exports.enum(["on", "off", "default"]).optional().describe("Kept for older callers; prefer `silent`.")
|
|
38724
38831
|
});
|
|
38725
38832
|
mothershipSlackChannelLevelToolInputSchema = scoutSlackConfirmationSchema.extend({
|
|
38726
38833
|
proactivity: scoutUpdateChannelSettingsToolInputSchema.shape.proactivity.unwrap().describe("This channel's own level. `organization` makes it follow the organization's level again, which a Mothership's channel raises to at least `balanced`.")
|
|
38727
38834
|
});
|
|
38728
38835
|
scoutSetSlackConnectMutedToolInputSchema = scoutSlackConfirmationSchema.extend({
|
|
38729
|
-
muted: external_exports.boolean().describe("`true`
|
|
38836
|
+
muted: external_exports.boolean().describe("`true` puts every Slack Connect channel without its own setting in silent mode; `false` lets them follow their levels again.")
|
|
38730
38837
|
});
|
|
38731
|
-
scoutSetSlackConnectDefaultsToolInputSchema =
|
|
38838
|
+
scoutSetSlackConnectDefaultsToolInputSchema = scoutSlackConfirmationSchema.extend({
|
|
38839
|
+
silent: external_exports.boolean().optional().describe("`true` puts every Slack Connect channel without its own setting in silent mode; `false` lets them follow their levels again. Omit to keep it."),
|
|
38840
|
+
muted: external_exports.boolean().optional().describe("Kept for older callers; prefer `silent`."),
|
|
38732
38841
|
preset_id: external_exports.string().optional().describe("Preset for every Slack Connect channel without its own preset or instructions; an empty string removes it. Omit to keep it."),
|
|
38733
38842
|
instructions: external_exports.string().optional().describe("Complete default instructions, applied after that preset; replaces the existing text. An empty string clears them. Omit to keep them."),
|
|
38734
38843
|
proactivity: external_exports.enum([...SCOUT_PROACTIVITY_LEVELS, "default"]).optional().describe("Level for every Slack Connect channel without its own level. `default` returns them to `tagged`. Omit to keep it.")
|
|
@@ -49628,6 +49737,8 @@ var init_src = __esm({
|
|
|
49628
49737
|
init_image_attachments();
|
|
49629
49738
|
init_scout();
|
|
49630
49739
|
init_replicas_config();
|
|
49740
|
+
init_environment_config();
|
|
49741
|
+
init_environment_config_source();
|
|
49631
49742
|
init_warm_hooks();
|
|
49632
49743
|
init_hook_failure();
|
|
49633
49744
|
init_start_hook_network();
|
|
@@ -55653,6 +55764,95 @@ var init_gpu2 = __esm({
|
|
|
55653
55764
|
}
|
|
55654
55765
|
});
|
|
55655
55766
|
|
|
55767
|
+
// src/commands/environment-config.ts
|
|
55768
|
+
function printSource({ source }) {
|
|
55769
|
+
if (!source) {
|
|
55770
|
+
console.log("No Git configuration linked. Use replicas environment config link <env> --repository <name-or-id>.");
|
|
55771
|
+
return;
|
|
55772
|
+
}
|
|
55773
|
+
console.log(`${source.repository_name}/${source.filename} @ ${source.commit_sha}`);
|
|
55774
|
+
console.log(source.source_url);
|
|
55775
|
+
console.log(`Synced: ${source.synced_at}`);
|
|
55776
|
+
console.log(`Managed settings: ${source.managed.fields.join(", ") || "(none)"}`);
|
|
55777
|
+
console.log(`Managed variables: ${source.managed.variables.join(", ") || "(none)"}`);
|
|
55778
|
+
console.log(`Managed MCPs: ${source.managed.mcps.join(", ") || "(none)"}`);
|
|
55779
|
+
if (source.required_secrets.length) console.log(`Required secrets: ${source.required_secrets.join(", ")}`);
|
|
55780
|
+
if (source.pending_rebuild) console.log(import_chalk29.default.yellow("Configuration saved; environment rebuild pending."));
|
|
55781
|
+
if (source.last_error) console.log(import_chalk29.default.red(source.last_error));
|
|
55782
|
+
}
|
|
55783
|
+
function printPreview({ preview: preview2 }) {
|
|
55784
|
+
console.log(`${preview2.repository_name}/${preview2.filename} @ ${preview2.commit_sha}`);
|
|
55785
|
+
console.log(preview2.source_url);
|
|
55786
|
+
if (!preview2.changes.length) console.log("No setting changes. Applying records this commit.");
|
|
55787
|
+
for (const change of preview2.changes) console.log(` ${change.operation}: ${change.kind} ${change.key}`);
|
|
55788
|
+
if (preview2.missing_secrets.length) console.log(import_chalk29.default.yellow(`Missing required secrets: ${preview2.missing_secrets.join(", ")}`));
|
|
55789
|
+
for (const blocker of preview2.blockers) console.log(import_chalk29.default.red(` Cannot apply: ${blocker}`));
|
|
55790
|
+
}
|
|
55791
|
+
async function previewSource(id, repository) {
|
|
55792
|
+
const [repositoryId] = repository ? await resolveRepositoryIds([repository]) : [];
|
|
55793
|
+
return orgAuthenticatedFetch(`/v1/environments/${id}/config-source/preview`, {
|
|
55794
|
+
method: "POST",
|
|
55795
|
+
body: repositoryId ? { repository_id: repositoryId } : {}
|
|
55796
|
+
});
|
|
55797
|
+
}
|
|
55798
|
+
async function environmentConfigGetCommand(environment2) {
|
|
55799
|
+
ensureOrgApiAuthenticated();
|
|
55800
|
+
const id = await resolveEnvironmentId(environment2);
|
|
55801
|
+
output2(await orgAuthenticatedFetch(`/v1/environments/${id}/config-source`), printSource);
|
|
55802
|
+
}
|
|
55803
|
+
async function environmentConfigPreviewCommand(environment2, options) {
|
|
55804
|
+
ensureOrgApiAuthenticated();
|
|
55805
|
+
output2(await previewSource(await resolveEnvironmentId(environment2), options.repository), printPreview);
|
|
55806
|
+
}
|
|
55807
|
+
async function applySource(environment2, options, operation) {
|
|
55808
|
+
ensureOrgApiAuthenticated();
|
|
55809
|
+
const id = await resolveEnvironmentId(environment2);
|
|
55810
|
+
const response = await previewSource(id, options.repository);
|
|
55811
|
+
if (!isJsonMode()) printPreview(response);
|
|
55812
|
+
const { preview: preview2 } = response;
|
|
55813
|
+
if (preview2.blockers.length || preview2.missing_secrets.length) {
|
|
55814
|
+
throw new Error([
|
|
55815
|
+
...preview2.blockers,
|
|
55816
|
+
...preview2.missing_secrets.length ? [`Missing required secrets: ${preview2.missing_secrets.join(", ")}`] : []
|
|
55817
|
+
].join("; "));
|
|
55818
|
+
}
|
|
55819
|
+
if (!options.yes) {
|
|
55820
|
+
if (!isInteractive()) throw new Error("Preview the changes with replicas environment config preview, then pass --yes to apply without a terminal.");
|
|
55821
|
+
if (!await confirmAction(`${operation === "link" ? "Link and apply" : "Apply"} this configuration to ${environment2}?`)) return;
|
|
55822
|
+
}
|
|
55823
|
+
const body = { repository_id: preview2.repository_id, commit_sha: preview2.commit_sha, fingerprint: preview2.fingerprint };
|
|
55824
|
+
output2(await orgAuthenticatedFetch(`/v1/environments/${id}/config-source${operation === "sync" ? "/sync" : ""}`, { method: "POST", body }), printSource);
|
|
55825
|
+
}
|
|
55826
|
+
async function environmentConfigLinkCommand(environment2, options) {
|
|
55827
|
+
await applySource(environment2, options, "link");
|
|
55828
|
+
}
|
|
55829
|
+
async function environmentConfigSyncCommand(environment2, options) {
|
|
55830
|
+
await applySource(environment2, options, "sync");
|
|
55831
|
+
}
|
|
55832
|
+
async function environmentConfigDisconnectCommand(environment2, options) {
|
|
55833
|
+
ensureOrgApiAuthenticated();
|
|
55834
|
+
const id = await resolveEnvironmentId(environment2);
|
|
55835
|
+
if (!options.yes) {
|
|
55836
|
+
if (!isInteractive()) throw new Error("Pass --yes to disconnect without a terminal. Current settings will be preserved.");
|
|
55837
|
+
if (!await confirmAction(`Disconnect Git configuration for ${environment2}? Current settings will be preserved.`)) return;
|
|
55838
|
+
}
|
|
55839
|
+
output2(await orgAuthenticatedFetch(`/v1/environments/${id}/config-source`, { method: "DELETE" }), () => {
|
|
55840
|
+
console.log("Git configuration disconnected. Current settings preserved.");
|
|
55841
|
+
});
|
|
55842
|
+
}
|
|
55843
|
+
var import_chalk29;
|
|
55844
|
+
var init_environment_config2 = __esm({
|
|
55845
|
+
"src/commands/environment-config.ts"() {
|
|
55846
|
+
"use strict";
|
|
55847
|
+
import_chalk29 = __toESM(require("chalk"));
|
|
55848
|
+
init_api2();
|
|
55849
|
+
init_command_utils();
|
|
55850
|
+
init_output();
|
|
55851
|
+
init_environment3();
|
|
55852
|
+
init_repositories2();
|
|
55853
|
+
}
|
|
55854
|
+
});
|
|
55855
|
+
|
|
55656
55856
|
// src/commands/history.ts
|
|
55657
55857
|
async function historyTranscriptCommand(name) {
|
|
55658
55858
|
const session = name.trim().replace(/\.md$/, "");
|
|
@@ -55696,12 +55896,12 @@ async function skillsSuggestCommand(file2, options) {
|
|
|
55696
55896
|
async function skillsListCommand() {
|
|
55697
55897
|
output2(await orgAuthenticatedFetch("/v1/learned-skills"), ({ skills: skills2, suggestions }) => {
|
|
55698
55898
|
for (const skill of skills2) console.log(`${skill.id} ${skill.name} ${skill.title}`);
|
|
55699
|
-
if (suggestions.length > 0) console.log(
|
|
55899
|
+
if (suggestions.length > 0) console.log(import_chalk30.default.gray(`${suggestions.length} pending suggestion(s) to review in the dashboard.`));
|
|
55700
55900
|
});
|
|
55701
55901
|
}
|
|
55702
55902
|
async function skillsCreateCommand(file2, options) {
|
|
55703
55903
|
const body = { content: (0, import_node_fs4.readFileSync)(file2, "utf-8"), title: options.title };
|
|
55704
|
-
output2(await orgAuthenticatedFetch("/v1/learned-skills", { method: "POST", body }), ({ id, name }) => console.log(
|
|
55904
|
+
output2(await orgAuthenticatedFetch("/v1/learned-skills", { method: "POST", body }), ({ id, name }) => console.log(import_chalk30.default.green(`Saved learning '${name}' (${id})`)));
|
|
55705
55905
|
}
|
|
55706
55906
|
async function skillsUpdateCommand(id, options) {
|
|
55707
55907
|
const { skills: skills2 } = await orgAuthenticatedFetch("/v1/learned-skills");
|
|
@@ -55711,18 +55911,18 @@ async function skillsUpdateCommand(id, options) {
|
|
|
55711
55911
|
title: options.title ?? existing.title,
|
|
55712
55912
|
content: options.file ? (0, import_node_fs4.readFileSync)(options.file, "utf-8") : existing.content
|
|
55713
55913
|
};
|
|
55714
|
-
output2(await orgAuthenticatedFetch(`/v1/learned-skills/${existing.id}`, { method: "PUT", body }), ({ name }) => console.log(
|
|
55914
|
+
output2(await orgAuthenticatedFetch(`/v1/learned-skills/${existing.id}`, { method: "PUT", body }), ({ name }) => console.log(import_chalk30.default.green(`Updated learning '${name}'`)));
|
|
55715
55915
|
}
|
|
55716
55916
|
async function skillsDeleteCommand(id) {
|
|
55717
55917
|
await orgAuthenticatedFetch(`/v1/learned-skills/${id}`, { method: "DELETE" });
|
|
55718
55918
|
outputSuccess(`Deleted learning ${id}`);
|
|
55719
55919
|
}
|
|
55720
|
-
var import_node_fs4,
|
|
55920
|
+
var import_node_fs4, import_chalk30;
|
|
55721
55921
|
var init_skills = __esm({
|
|
55722
55922
|
"src/commands/skills.ts"() {
|
|
55723
55923
|
"use strict";
|
|
55724
55924
|
import_node_fs4 = require("fs");
|
|
55725
|
-
|
|
55925
|
+
import_chalk30 = __toESM(require("chalk"));
|
|
55726
55926
|
init_agent_api();
|
|
55727
55927
|
init_api2();
|
|
55728
55928
|
init_monolith_url();
|
|
@@ -55748,10 +55948,10 @@ async function attachThread(request) {
|
|
|
55748
55948
|
body: request
|
|
55749
55949
|
});
|
|
55750
55950
|
output2(response, ({ thread, workspace }) => {
|
|
55751
|
-
console.log(
|
|
55752
|
-
console.log(
|
|
55753
|
-
console.log(
|
|
55754
|
-
console.log(
|
|
55951
|
+
console.log(import_chalk31.default.green("Slack thread attached."));
|
|
55952
|
+
console.log(import_chalk31.default.gray(` Channel: ${thread.channel_id}`));
|
|
55953
|
+
console.log(import_chalk31.default.gray(` Thread: ${thread.thread_ts}`));
|
|
55954
|
+
console.log(import_chalk31.default.gray(` Workspace: ${workspace.name} (${workspace.id})`));
|
|
55755
55955
|
});
|
|
55756
55956
|
}
|
|
55757
55957
|
async function slackThreadAttachCommand(options) {
|
|
@@ -55779,11 +55979,11 @@ async function slackThreadSwitchCommand(workspace, options) {
|
|
|
55779
55979
|
workspace_id: workspaceId
|
|
55780
55980
|
});
|
|
55781
55981
|
}
|
|
55782
|
-
var
|
|
55982
|
+
var import_chalk31;
|
|
55783
55983
|
var init_slack4 = __esm({
|
|
55784
55984
|
"src/commands/slack.ts"() {
|
|
55785
55985
|
"use strict";
|
|
55786
|
-
|
|
55986
|
+
import_chalk31 = __toESM(require("chalk"));
|
|
55787
55987
|
init_api2();
|
|
55788
55988
|
init_config();
|
|
55789
55989
|
init_output();
|
|
@@ -55938,7 +56138,7 @@ async function serviceListCommand() {
|
|
|
55938
56138
|
return;
|
|
55939
56139
|
}
|
|
55940
56140
|
for (const service of services) {
|
|
55941
|
-
const status = service.running ?
|
|
56141
|
+
const status = service.running ? import_chalk32.default.green("running") : import_chalk32.default.red("stopped");
|
|
55942
56142
|
console.log(`${service.name} ${status} pid ${service.pid} started ${service.startedAt}`);
|
|
55943
56143
|
console.log(` command: ${service.command} (cwd: ${service.cwd})`);
|
|
55944
56144
|
console.log(` logs: ${service.logFile}`);
|
|
@@ -55958,11 +56158,11 @@ async function serviceLogsCommand(name, options) {
|
|
|
55958
56158
|
console.log(logs || "(no log output yet)");
|
|
55959
56159
|
});
|
|
55960
56160
|
}
|
|
55961
|
-
var
|
|
56161
|
+
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;
|
|
55962
56162
|
var init_service = __esm({
|
|
55963
56163
|
"src/commands/service.ts"() {
|
|
55964
56164
|
"use strict";
|
|
55965
|
-
|
|
56165
|
+
import_chalk32 = __toESM(require("chalk"));
|
|
55966
56166
|
import_node_child_process3 = require("child_process");
|
|
55967
56167
|
import_node_fs5 = require("fs");
|
|
55968
56168
|
import_node_os3 = require("os");
|
|
@@ -56019,7 +56219,7 @@ async function deviceConnectCommand() {
|
|
|
56019
56219
|
stream.destroy();
|
|
56020
56220
|
};
|
|
56021
56221
|
sshd.once("error", (error62) => {
|
|
56022
|
-
console.log(
|
|
56222
|
+
console.log(import_chalk33.default.yellow(`A workspace couldn't reach SSH on port ${port} here (${error62.message}). ${REMOTE_LOGIN_HINT}`));
|
|
56023
56223
|
});
|
|
56024
56224
|
sshd.on("error", close).on("close", close);
|
|
56025
56225
|
stream.on("error", close).on("close", close);
|
|
@@ -56063,16 +56263,16 @@ async function deviceConnectCommand() {
|
|
|
56063
56263
|
}
|
|
56064
56264
|
}
|
|
56065
56265
|
const next = problem ?? `\u2713 ${device?.name}: ready for ${waiting.size} ${waiting.size === 1 ? "workspace" : "workspaces"}, forwarding to SSH on port ${port}`;
|
|
56066
|
-
if (next !== summary) console.log(problem ?
|
|
56266
|
+
if (next !== summary) console.log(problem ? import_chalk33.default.yellow(next) : import_chalk33.default.green(next));
|
|
56067
56267
|
summary = next;
|
|
56068
56268
|
await (0, import_promises2.setTimeout)(POLL_INTERVAL_MS);
|
|
56069
56269
|
}
|
|
56070
56270
|
}
|
|
56071
|
-
var
|
|
56271
|
+
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;
|
|
56072
56272
|
var init_device = __esm({
|
|
56073
56273
|
"src/commands/device.ts"() {
|
|
56074
56274
|
"use strict";
|
|
56075
|
-
|
|
56275
|
+
import_chalk33 = __toESM(require("chalk"));
|
|
56076
56276
|
import_node_child_process4 = require("child_process");
|
|
56077
56277
|
import_node_net = require("net");
|
|
56078
56278
|
import_promises2 = require("timers/promises");
|
|
@@ -56103,8 +56303,8 @@ async function localControlRequestCommand(options) {
|
|
|
56103
56303
|
await orgAuthenticatedFetch("/v1/local-control-request", { method: "DELETE" });
|
|
56104
56304
|
output2({ status: "connected", computers: computers2 }, () => {
|
|
56105
56305
|
console.log(`
|
|
56106
|
-
${
|
|
56107
|
-
console.log(
|
|
56306
|
+
${import_chalk34.default.green("Connected:")} ${computers2.join(", ")}`);
|
|
56307
|
+
console.log(import_chalk34.default.gray(` Run commands there with: ssh ${computers2[0]} '<command>'
|
|
56108
56308
|
`));
|
|
56109
56309
|
});
|
|
56110
56310
|
};
|
|
@@ -56132,10 +56332,10 @@ async function localControlRequestCommand(options) {
|
|
|
56132
56332
|
}
|
|
56133
56333
|
output2({ status: pending ? "pending" : "declined", computers: [], url: created.url }, () => {
|
|
56134
56334
|
if (!pending) {
|
|
56135
|
-
console.log(
|
|
56335
|
+
console.log(import_chalk34.default.yellow("\n The user declined. Continue without their computer, or ask how they want to proceed.\n"));
|
|
56136
56336
|
return;
|
|
56137
56337
|
}
|
|
56138
|
-
console.log(
|
|
56338
|
+
console.log(import_chalk34.default.gray(options.wait === false ? `
|
|
56139
56339
|
Asked above the chat composer (${created.url}). Keep working, and run this command again when you need the computer.
|
|
56140
56340
|
` : created.wait ? `
|
|
56141
56341
|
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.
|
|
@@ -56145,7 +56345,7 @@ async function localControlRequestCommand(options) {
|
|
|
56145
56345
|
`));
|
|
56146
56346
|
});
|
|
56147
56347
|
}
|
|
56148
|
-
var import_child_process6, import_fs11, import_os5, import_path10, import_util10,
|
|
56348
|
+
var import_child_process6, import_fs11, import_os5, import_path10, import_util10, import_chalk34, execFileAsync2;
|
|
56149
56349
|
var init_local_control = __esm({
|
|
56150
56350
|
"src/commands/local-control.ts"() {
|
|
56151
56351
|
"use strict";
|
|
@@ -56154,7 +56354,7 @@ var init_local_control = __esm({
|
|
|
56154
56354
|
import_os5 = __toESM(require("os"));
|
|
56155
56355
|
import_path10 = __toESM(require("path"));
|
|
56156
56356
|
import_util10 = require("util");
|
|
56157
|
-
|
|
56357
|
+
import_chalk34 = __toESM(require("chalk"));
|
|
56158
56358
|
init_src();
|
|
56159
56359
|
init_api2();
|
|
56160
56360
|
init_command_utils();
|
|
@@ -56196,7 +56396,7 @@ function registerEnvironmentHookCommands(parent, config3) {
|
|
|
56196
56396
|
}
|
|
56197
56397
|
hooks.command("repository-hooks <env>").description(`List per-repo ${config3.kind} hooks defined in replicas.json / replicas.yaml`).action(run(config3.repositoryHooks));
|
|
56198
56398
|
}
|
|
56199
|
-
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;
|
|
56399
|
+
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;
|
|
56200
56400
|
var init_src2 = __esm({
|
|
56201
56401
|
"src/index.ts"() {
|
|
56202
56402
|
"use strict";
|
|
@@ -56229,6 +56429,7 @@ var init_src2 = __esm({
|
|
|
56229
56429
|
init_media_gif();
|
|
56230
56430
|
init_visualize();
|
|
56231
56431
|
init_gpu2();
|
|
56432
|
+
init_environment_config2();
|
|
56232
56433
|
init_history();
|
|
56233
56434
|
init_skills();
|
|
56234
56435
|
init_slack4();
|
|
@@ -56397,6 +56598,12 @@ var init_src2 = __esm({
|
|
|
56397
56598
|
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));
|
|
56398
56599
|
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));
|
|
56399
56600
|
environment.command("delete <id-or-name>").description("Delete an environment").option("-f, --force", "Skip confirmation prompt").action(run(environmentDeleteCommand));
|
|
56601
|
+
envConfig = environment.command("config").description("Link and sync environment configuration from Git");
|
|
56602
|
+
envConfig.command("get <env>").description("Show the linked configuration source and sync status").action(run(environmentConfigGetCommand));
|
|
56603
|
+
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));
|
|
56604
|
+
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));
|
|
56605
|
+
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));
|
|
56606
|
+
envConfig.command("disconnect <env>").description("Disconnect Git configuration and preserve current settings").option("-y, --yes", "Disconnect without a confirmation prompt").action(run(environmentConfigDisconnectCommand));
|
|
56400
56607
|
envVars = environment.command("vars").description("Manage environment variables");
|
|
56401
56608
|
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));
|
|
56402
56609
|
envVars.command("set <env> <key> <value>").description("Create or update a variable").action(run(envVarsSetCommand));
|
|
@@ -56561,11 +56768,11 @@ ${VISUAL_PAGE_RULES}`).action(run(visualizeCommand));
|
|
|
56561
56768
|
|
|
56562
56769
|
// src/bin.ts
|
|
56563
56770
|
var import_node_child_process5 = require("child_process");
|
|
56564
|
-
var
|
|
56771
|
+
var import_chalk35 = __toESM(require("chalk"));
|
|
56565
56772
|
init_config();
|
|
56566
56773
|
if (process.argv[2] === "computer" && isAgentMode()) {
|
|
56567
56774
|
const result = (0, import_node_child_process5.spawnSync)("replicas-computer", process.argv.slice(3), { stdio: "inherit" });
|
|
56568
|
-
if (result.error) console.error(
|
|
56775
|
+
if (result.error) console.error(import_chalk35.default.red(`
|
|
56569
56776
|
\u2717 replicas-computer is unavailable in this workspace image
|
|
56570
56777
|
`));
|
|
56571
56778
|
process.exitCode = result.error ? 1 : result.status ?? 1;
|