@sealant/mend 0.35.0 → 0.36.0-next.1006
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/README.md +39 -7
- package/dist/{chunk-SMH65F6Z.js → chunk-5VCZGIDO.js} +1179 -11
- package/dist/{dashboard-MGR4YUFD.js → dashboard-6LXBWCM5.js} +1345 -348
- package/dist/main.js +11151 -2017
- package/man/mend-accounts.1 +1 -1
- package/man/mend-adopt.1 +4 -4
- package/man/mend-agent-logins.1 +20 -0
- package/man/mend-attach.1 +1 -1
- package/man/mend-codex.1 +9 -7
- package/man/mend-completions.1 +1 -1
- package/man/mend-connect-pi.1 +28 -0
- package/man/mend-connect.1 +7 -3
- package/man/mend-continue.1 +1 -1
- package/man/mend-doctor.1 +2 -2
- package/man/mend-dotfiles-repo.1 +1 -1
- package/man/mend-dotfiles-sync.1 +1 -1
- package/man/mend-dotfiles.1 +1 -1
- package/man/mend-env-cluster.1 +1 -1
- package/man/mend-env-load.1 +1 -1
- package/man/mend-env-show.1 +1 -1
- package/man/mend-folder-create.1 +1 -1
- package/man/mend-folder-list.1 +1 -1
- package/man/mend-folder-push.1 +1 -1
- package/man/mend-folder-rm.1 +1 -1
- package/man/mend-git-author.1 +1 -1
- package/man/mend-help.1 +1 -1
- package/man/mend-invite.1 +1 -1
- package/man/mend-keys-init.1 +1 -1
- package/man/mend-keys-mode.1 +1 -1
- package/man/mend-keys-share.1 +1 -1
- package/man/mend-keys-show.1 +1 -1
- package/man/mend-land.1 +1 -1
- package/man/mend-login.1 +10 -2
- package/man/mend-logout.1 +1 -1
- package/man/mend-logs.1 +37 -0
- package/man/mend-man.1 +1 -1
- package/man/mend-members.1 +1 -1
- package/man/mend-memory-import.1 +23 -0
- package/man/mend-memory-rm.1 +15 -0
- package/man/mend-memory-show.1 +15 -0
- package/man/mend-memory.1 +32 -0
- package/man/mend-models.1 +22 -0
- package/man/mend-operator-exposure.1 +2 -2
- package/man/mend-operator-gate.1 +1 -1
- package/man/mend-operator-grant-owner.1 +1 -1
- package/man/mend-operator-org-create.1 +1 -1
- package/man/mend-operator-org-invite-owner.1 +1 -1
- package/man/mend-operator-org-list.1 +1 -1
- package/man/mend-operator-org-rename.1 +1 -1
- package/man/mend-operator-reset-link.1 +1 -1
- package/man/mend-pair.1 +3 -1
- package/man/mend-projects.1 +10 -2
- package/man/mend-pull.1 +6 -3
- package/man/mend-refresh.1 +1 -1
- package/man/mend-rejoin.1 +1 -1
- package/man/mend-resume.1 +1 -1
- package/man/mend-run.1 +37 -4
- package/man/mend-secrets-add.1 +24 -0
- package/man/mend-secrets-rm.1 +14 -0
- package/man/mend-secrets.1 +18 -0
- package/man/mend-server-logs.1 +1 -1
- package/man/mend-server-restart.1 +1 -1
- package/man/mend-server-setup.1 +125 -8
- package/man/mend-server-start.1 +1 -1
- package/man/mend-server-status.1 +7 -3
- package/man/mend-server-stop.1 +3 -3
- package/man/mend-server-upgrade.1 +14 -2
- package/man/mend-server.1 +1 -1
- package/man/mend-service-add.1 +1 -1
- package/man/mend-service-connect.1 +1 -1
- package/man/mend-service-init.1 +1 -1
- package/man/mend-service-list.1 +10 -4
- package/man/mend-service-logs.1 +3 -1
- package/man/mend-service-restart.1 +1 -1
- package/man/mend-service-run.1 +16 -4
- package/man/mend-service-stop.1 +1 -1
- package/man/mend-session-share.1 +13 -3
- package/man/mend-sessions.1 +3 -1
- package/man/mend-shell.1 +1 -1
- package/man/mend-skills-push.1 +1 -1
- package/man/mend-skills.1 +1 -1
- package/man/mend-snake.1 +2 -2
- package/man/mend-ssh-keys-remove.1 +18 -0
- package/man/mend-ssh-keys.1 +15 -0
- package/man/mend-ssh-setup.1 +2 -2
- package/man/mend-ssh.1 +13 -4
- package/man/mend-stop.1 +1 -1
- package/man/mend-ui.1 +4 -2
- package/man/mend-uninstall.1 +9 -3
- package/man/mend-version.1 +1 -1
- package/man/mend-wait.1 +28 -0
- package/man/mend-workspace-replace.1 +24 -0
- package/man/mend-worktrees-rm.1 +29 -0
- package/man/mend-worktrees.1 +2 -2
- package/man/mend.1 +61 -7
- package/package.json +23 -41
|
@@ -5,8 +5,17 @@ var __export = (target, all3) => {
|
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
// ../../packages/domain/src/workbench/harness-launch.ts
|
|
8
|
-
var EFFORT_LEVELS = ["low", "medium", "high", "xhigh", "max"];
|
|
8
|
+
var EFFORT_LEVELS = ["low", "medium", "high", "xhigh", "max", "ultra"];
|
|
9
9
|
var PERMISSION_MODES = ["bypass", "ask"];
|
|
10
|
+
var PROMPTABLE_HARNESSES = /* @__PURE__ */ new Set([
|
|
11
|
+
"claude",
|
|
12
|
+
"codex",
|
|
13
|
+
"opencode",
|
|
14
|
+
"pi"
|
|
15
|
+
]);
|
|
16
|
+
var takesReviewFollowUp = (harness) => PROMPTABLE_HARNESSES.has(harness);
|
|
17
|
+
var noReviewFollowUpLine = (harness) => `This ${harness} session has no agent to send the review to. Start an agent in this worktree, then send it.`;
|
|
18
|
+
var resumesOwnHarness = (harness) => PROMPTABLE_HARNESSES.has(harness) || harness === "shell";
|
|
10
19
|
|
|
11
20
|
// ../../packages/domain/src/workbench/agent-start.ts
|
|
12
21
|
var agentStartingLine = (label, facts, elapsedMs) => `${label} is starting${facts.freshMachine ? " on the new machine" : ""} \xB7 ${Math.max(0, Math.round(elapsedMs / 1e3))}s`;
|
|
@@ -26442,6 +26451,7 @@ var FollowUpId = Schema_exports.String.pipe(Schema_exports.brand("FollowUpId"));
|
|
|
26442
26451
|
var ReferenceId = Schema_exports.String.pipe(Schema_exports.brand("ReferenceId"));
|
|
26443
26452
|
var ProjectMountId = Schema_exports.String.pipe(Schema_exports.brand("ProjectMountId"));
|
|
26444
26453
|
var ProjectLinkId = Schema_exports.String.pipe(Schema_exports.brand("ProjectLinkId"));
|
|
26454
|
+
var SessionRepositoryId = Schema_exports.String.pipe(Schema_exports.brand("SessionRepositoryId"));
|
|
26445
26455
|
var SkillId = Schema_exports.String.pipe(Schema_exports.brand("SkillId"));
|
|
26446
26456
|
var SessionProcessId = Schema_exports.String.pipe(Schema_exports.brand("SessionProcessId"));
|
|
26447
26457
|
var AgentTurnId = Schema_exports.String.pipe(Schema_exports.brand("AgentTurnId"));
|
|
@@ -26456,6 +26466,7 @@ var ProjectEnvironmentVariableId = Schema_exports.String.pipe(
|
|
|
26456
26466
|
);
|
|
26457
26467
|
var ProjectSecretId = Schema_exports.String.pipe(Schema_exports.brand("ProjectSecretId"));
|
|
26458
26468
|
var ProjectClusterBindingId = Schema_exports.String.pipe(Schema_exports.brand("ProjectClusterBindingId"));
|
|
26469
|
+
var SecretFileId = Schema_exports.String.pipe(Schema_exports.brand("SecretFileId"));
|
|
26459
26470
|
var OrganizationId = Schema_exports.String.pipe(Schema_exports.brand("OrganizationId"));
|
|
26460
26471
|
var InvitationId = Schema_exports.String.pipe(Schema_exports.brand("InvitationId"));
|
|
26461
26472
|
var FolderId = Schema_exports.String.pipe(Schema_exports.brand("FolderId"));
|
|
@@ -26463,6 +26474,68 @@ var AuditEventId = Schema_exports.String.pipe(Schema_exports.brand("AuditEventId
|
|
|
26463
26474
|
var SessionControlEventId = Schema_exports.String.pipe(Schema_exports.brand("SessionControlEventId"));
|
|
26464
26475
|
var ChangeLandingId = Schema_exports.String.pipe(Schema_exports.brand("ChangeLandingId"));
|
|
26465
26476
|
|
|
26477
|
+
// ../../packages/domain/src/repository-url.ts
|
|
26478
|
+
var isSshScheme = (scheme) => /^(?:git\+)?ssh(?:\+git)?$/i.test(scheme);
|
|
26479
|
+
var authorityEnd = (text, from) => {
|
|
26480
|
+
const rest = text.slice(from).search(/[/?#]/u);
|
|
26481
|
+
return rest === -1 ? text.length : from + rest;
|
|
26482
|
+
};
|
|
26483
|
+
var keptUserinfo = (scheme, userinfo) => {
|
|
26484
|
+
if (!isSshScheme(scheme)) return "";
|
|
26485
|
+
const user = userinfo.split(":")[0] ?? "";
|
|
26486
|
+
return user === "" || user.includes("@") ? "" : `${user}@`;
|
|
26487
|
+
};
|
|
26488
|
+
var isSchemeChar = (char) => /[a-z0-9+.-]/iu.test(char);
|
|
26489
|
+
var schemeBefore = (text, separator, floor2) => {
|
|
26490
|
+
let start = separator;
|
|
26491
|
+
while (start > floor2 && isSchemeChar(text.charAt(start - 1))) start -= 1;
|
|
26492
|
+
while (start < separator && !/[a-z]/iu.test(text.charAt(start))) start += 1;
|
|
26493
|
+
return start < separator ? text.slice(start, separator) : null;
|
|
26494
|
+
};
|
|
26495
|
+
var redact4 = (text) => {
|
|
26496
|
+
let out = "";
|
|
26497
|
+
let copied = 0;
|
|
26498
|
+
let floor2 = 0;
|
|
26499
|
+
for (let separator = text.indexOf("://"); separator !== -1; ) {
|
|
26500
|
+
const authorityStart = separator + 3;
|
|
26501
|
+
const scheme = schemeBefore(text, separator, floor2);
|
|
26502
|
+
if (scheme !== null) {
|
|
26503
|
+
const authority = text.slice(authorityStart, authorityEnd(text, authorityStart));
|
|
26504
|
+
const at = authority.lastIndexOf("@");
|
|
26505
|
+
if (at !== -1) {
|
|
26506
|
+
const userinfo = authority.slice(0, at);
|
|
26507
|
+
const kept = keptUserinfo(scheme, userinfo);
|
|
26508
|
+
if (kept !== `${userinfo}@`) {
|
|
26509
|
+
out += `${text.slice(copied, authorityStart)}${kept}`;
|
|
26510
|
+
copied = authorityStart + at + 1;
|
|
26511
|
+
}
|
|
26512
|
+
}
|
|
26513
|
+
}
|
|
26514
|
+
floor2 = authorityStart;
|
|
26515
|
+
separator = text.indexOf("://", authorityStart);
|
|
26516
|
+
}
|
|
26517
|
+
return copied === 0 ? text : out + text.slice(copied);
|
|
26518
|
+
};
|
|
26519
|
+
var parsedCredential = (url) => {
|
|
26520
|
+
if (!URL.canParse(url)) return false;
|
|
26521
|
+
const parsed = new URL(url);
|
|
26522
|
+
const scheme = parsed.protocol.slice(0, -1);
|
|
26523
|
+
return parsed.password !== "" || parsed.username !== "" && !isSshScheme(scheme);
|
|
26524
|
+
};
|
|
26525
|
+
var clearedByParser = (url) => {
|
|
26526
|
+
const parsed = new URL(url);
|
|
26527
|
+
parsed.password = "";
|
|
26528
|
+
if (!isSshScheme(parsed.protocol.slice(0, -1))) parsed.username = "";
|
|
26529
|
+
return parsed.toString();
|
|
26530
|
+
};
|
|
26531
|
+
var redactUrlCredentials = (text) => redact4(text);
|
|
26532
|
+
var redactRepositoryUrl = (url) => {
|
|
26533
|
+
const scanned = redact4(url);
|
|
26534
|
+
return parsedCredential(scanned) ? clearedByParser(scanned) : scanned;
|
|
26535
|
+
};
|
|
26536
|
+
var repositoryUrlHasCredential = (url) => redactRepositoryUrl(url) !== url || parsedCredential(url);
|
|
26537
|
+
var REPOSITORY_URL_CREDENTIAL_GUIDANCE = 'This URL carries a login or token before the "@". Mend shows a repository URL to everyone who can see the repository, so it never stores one. Use the SSH URL (git@host:owner/repo.git) with your Mend key (`mend keys` shows it), or your own key through the agent bridge (`--auth bridge`).';
|
|
26538
|
+
|
|
26466
26539
|
// ../../packages/domain/src/settings.ts
|
|
26467
26540
|
var PrMode = Schema_exports.Literals(["draft-immediately", "pr-on-approval"]);
|
|
26468
26541
|
var onByDefault = Schema_exports.Boolean.pipe(Schema_exports.withDecodingDefaultKey(Effect_exports.succeed(true)));
|
|
@@ -26470,6 +26543,7 @@ var offByDefault = Schema_exports.Boolean.pipe(Schema_exports.withDecodingDefaul
|
|
|
26470
26543
|
var WorkspaceImageOs = Schema_exports.Literals(["fedora", "arch", "nix", "ubuntu"]);
|
|
26471
26544
|
var DEFAULT_WORKSPACE_PACKAGES = [
|
|
26472
26545
|
"pnpm",
|
|
26546
|
+
"bun",
|
|
26473
26547
|
"python",
|
|
26474
26548
|
"uv",
|
|
26475
26549
|
"mise",
|
|
@@ -26477,6 +26551,7 @@ var DEFAULT_WORKSPACE_PACKAGES = [
|
|
|
26477
26551
|
"lazygit",
|
|
26478
26552
|
"bat",
|
|
26479
26553
|
"curl",
|
|
26554
|
+
"unzip",
|
|
26480
26555
|
"jq",
|
|
26481
26556
|
"ripgrep",
|
|
26482
26557
|
"fd",
|
|
@@ -26663,7 +26738,10 @@ var Invitation = class extends Schema_exports.Class("Invitation")({
|
|
|
26663
26738
|
|
|
26664
26739
|
// ../../packages/domain/src/workbench/project.ts
|
|
26665
26740
|
var AutomationChoice = Schema_exports.Literals(["inherit", "on", "off"]);
|
|
26666
|
-
var GitAuthMode = Schema_exports.Literals(["
|
|
26741
|
+
var GitAuthMode = Schema_exports.Literals(["mend-key", "bridge"]);
|
|
26742
|
+
var RecordedGitAuthMode = Schema_exports.Literals(["ambient", "mend-key", "bridge"]);
|
|
26743
|
+
var RequestedGitAuthMode = Schema_exports.Literals(["mend-key", "bridge", "ambient"]);
|
|
26744
|
+
var AMBIENT_REMOVED_GUIDANCE = "Mend no longer has an ambient git mode: a packaged server holds no git or ssh credential of its own. Use your Mend key (`--auth mend-key`; `mend keys` prints it to add on your git host) or your own key through `mend keys share` (`--auth bridge`).";
|
|
26667
26745
|
var REPOSITORY_CLONE_URL_GUIDANCE = "Use an HTTP(S), SSH, SCP-style, or git:// repository URL. Local paths and file:// URLs are not supported.";
|
|
26668
26746
|
var isScpStyleGitUrl = (value3) => /^(?:[^@\s/:[\]]+@)?(?:\[[0-9a-fA-F:]+\]|[a-zA-Z0-9][a-zA-Z0-9.-]*):[^:\s\\][^\s\\]*$/.test(
|
|
26669
26747
|
value3
|
|
@@ -26690,6 +26768,7 @@ var repositoryCloneUrlIssue = (value3) => {
|
|
|
26690
26768
|
!/^(?:[a-z0-9_-]+(?:\.[a-z0-9_-]+)*\.?|\[[0-9a-f:.]+\])$/i.test(url.hostname)) {
|
|
26691
26769
|
return REPOSITORY_CLONE_URL_GUIDANCE;
|
|
26692
26770
|
}
|
|
26771
|
+
if (repositoryUrlHasCredential(value3)) return REPOSITORY_URL_CREDENTIAL_GUIDANCE;
|
|
26693
26772
|
return null;
|
|
26694
26773
|
};
|
|
26695
26774
|
var RepositoryCloneUrl = Schema_exports.String.pipe(
|
|
@@ -26771,11 +26850,150 @@ var Project = class extends Schema_exports.Class("Project")({
|
|
|
26771
26850
|
installCommand: Schema_exports.NullOr(Schema_exports.String).pipe(
|
|
26772
26851
|
Schema_exports.withDecodingDefaultKey(Effect_exports.succeed(null))
|
|
26773
26852
|
),
|
|
26853
|
+
/**
|
|
26854
|
+
* "Automatic install": whether Mend runs the install command above (or the detected one) at
|
|
26855
|
+
* all. Off, neither a session's launch nor the install job runs one; restoring a dependency
|
|
26856
|
+
* tree from saved state, or a standby's from the shared cache, is unaffected. Older values
|
|
26857
|
+
* decode to on.
|
|
26858
|
+
*/
|
|
26859
|
+
installEnabled: Schema_exports.Boolean.pipe(Schema_exports.withDecodingDefaultKey(Effect_exports.succeed(true))),
|
|
26774
26860
|
createdAt: Timestamp,
|
|
26775
26861
|
updatedAt: Timestamp
|
|
26776
26862
|
}) {
|
|
26777
26863
|
};
|
|
26778
26864
|
|
|
26865
|
+
// ../../packages/domain/src/workbench/agent-memory.ts
|
|
26866
|
+
var AGENT_MEMORY_ROOTS = [
|
|
26867
|
+
{ harness: "claude", root: ".claude/projects/-workspace-repo/memory" },
|
|
26868
|
+
{ harness: "codex", root: ".codex/memories" },
|
|
26869
|
+
// Mend's own: the first line of each conversation Codex summarised on another machine
|
|
26870
|
+
// (`mend memory import`), so a session can list that conversation for Codex again.
|
|
26871
|
+
{ harness: "codex", root: ".mend/codex-threads" }
|
|
26872
|
+
];
|
|
26873
|
+
var AGENT_MEMORY_FILES = [{ harness: "codex", path: ".codex/memories_1.sqlite" }];
|
|
26874
|
+
var CODEX_MEMORY_DATABASE = ".codex/memories_1.sqlite";
|
|
26875
|
+
var AGENT_MEMORY_MAX_FILE_BYTES = 1024 * 1024;
|
|
26876
|
+
var AGENT_MEMORY_MAX_DATABASE_BYTES = 16 * 1024 * 1024;
|
|
26877
|
+
var AGENT_MEMORY_MAX_BYTES = 32 * 1024 * 1024;
|
|
26878
|
+
var AgentMemoryFile = class extends Schema_exports.Class("AgentMemoryFile")({
|
|
26879
|
+
path: Schema_exports.String,
|
|
26880
|
+
encoding: Schema_exports.Literals(["utf8", "base64"]),
|
|
26881
|
+
contents: Schema_exports.String
|
|
26882
|
+
}) {
|
|
26883
|
+
};
|
|
26884
|
+
var AgentMemoryEntry = class extends Schema_exports.Class("AgentMemoryEntry")({
|
|
26885
|
+
path: Schema_exports.String,
|
|
26886
|
+
/** Which harness keeps it. */
|
|
26887
|
+
harness: Schema_exports.String,
|
|
26888
|
+
/** Its path under that harness's memory root: what a person calls it. */
|
|
26889
|
+
name: Schema_exports.String,
|
|
26890
|
+
bytes: Schema_exports.Int,
|
|
26891
|
+
digest: Schema_exports.String,
|
|
26892
|
+
updatedAt: Timestamp,
|
|
26893
|
+
/** The session whose agent last wrote it, or null for an import. */
|
|
26894
|
+
updatedBySession: Schema_exports.NullOr(Schema_exports.String)
|
|
26895
|
+
}) {
|
|
26896
|
+
};
|
|
26897
|
+
var AgentMemoryView = class extends Schema_exports.Class("AgentMemoryView")({
|
|
26898
|
+
files: Schema_exports.Array(AgentMemoryEntry)
|
|
26899
|
+
}) {
|
|
26900
|
+
};
|
|
26901
|
+
var AgentMemoryFileView = class extends Schema_exports.Class("AgentMemoryFileView")({
|
|
26902
|
+
entry: AgentMemoryEntry,
|
|
26903
|
+
encoding: Schema_exports.Literals(["utf8", "base64"]),
|
|
26904
|
+
contents: Schema_exports.String
|
|
26905
|
+
}) {
|
|
26906
|
+
};
|
|
26907
|
+
var AgentMemoryImportSource = class extends Schema_exports.Class(
|
|
26908
|
+
"AgentMemoryImportSource"
|
|
26909
|
+
)({
|
|
26910
|
+
/** Stable for that checkout on that machine: the CLI's machine id and the checkout's path. */
|
|
26911
|
+
id: Schema_exports.String.check(Schema_exports.isMinLength(1), Schema_exports.isMaxLength(1024)),
|
|
26912
|
+
/** What a merge calls the machine where it has to say so: its host name. */
|
|
26913
|
+
label: Schema_exports.String.check(Schema_exports.isMinLength(1), Schema_exports.isMaxLength(64))
|
|
26914
|
+
}) {
|
|
26915
|
+
};
|
|
26916
|
+
var AgentMemoryImport = class extends Schema_exports.Class("AgentMemoryImport")({
|
|
26917
|
+
files: Schema_exports.Array(AgentMemoryFile),
|
|
26918
|
+
/** Absent from an older CLI: nothing is recorded then, and no merge has a shared version. */
|
|
26919
|
+
source: Schema_exports.optional(AgentMemoryImportSource)
|
|
26920
|
+
}) {
|
|
26921
|
+
};
|
|
26922
|
+
var AgentMemoryImportMerge = class extends Schema_exports.Class(
|
|
26923
|
+
"AgentMemoryImportMerge"
|
|
26924
|
+
)({
|
|
26925
|
+
path: Schema_exports.String,
|
|
26926
|
+
/**
|
|
26927
|
+
* - `last-import`: text, three-way against what this machine sent the last time;
|
|
26928
|
+
* - `no-shared-version`: text, both sides' lines with no version to diff against;
|
|
26929
|
+
* - `summaries`: Codex's summary database, each conversation's newer summary from either.
|
|
26930
|
+
*/
|
|
26931
|
+
against: Schema_exports.Literals(["last-import", "no-shared-version", "summaries"]),
|
|
26932
|
+
/**
|
|
26933
|
+
* How many of this machine's lines the result does not hold (a line Mend removed since the last
|
|
26934
|
+
* import is not counted). When any, this machine's file is kept whole as a version, and the next
|
|
26935
|
+
* import from there merges it again.
|
|
26936
|
+
*/
|
|
26937
|
+
missingLines: Schema_exports.Int,
|
|
26938
|
+
/**
|
|
26939
|
+
* How many of Mend's lines the result does not hold (a line this machine removed since its last
|
|
26940
|
+
* import is not counted). Mend's file is always kept as a version, pinned when it is the only
|
|
26941
|
+
* copy of a line.
|
|
26942
|
+
*/
|
|
26943
|
+
storeMissingLines: Schema_exports.Int
|
|
26944
|
+
}) {
|
|
26945
|
+
};
|
|
26946
|
+
var AgentMemoryImported = class extends Schema_exports.Class("AgentMemoryImported")({
|
|
26947
|
+
/** Not in Mend: stored as this machine has it. */
|
|
26948
|
+
added: Schema_exports.Array(Schema_exports.String),
|
|
26949
|
+
/** The same on both sides. */
|
|
26950
|
+
unchanged: Schema_exports.Array(Schema_exports.String),
|
|
26951
|
+
/** Unchanged in Mend since this machine's last import: replaced by this machine's. */
|
|
26952
|
+
updated: Schema_exports.Array(Schema_exports.String),
|
|
26953
|
+
/** Changed on both sides: merged, keeping both sides' lines. */
|
|
26954
|
+
merged: Schema_exports.Array(AgentMemoryImportMerge),
|
|
26955
|
+
/** Unchanged on this machine since its last import and changed in Mend: Mend's stays. */
|
|
26956
|
+
keptStored: Schema_exports.Array(Schema_exports.String),
|
|
26957
|
+
/** Removed in Mend since this machine's last import, unchanged here: not added again. */
|
|
26958
|
+
removedInMend: Schema_exports.Array(Schema_exports.String),
|
|
26959
|
+
/**
|
|
26960
|
+
* Changed on both sides and not mergeable: not text, frontmatter that differs outside the subset
|
|
26961
|
+
* merged by key, too different to align with no earlier import, or merged over the size limit.
|
|
26962
|
+
* Mend's stays, this machine's is kept as a version, and the next import reports it again.
|
|
26963
|
+
*/
|
|
26964
|
+
conflicting: Schema_exports.Array(Schema_exports.String),
|
|
26965
|
+
/** Outside the limits (path, size or count): not stored. */
|
|
26966
|
+
skipped: Schema_exports.Array(Schema_exports.String)
|
|
26967
|
+
}) {
|
|
26968
|
+
};
|
|
26969
|
+
var AgentMemoryRemoved = class extends Schema_exports.Class("AgentMemoryRemoved")({
|
|
26970
|
+
removed: Schema_exports.Boolean
|
|
26971
|
+
}) {
|
|
26972
|
+
};
|
|
26973
|
+
var agentMemoryNameOf = (filePath) => {
|
|
26974
|
+
for (const { harness, root } of AGENT_MEMORY_ROOTS) {
|
|
26975
|
+
if (filePath.startsWith(`${root}/`)) return { harness, name: filePath.slice(root.length + 1) };
|
|
26976
|
+
}
|
|
26977
|
+
for (const { harness, path: file } of AGENT_MEMORY_FILES) {
|
|
26978
|
+
if (filePath === file) return { harness, name: file.slice(file.lastIndexOf("/") + 1) };
|
|
26979
|
+
}
|
|
26980
|
+
return null;
|
|
26981
|
+
};
|
|
26982
|
+
var agentMemoryPathOf = (name) => {
|
|
26983
|
+
if (name.startsWith(".")) return name;
|
|
26984
|
+
const qualified = /^([a-z]+):(.+)$/.exec(name);
|
|
26985
|
+
const harness = qualified?.[1] ?? null;
|
|
26986
|
+
const rest = qualified?.[2] ?? name;
|
|
26987
|
+
const single = AGENT_MEMORY_FILES.find(
|
|
26988
|
+
(file) => (harness === null || file.harness === harness) && file.path.endsWith(`/${rest}`)
|
|
26989
|
+
);
|
|
26990
|
+
if (single !== void 0) return single.path;
|
|
26991
|
+
const root = AGENT_MEMORY_ROOTS.find(
|
|
26992
|
+
(candidate) => candidate.harness === (harness ?? "claude")
|
|
26993
|
+
)?.root;
|
|
26994
|
+
return root === void 0 ? name : `${root}/${rest}`;
|
|
26995
|
+
};
|
|
26996
|
+
|
|
26779
26997
|
// ../../packages/domain/src/workbench/connected-credential.ts
|
|
26780
26998
|
var CLAUDE_GRANT_SECTION = "claudeAiOauth";
|
|
26781
26999
|
var narrowCredential = (provider, secret) => {
|
|
@@ -26834,6 +27052,165 @@ var sameGrant = (left, right) => {
|
|
|
26834
27052
|
return a !== null && b !== null && a === b;
|
|
26835
27053
|
};
|
|
26836
27054
|
|
|
27055
|
+
// ../../packages/domain/src/workbench/launch-phase.ts
|
|
27056
|
+
var LAUNCH_WAITING_PREFIX = "waiting \xB7 the previous session in this worktree";
|
|
27057
|
+
var LAUNCH_WAITING_SAVING = `${LAUNCH_WAITING_PREFIX} is saving`;
|
|
27058
|
+
var LAUNCH_BOOTING = "booting";
|
|
27059
|
+
var LAUNCH_QUEUED = "queued \xB7 waiting for a worker";
|
|
27060
|
+
var LAUNCH_BUILDING_PREFIX = "building the workspace image";
|
|
27061
|
+
var LAUNCH_PREPARING = "preparing the workspace \xB7 no runtime yet \xB7 after an update, building the image takes about 8 minutes";
|
|
27062
|
+
var LAUNCH_BUILDING_IMAGE_LEGACY = "building the workspace image (first launch after an update, ~8 min)";
|
|
27063
|
+
var LAUNCH_PHASE_PREFIXES = [
|
|
27064
|
+
LAUNCH_WAITING_PREFIX,
|
|
27065
|
+
LAUNCH_BOOTING,
|
|
27066
|
+
LAUNCH_QUEUED,
|
|
27067
|
+
LAUNCH_PREPARING,
|
|
27068
|
+
LAUNCH_BUILDING_IMAGE_LEGACY,
|
|
27069
|
+
LAUNCH_BUILDING_PREFIX
|
|
27070
|
+
];
|
|
27071
|
+
var phaseWordsOf = (summary) => {
|
|
27072
|
+
for (const prefix of LAUNCH_PHASE_PREFIXES) {
|
|
27073
|
+
if (summary.startsWith(prefix)) return { at: 0, words: summary };
|
|
27074
|
+
const at = summary.indexOf(` \xB7 ${prefix}`);
|
|
27075
|
+
if (at >= 0) return { at, words: summary.slice(at + 3) };
|
|
27076
|
+
}
|
|
27077
|
+
return null;
|
|
27078
|
+
};
|
|
27079
|
+
var withoutLaunchPhase = (summary) => {
|
|
27080
|
+
if (summary === null) return null;
|
|
27081
|
+
const phase = phaseWordsOf(summary);
|
|
27082
|
+
if (phase === null) return summary;
|
|
27083
|
+
return phase.at === 0 ? null : summary.slice(0, phase.at);
|
|
27084
|
+
};
|
|
27085
|
+
var launchPhaseOf = (summary) => {
|
|
27086
|
+
if (summary === null) return null;
|
|
27087
|
+
const phase = phaseWordsOf(summary);
|
|
27088
|
+
if (phase === null) return null;
|
|
27089
|
+
if (phase.words.startsWith(LAUNCH_WAITING_PREFIX)) {
|
|
27090
|
+
return { kind: "waiting-previous", words: phase.words };
|
|
27091
|
+
}
|
|
27092
|
+
if (phase.words.startsWith(LAUNCH_BOOTING)) return { kind: "booting", words: phase.words };
|
|
27093
|
+
if (phase.words.startsWith(LAUNCH_QUEUED)) return { kind: "queued", words: phase.words };
|
|
27094
|
+
if (phase.words === LAUNCH_BUILDING_IMAGE_LEGACY)
|
|
27095
|
+
return { kind: "preparing", words: phase.words };
|
|
27096
|
+
if (phase.words.startsWith(LAUNCH_BUILDING_PREFIX)) {
|
|
27097
|
+
return { kind: "building", words: phase.words };
|
|
27098
|
+
}
|
|
27099
|
+
return { kind: "preparing", words: phase.words };
|
|
27100
|
+
};
|
|
27101
|
+
|
|
27102
|
+
// ../../packages/domain/src/workbench/pi-profile.ts
|
|
27103
|
+
var PI_PROFILE_AGENT_PATH = "mend/profile";
|
|
27104
|
+
var PI_PROFILE_LOCAL_PACKAGES = "packages";
|
|
27105
|
+
var PI_PROFILE_DIRECTORIES = ["extensions", "themes", "prompts", "packages"];
|
|
27106
|
+
var PI_PROFILE_FILES = [
|
|
27107
|
+
"settings.json",
|
|
27108
|
+
"package.json",
|
|
27109
|
+
"package-lock.json",
|
|
27110
|
+
"root/mcp.json",
|
|
27111
|
+
"root/keybindings.json"
|
|
27112
|
+
];
|
|
27113
|
+
var PI_PROFILE_MAX_FILES = 4e3;
|
|
27114
|
+
var PI_PROFILE_MAX_FILE_BYTES = 8 * 1024 * 1024;
|
|
27115
|
+
var PI_PROFILE_MAX_BYTES = 16 * 1024 * 1024;
|
|
27116
|
+
var PI_PROFILE_MAX_PATH_LENGTH = 512;
|
|
27117
|
+
var PiProfileFile = class extends Schema_exports.Class("PiProfileFile")({
|
|
27118
|
+
/** Profile-relative POSIX path; validated by `validatePiProfileFilePath`. */
|
|
27119
|
+
path: Schema_exports.String,
|
|
27120
|
+
encoding: Schema_exports.Literals(["utf8", "base64"]),
|
|
27121
|
+
contents: Schema_exports.String
|
|
27122
|
+
}) {
|
|
27123
|
+
};
|
|
27124
|
+
var PiProfile = class extends Schema_exports.Class("PiProfile")({
|
|
27125
|
+
fileCount: Schema_exports.Int,
|
|
27126
|
+
bytes: Schema_exports.Int,
|
|
27127
|
+
/** The profile's top-level extensions: each file or directory under `extensions/`. */
|
|
27128
|
+
extensions: Schema_exports.Array(Schema_exports.String),
|
|
27129
|
+
/** The packages its `settings.json` declares, each as its source. */
|
|
27130
|
+
packages: Schema_exports.Array(Schema_exports.String),
|
|
27131
|
+
/** Changes whenever the files do: the tree digest a session compares against. */
|
|
27132
|
+
digest: Schema_exports.String,
|
|
27133
|
+
revision: Schema_exports.Int,
|
|
27134
|
+
updatedAt: Timestamp
|
|
27135
|
+
}) {
|
|
27136
|
+
};
|
|
27137
|
+
var PiProfileView = class extends Schema_exports.Class("PiProfileView")({
|
|
27138
|
+
profile: Schema_exports.NullOr(PiProfile)
|
|
27139
|
+
}) {
|
|
27140
|
+
};
|
|
27141
|
+
var PiProfileUpload = class extends Schema_exports.Class("PiProfileUpload")({
|
|
27142
|
+
files: Schema_exports.Array(PiProfileFile)
|
|
27143
|
+
}) {
|
|
27144
|
+
};
|
|
27145
|
+
var PiProfileSaved = class extends Schema_exports.Class("PiProfileSaved")({
|
|
27146
|
+
profile: PiProfile,
|
|
27147
|
+
changed: Schema_exports.Boolean
|
|
27148
|
+
}) {
|
|
27149
|
+
};
|
|
27150
|
+
var PiProfileRemoved = class extends Schema_exports.Class("PiProfileRemoved")({
|
|
27151
|
+
removed: Schema_exports.Boolean
|
|
27152
|
+
}) {
|
|
27153
|
+
};
|
|
27154
|
+
var piProfileFileBytes = (file) => {
|
|
27155
|
+
if (file.encoding === "utf8") return new TextEncoder().encode(file.contents);
|
|
27156
|
+
if (!/^[A-Za-z0-9+/]*={0,2}$/.test(file.contents) || file.contents.length % 4 !== 0) return null;
|
|
27157
|
+
try {
|
|
27158
|
+
return Uint8Array.from(atob(file.contents), (char) => char.charCodeAt(0));
|
|
27159
|
+
} catch {
|
|
27160
|
+
return null;
|
|
27161
|
+
}
|
|
27162
|
+
};
|
|
27163
|
+
var validatePiProfileFilePath = (filePath) => {
|
|
27164
|
+
if (filePath.length === 0) return "a file path is required";
|
|
27165
|
+
if (filePath.length > PI_PROFILE_MAX_PATH_LENGTH) {
|
|
27166
|
+
return `${filePath} is longer than ${PI_PROFILE_MAX_PATH_LENGTH} characters`;
|
|
27167
|
+
}
|
|
27168
|
+
if (filePath.startsWith("/") || filePath.includes("\\") || filePath.includes("\0")) {
|
|
27169
|
+
return `${filePath} is not a relative POSIX path`;
|
|
27170
|
+
}
|
|
27171
|
+
const segments = filePath.split("/");
|
|
27172
|
+
if (segments.some((segment) => segment === "" || segment === "." || segment === "..")) {
|
|
27173
|
+
return `${filePath} must not contain empty, "." or ".." segments`;
|
|
27174
|
+
}
|
|
27175
|
+
if (PI_PROFILE_FILES.some((file) => file === filePath)) return null;
|
|
27176
|
+
const top = segments[0] ?? "";
|
|
27177
|
+
if (segments.length > 1 && PI_PROFILE_DIRECTORIES.some((directory) => directory === top)) {
|
|
27178
|
+
return null;
|
|
27179
|
+
}
|
|
27180
|
+
return `${filePath} is not part of a pi profile`;
|
|
27181
|
+
};
|
|
27182
|
+
var validatePiProfile = (files) => {
|
|
27183
|
+
if (files.length === 0) return "a pi profile needs at least one file";
|
|
27184
|
+
if (files.length > PI_PROFILE_MAX_FILES) {
|
|
27185
|
+
return `a pi profile is capped at ${PI_PROFILE_MAX_FILES} files`;
|
|
27186
|
+
}
|
|
27187
|
+
const seen = /* @__PURE__ */ new Set();
|
|
27188
|
+
let total = 0;
|
|
27189
|
+
for (const file of files) {
|
|
27190
|
+
const pathIssue = validatePiProfileFilePath(file.path);
|
|
27191
|
+
if (pathIssue !== null) return pathIssue;
|
|
27192
|
+
if (seen.has(file.path)) return `${file.path} appears twice`;
|
|
27193
|
+
seen.add(file.path);
|
|
27194
|
+
const bytes = piProfileFileBytes(file);
|
|
27195
|
+
if (bytes === null) return `${file.path} is not valid base64`;
|
|
27196
|
+
if (bytes.byteLength > PI_PROFILE_MAX_FILE_BYTES) {
|
|
27197
|
+
return `${file.path} is over ${PI_PROFILE_MAX_FILE_BYTES / (1024 * 1024)} MB`;
|
|
27198
|
+
}
|
|
27199
|
+
total += bytes.byteLength;
|
|
27200
|
+
}
|
|
27201
|
+
for (const filePath of seen) {
|
|
27202
|
+
const segments = filePath.split("/");
|
|
27203
|
+
for (let depth = 1; depth < segments.length; depth += 1) {
|
|
27204
|
+
const parent = segments.slice(0, depth).join("/");
|
|
27205
|
+
if (seen.has(parent)) return `${parent} is both a file and a directory`;
|
|
27206
|
+
}
|
|
27207
|
+
}
|
|
27208
|
+
if (total > PI_PROFILE_MAX_BYTES) {
|
|
27209
|
+
return `a pi profile is capped at ${PI_PROFILE_MAX_BYTES / (1024 * 1024)} MB in total`;
|
|
27210
|
+
}
|
|
27211
|
+
return null;
|
|
27212
|
+
};
|
|
27213
|
+
|
|
26837
27214
|
// ../../packages/domain/src/workbench/audit.ts
|
|
26838
27215
|
var AuditAction = Schema_exports.Literals([
|
|
26839
27216
|
"invitation.created",
|
|
@@ -26851,6 +27228,9 @@ var AuditAction = Schema_exports.Literals([
|
|
|
26851
27228
|
"session.shared_control_off",
|
|
26852
27229
|
// The owner ended a session's workspace with captures still pending: work was discarded.
|
|
26853
27230
|
"session.unsaved_discarded",
|
|
27231
|
+
// Mend stopped a session whose owner no longer has access to where it ran (mend#558): a removed
|
|
27232
|
+
// member, or a joiner who can no longer see the project. The session's owner is the actor.
|
|
27233
|
+
"session.stopped_no_access",
|
|
26854
27234
|
"member.password_reset_issued",
|
|
26855
27235
|
"organization.created",
|
|
26856
27236
|
"organization.renamed",
|
|
@@ -26874,7 +27254,14 @@ var AuditAction = Schema_exports.Literals([
|
|
|
26874
27254
|
"change.pull_request_refreshed",
|
|
26875
27255
|
"change.bundle_downloaded",
|
|
26876
27256
|
// A pull request opened outside Mend was read with the owner's `gh` and recorded.
|
|
26877
|
-
"change.pull_request_adopted"
|
|
27257
|
+
"change.pull_request_adopted",
|
|
27258
|
+
// docs/WORKSPACE-SSH.md: a key the workspace SSH gateway accepts for an account was registered,
|
|
27259
|
+
// or archived so the gateway refuses it. The subject is the member who holds the key.
|
|
27260
|
+
"ssh_key.added",
|
|
27261
|
+
"ssh_key.removed",
|
|
27262
|
+
// A member was removed and some of their keys are still active (or unread): Mend keeps trying,
|
|
27263
|
+
// and each key it archives later is its own `ssh_key.removed`.
|
|
27264
|
+
"ssh_key.revocation_pending"
|
|
26878
27265
|
]);
|
|
26879
27266
|
var AuditData = Schema_exports.Record(
|
|
26880
27267
|
Schema_exports.String,
|
|
@@ -26898,6 +27285,13 @@ var AuditEvent = class extends Schema_exports.Class("AuditEvent")({
|
|
|
26898
27285
|
}) {
|
|
26899
27286
|
};
|
|
26900
27287
|
|
|
27288
|
+
// ../../packages/domain/src/workbench/agent-logins.ts
|
|
27289
|
+
var AgentLogins = class extends Schema_exports.Class("AgentLogins")({
|
|
27290
|
+
selectedOnly: Schema_exports.Boolean
|
|
27291
|
+
}) {
|
|
27292
|
+
};
|
|
27293
|
+
var DEFAULT_AGENT_LOGINS = new AgentLogins({ selectedOnly: false });
|
|
27294
|
+
|
|
26901
27295
|
// ../../packages/domain/src/workbench/landing.ts
|
|
26902
27296
|
var LandingTrigger = Schema_exports.Literals(["manual", "automatic", "adopted"]);
|
|
26903
27297
|
var LandingOutcome = Schema_exports.Literals([
|
|
@@ -26912,8 +27306,14 @@ var LandedPullRequest = Schema_exports.Struct({
|
|
|
26912
27306
|
number: Schema_exports.Int,
|
|
26913
27307
|
url: Schema_exports.String,
|
|
26914
27308
|
state: PullRequestState,
|
|
27309
|
+
/** Its title as `gh` last reported it; null when recorded before Mend kept it. */
|
|
27310
|
+
title: Schema_exports.NullOr(Schema_exports.String).pipe(Schema_exports.withDecodingDefaultKey(Effect_exports.succeed(null))),
|
|
26915
27311
|
observedAt: Timestamp
|
|
26916
27312
|
});
|
|
27313
|
+
var ChangePullRequest = Schema_exports.Struct({
|
|
27314
|
+
...LandedPullRequest.fields,
|
|
27315
|
+
adopted: Schema_exports.Boolean
|
|
27316
|
+
});
|
|
26917
27317
|
var ChangeLanding = class extends Schema_exports.Class("ChangeLanding")({
|
|
26918
27318
|
id: ChangeLandingId,
|
|
26919
27319
|
changeId: ChangeId,
|
|
@@ -27102,6 +27502,7 @@ var AgentTurnUsage = Schema_exports.Struct({
|
|
|
27102
27502
|
totalTokens: Schema_exports.NullOr(Schema_exports.Int),
|
|
27103
27503
|
contextWindow: Schema_exports.NullOr(Schema_exports.Int)
|
|
27104
27504
|
});
|
|
27505
|
+
var AgentTurnOrigin = Schema_exports.Literals(["request", "harness"]);
|
|
27105
27506
|
var AgentTurn = class extends Schema_exports.Class("AgentTurn")({
|
|
27106
27507
|
id: AgentTurnId,
|
|
27107
27508
|
sessionId: SessionId,
|
|
@@ -27110,6 +27511,10 @@ var AgentTurn = class extends Schema_exports.Class("AgentTurn")({
|
|
|
27110
27511
|
ordinal: Schema_exports.Int,
|
|
27111
27512
|
/** Mend user id, or null for a system-authored follow-up. */
|
|
27112
27513
|
author: Schema_exports.NullOr(Schema_exports.String),
|
|
27514
|
+
/** What opened the turn. A `harness` turn's input is what the agent was answering. */
|
|
27515
|
+
origin: AgentTurnOrigin.pipe(
|
|
27516
|
+
Schema_exports.withConstructorDefault(Effect_exports.succeed("request"))
|
|
27517
|
+
),
|
|
27113
27518
|
input: Schema_exports.String,
|
|
27114
27519
|
status: AgentTurnStatus,
|
|
27115
27520
|
providerTurnId: Schema_exports.NullOr(Schema_exports.String),
|
|
@@ -27132,6 +27537,24 @@ var AgentTurn = class extends Schema_exports.Class("AgentTurn")({
|
|
|
27132
27537
|
landingId: Schema_exports.NullOr(ChangeLandingId).pipe(
|
|
27133
27538
|
Schema_exports.withConstructorDefault(Effect_exports.succeed(null))
|
|
27134
27539
|
),
|
|
27540
|
+
/**
|
|
27541
|
+
* Whose login the turn ran on (`TurnPayer`), recorded when Mend sent it or the harness opened
|
|
27542
|
+
* it. Null on a turn never sent, one recorded before payers were, and where Mend cannot say.
|
|
27543
|
+
*/
|
|
27544
|
+
billedUserId: Schema_exports.NullOr(Schema_exports.String).pipe(
|
|
27545
|
+
Schema_exports.withDecodingDefaultKey(Effect_exports.succeed(null)),
|
|
27546
|
+
Schema_exports.withConstructorDefault(Effect_exports.succeed(null))
|
|
27547
|
+
),
|
|
27548
|
+
/** The connected account's id as Core reported it; null until Core reports one. */
|
|
27549
|
+
billedAccountId: Schema_exports.NullOr(Schema_exports.String).pipe(
|
|
27550
|
+
Schema_exports.withDecodingDefaultKey(Effect_exports.succeed(null)),
|
|
27551
|
+
Schema_exports.withConstructorDefault(Effect_exports.succeed(null))
|
|
27552
|
+
),
|
|
27553
|
+
/** The connected account's name when the turn ran (`default`, `work`). */
|
|
27554
|
+
billedAccountName: Schema_exports.NullOr(Schema_exports.String).pipe(
|
|
27555
|
+
Schema_exports.withDecodingDefaultKey(Effect_exports.succeed(null)),
|
|
27556
|
+
Schema_exports.withConstructorDefault(Effect_exports.succeed(null))
|
|
27557
|
+
),
|
|
27135
27558
|
createdAt: Timestamp,
|
|
27136
27559
|
startedAt: Schema_exports.NullOr(Timestamp),
|
|
27137
27560
|
endedAt: Schema_exports.NullOr(Timestamp)
|
|
@@ -27146,6 +27569,8 @@ var AgentItemKind = Schema_exports.Literals([
|
|
|
27146
27569
|
"file-change",
|
|
27147
27570
|
"tool-call",
|
|
27148
27571
|
"web-search",
|
|
27572
|
+
/** A background task the agent started: a workflow, a background agent or command. */
|
|
27573
|
+
"task",
|
|
27149
27574
|
"error",
|
|
27150
27575
|
"other"
|
|
27151
27576
|
]);
|
|
@@ -27218,6 +27643,43 @@ var AgentRequest = class extends Schema_exports.Class("AgentRequest")({
|
|
|
27218
27643
|
decidedAt: Schema_exports.NullOr(Timestamp)
|
|
27219
27644
|
}) {
|
|
27220
27645
|
};
|
|
27646
|
+
var AgentTaskStatus = Schema_exports.Literals([
|
|
27647
|
+
"running",
|
|
27648
|
+
"completed",
|
|
27649
|
+
"failed",
|
|
27650
|
+
"stopped",
|
|
27651
|
+
"paused"
|
|
27652
|
+
]);
|
|
27653
|
+
var AgentTaskAgent = Schema_exports.Struct({
|
|
27654
|
+
index: Schema_exports.Int,
|
|
27655
|
+
label: Schema_exports.String,
|
|
27656
|
+
phaseIndex: Schema_exports.NullOr(Schema_exports.Int),
|
|
27657
|
+
state: Schema_exports.String,
|
|
27658
|
+
model: Schema_exports.NullOr(Schema_exports.String),
|
|
27659
|
+
tokens: Schema_exports.NullOr(Schema_exports.Int),
|
|
27660
|
+
toolCalls: Schema_exports.NullOr(Schema_exports.Int),
|
|
27661
|
+
durationMs: Schema_exports.NullOr(Schema_exports.Int),
|
|
27662
|
+
lastTool: Schema_exports.NullOr(Schema_exports.String),
|
|
27663
|
+
/** The start of the agent's result, or of its error. */
|
|
27664
|
+
preview: Schema_exports.NullOr(Schema_exports.String)
|
|
27665
|
+
});
|
|
27666
|
+
var AgentTaskData = Schema_exports.Struct({
|
|
27667
|
+
taskId: Schema_exports.String,
|
|
27668
|
+
/** The harness's task type: `local_workflow`, `local_agent`, `local_bash`, … */
|
|
27669
|
+
taskType: Schema_exports.String,
|
|
27670
|
+
/** The workflow's name, when the task is one. */
|
|
27671
|
+
workflow: Schema_exports.NullOr(Schema_exports.String),
|
|
27672
|
+
description: Schema_exports.String,
|
|
27673
|
+
status: AgentTaskStatus,
|
|
27674
|
+
/** The harness's closing line, once the task ended. */
|
|
27675
|
+
summary: Schema_exports.NullOr(Schema_exports.String),
|
|
27676
|
+
error: Schema_exports.NullOr(Schema_exports.String),
|
|
27677
|
+
phases: Schema_exports.Array(Schema_exports.Struct({ index: Schema_exports.Int, title: Schema_exports.String })),
|
|
27678
|
+
agents: Schema_exports.Array(AgentTaskAgent),
|
|
27679
|
+
totalTokens: Schema_exports.NullOr(Schema_exports.Int),
|
|
27680
|
+
toolUses: Schema_exports.NullOr(Schema_exports.Int),
|
|
27681
|
+
durationMs: Schema_exports.NullOr(Schema_exports.Int)
|
|
27682
|
+
});
|
|
27221
27683
|
var AgentEventItem = Schema_exports.Struct({
|
|
27222
27684
|
providerItemId: Schema_exports.String,
|
|
27223
27685
|
providerTurnId: Schema_exports.String,
|
|
@@ -27243,6 +27705,11 @@ var AgentEvent = Schema_exports.Union([
|
|
|
27243
27705
|
Schema_exports.TaggedStruct("turn.started", {
|
|
27244
27706
|
providerTurnId: Schema_exports.String
|
|
27245
27707
|
}),
|
|
27708
|
+
/** The agent started a turn nobody sent; `reason` is what it is answering, when known. */
|
|
27709
|
+
Schema_exports.TaggedStruct("harness-turn.started", {
|
|
27710
|
+
providerTurnId: Schema_exports.String,
|
|
27711
|
+
reason: Schema_exports.String
|
|
27712
|
+
}),
|
|
27246
27713
|
Schema_exports.TaggedStruct("turn.completed", {
|
|
27247
27714
|
providerTurnId: Schema_exports.String,
|
|
27248
27715
|
status: Schema_exports.Literals(["completed", "interrupted", "failed", "cancelled"]),
|
|
@@ -27265,6 +27732,7 @@ var AgentEvent = Schema_exports.Union([
|
|
|
27265
27732
|
var CaptureDrainReason = Schema_exports.Literals(["stop", "relaunch", "replacement"]);
|
|
27266
27733
|
var FALLBACK_REPLACEMENT_AGE_SECONDS = 7 * 60 * 60 + 30 * 60;
|
|
27267
27734
|
var CAPTURE_EXECUTOR_RETAINED = "retained";
|
|
27735
|
+
var CAPTURE_SEAL_UNRESTORABLE = "unrestorable";
|
|
27268
27736
|
var CAPTURE_COMPLETION_UNREPORTED = "unreported";
|
|
27269
27737
|
var captureDurationWords = (ms) => {
|
|
27270
27738
|
const seconds2 = Math.max(0, Math.floor(ms / 1e3));
|
|
@@ -27324,6 +27792,8 @@ var captureIncompleteWords = (reason) => {
|
|
|
27324
27792
|
return "executor error";
|
|
27325
27793
|
case CAPTURE_EXECUTOR_RETAINED:
|
|
27326
27794
|
return "executor kept for recovery";
|
|
27795
|
+
case CAPTURE_SEAL_UNRESTORABLE:
|
|
27796
|
+
return "final seal refused \xB7 git section failed verification";
|
|
27327
27797
|
default:
|
|
27328
27798
|
return reason;
|
|
27329
27799
|
}
|
|
@@ -27371,8 +27841,9 @@ var captureStatusLine = (facts) => {
|
|
|
27371
27841
|
...facts.captureIncompleteReason === CAPTURE_EXECUTOR_RETAINED ? [] : ["workspace kept"]
|
|
27372
27842
|
].join(" \xB7 ");
|
|
27373
27843
|
}
|
|
27844
|
+
const noneQueued = facts.capturePendingBytes === 0 || facts.capturePendingBytes === null && facts.capturePending === 0;
|
|
27374
27845
|
return [
|
|
27375
|
-
left === null ? "saving" : `saving \xB7 ${left} left`,
|
|
27846
|
+
noneQueued ? "saving \xB7 no uploads pending" : left === null ? "saving" : `saving \xB7 ${left} left`,
|
|
27376
27847
|
...overdue === null ? [] : [overdue]
|
|
27377
27848
|
].join(" \xB7 ");
|
|
27378
27849
|
}
|
|
@@ -27425,6 +27896,18 @@ var CheckpointTrigger = Schema_exports.Literals([
|
|
|
27425
27896
|
"review-open",
|
|
27426
27897
|
"user-mark"
|
|
27427
27898
|
]);
|
|
27899
|
+
var CheckpointSourceKind = Schema_exports.Literals(["stop-final", "stop-reading"]);
|
|
27900
|
+
var CheckpointSource = class extends Schema_exports.Class("CheckpointSource")({
|
|
27901
|
+
kind: CheckpointSourceKind,
|
|
27902
|
+
captureN: Schema_exports.NullOr(Schema_exports.Int),
|
|
27903
|
+
observedAt: Timestamp
|
|
27904
|
+
}) {
|
|
27905
|
+
};
|
|
27906
|
+
var checkpointSourceWords = (source, at) => [
|
|
27907
|
+
source.kind === "stop-final" ? "from the Stop's final save" : "from a Stop reading that did not save",
|
|
27908
|
+
...source.captureN === null ? [] : [`capture ${source.captureN}`],
|
|
27909
|
+
at
|
|
27910
|
+
].join(" \xB7 ");
|
|
27428
27911
|
var Checkpoint = class extends Schema_exports.Class("Checkpoint")({
|
|
27429
27912
|
id: CheckpointId,
|
|
27430
27913
|
worktreeId: WorktreeId,
|
|
@@ -27447,7 +27930,9 @@ var Checkpoint = class extends Schema_exports.Class("Checkpoint")({
|
|
|
27447
27930
|
/** Record sequence the supervisor had seen when the snapshot was taken. */
|
|
27448
27931
|
seq: SequenceNumber,
|
|
27449
27932
|
trigger: CheckpointTrigger,
|
|
27450
|
-
createdAt: Timestamp
|
|
27933
|
+
createdAt: Timestamp,
|
|
27934
|
+
/** Absent when the checkpoint observed the executor itself (`CheckpointSource`). */
|
|
27935
|
+
source: Schema_exports.optionalKey(CheckpointSource)
|
|
27451
27936
|
}) {
|
|
27452
27937
|
};
|
|
27453
27938
|
|
|
@@ -27580,6 +28065,83 @@ var FollowUp = class extends Schema_exports.Class("FollowUp")({
|
|
|
27580
28065
|
}) {
|
|
27581
28066
|
};
|
|
27582
28067
|
|
|
28068
|
+
// ../../packages/domain/src/workbench/harness-layout.ts
|
|
28069
|
+
var HarnessLayout = Schema_exports.Literals(["person", "shared"]);
|
|
28070
|
+
var HarnessLayoutSource = Schema_exports.Literals([
|
|
28071
|
+
"worktree",
|
|
28072
|
+
"operator",
|
|
28073
|
+
"capability",
|
|
28074
|
+
"flag",
|
|
28075
|
+
"fallback"
|
|
28076
|
+
]);
|
|
28077
|
+
var LINUX_UID_RANGE = { first: 4e4, last: 49999 };
|
|
28078
|
+
var LINUX_UID_FIRST = LINUX_UID_RANGE.first + 1;
|
|
28079
|
+
var MEND_GROUP = { name: "mend", gid: LINUX_UID_RANGE.first };
|
|
28080
|
+
var LinuxIdentity = class extends Schema_exports.Class("LinuxIdentity")({
|
|
28081
|
+
/** The account, Mend's user id: what names the person's saved directory. */
|
|
28082
|
+
accountId: Schema_exports.String,
|
|
28083
|
+
/** Login name (`linuxLoginNameOf`). */
|
|
28084
|
+
name: Schema_exports.String,
|
|
28085
|
+
uid: Schema_exports.Number
|
|
28086
|
+
}) {
|
|
28087
|
+
};
|
|
28088
|
+
var WorkspaceRetirementStopKind = Schema_exports.Literals([
|
|
28089
|
+
"terminal",
|
|
28090
|
+
"shell",
|
|
28091
|
+
"service",
|
|
28092
|
+
"turn",
|
|
28093
|
+
"process",
|
|
28094
|
+
"container",
|
|
28095
|
+
"unchecked"
|
|
28096
|
+
]);
|
|
28097
|
+
var WorkspaceRetirementStop = class extends Schema_exports.Class(
|
|
28098
|
+
"WorkspaceRetirementStop"
|
|
28099
|
+
)({
|
|
28100
|
+
kind: WorkspaceRetirementStopKind,
|
|
28101
|
+
/**
|
|
28102
|
+
* What it is, as observed: a session's label, a Service's name, a process's command name and
|
|
28103
|
+
* pid, a container's name, or why something could not be checked. Empty for a process or a
|
|
28104
|
+
* container when the viewer is not the change's owner: they see its kind only.
|
|
28105
|
+
*/
|
|
28106
|
+
label: Schema_exports.String
|
|
28107
|
+
}) {
|
|
28108
|
+
};
|
|
28109
|
+
var WorkspaceRetirementState = Schema_exports.Literals(["marked", "retiring"]);
|
|
28110
|
+
var WorkspaceRetirement = class extends Schema_exports.Class("WorkspaceRetirement")({
|
|
28111
|
+
state: WorkspaceRetirementState,
|
|
28112
|
+
/** The executor started before Mend 0.36 (no layout recorded for its launch). */
|
|
28113
|
+
preRelease: Schema_exports.Boolean,
|
|
28114
|
+
/** The account whose launch made the executor: the only one whose joins and turns it takes. */
|
|
28115
|
+
launcher: Schema_exports.NullOr(Schema_exports.String),
|
|
28116
|
+
/** What would stop if it were replaced now; empty when nothing would. */
|
|
28117
|
+
stops: Schema_exports.Array(WorkspaceRetirementStop),
|
|
28118
|
+
/** Why the last automatic replacement did not go ahead, as observed; null when none was tried. */
|
|
28119
|
+
reason: Schema_exports.NullOr(Schema_exports.String),
|
|
28120
|
+
/**
|
|
28121
|
+
* When what runs in the executor was last checked beyond Mend's own records (processes Mend did
|
|
28122
|
+
* not start, the sidecar's containers); null when only Mend's records were read.
|
|
28123
|
+
*/
|
|
28124
|
+
checkedAt: Schema_exports.NullOr(Timestamp),
|
|
28125
|
+
/**
|
|
28126
|
+
* What the viewer was shown, as one token: "Replace this workspace now" names it, so Mend ends
|
|
28127
|
+
* nothing that was not listed (the replacement is refused if more would stop now).
|
|
28128
|
+
*/
|
|
28129
|
+
fingerprint: Schema_exports.String,
|
|
28130
|
+
/** The viewer may replace it now: they own the change, and no agent turn is in flight. */
|
|
28131
|
+
canReplace: Schema_exports.Boolean
|
|
28132
|
+
}) {
|
|
28133
|
+
};
|
|
28134
|
+
var PreReleaseMemory = class extends Schema_exports.Class("PreReleaseMemory")({
|
|
28135
|
+
/** The capture it read, by its place on the worktree's chain. */
|
|
28136
|
+
captureN: Schema_exports.Number,
|
|
28137
|
+
provisional: Schema_exports.Boolean,
|
|
28138
|
+
creditedTo: Schema_exports.NullOr(Schema_exports.String),
|
|
28139
|
+
decidedBy: Schema_exports.Literals(["home-record", "only-person", "nobody", "nothing"]),
|
|
28140
|
+
/** Memory paths credited to nobody: two or more people's sessions shared the home. */
|
|
28141
|
+
notCredited: Schema_exports.Array(Schema_exports.String)
|
|
28142
|
+
}) {
|
|
28143
|
+
};
|
|
28144
|
+
|
|
27583
28145
|
// ../../packages/domain/src/workbench/mount.ts
|
|
27584
28146
|
var ProjectMount = class extends Schema_exports.Class("ProjectMount")({
|
|
27585
28147
|
id: ProjectMountId,
|
|
@@ -27675,6 +28237,12 @@ var NativeIngestCursor = Schema_exports.Struct({
|
|
|
27675
28237
|
lastEntryUuid: Schema_exports.NullOr(Schema_exports.String),
|
|
27676
28238
|
lineCount: Schema_exports.Int
|
|
27677
28239
|
});
|
|
28240
|
+
var LivePerson = class extends Schema_exports.Class("LivePerson")({
|
|
28241
|
+
accountId: Schema_exports.String,
|
|
28242
|
+
/** Their name as the instance knows it. */
|
|
28243
|
+
name: Schema_exports.String
|
|
28244
|
+
}) {
|
|
28245
|
+
};
|
|
27678
28246
|
var Session = class extends Schema_exports.Class("Session")({
|
|
27679
28247
|
id: SessionId,
|
|
27680
28248
|
projectId: ProjectId,
|
|
@@ -27682,6 +28250,21 @@ var Session = class extends Schema_exports.Class("Session")({
|
|
|
27682
28250
|
worktreeId: WorktreeId,
|
|
27683
28251
|
/** The adapter that launched it: `codex` · `claude` · `opencode` · `custom`. */
|
|
27684
28252
|
harness: Schema_exports.String,
|
|
28253
|
+
/**
|
|
28254
|
+
* The model the session was started with, as the server resolved it (docs/models-audit.md): the
|
|
28255
|
+
* one the request named, else the harness's catalog default. Null for a harness with no catalog,
|
|
28256
|
+
* before launch, and on rows from before the column. A resume keeps it: the harness continues
|
|
28257
|
+
* the conversation on its own model.
|
|
28258
|
+
*/
|
|
28259
|
+
model: Schema_exports.NullOr(Schema_exports.String).pipe(
|
|
28260
|
+
Schema_exports.withDecodingDefaultKey(Effect_exports.succeed(null)),
|
|
28261
|
+
Schema_exports.withConstructorDefault(Effect_exports.succeed(null))
|
|
28262
|
+
),
|
|
28263
|
+
/** The effort the session was started with; null is the harness's own default. */
|
|
28264
|
+
effort: Schema_exports.NullOr(Schema_exports.Literals(EFFORT_LEVELS)).pipe(
|
|
28265
|
+
Schema_exports.withDecodingDefaultKey(Effect_exports.succeed(null)),
|
|
28266
|
+
Schema_exports.withConstructorDefault(Effect_exports.succeed(null))
|
|
28267
|
+
),
|
|
27685
28268
|
/** Provider-native session/thread id when the adapter can extract one. */
|
|
27686
28269
|
providerSessionId: Schema_exports.NullOr(Schema_exports.String),
|
|
27687
28270
|
/** Optional human label ("reaper retry storm"); sessions have no issue titles. */
|
|
@@ -27740,6 +28323,45 @@ var Session = class extends Schema_exports.Class("Session")({
|
|
|
27740
28323
|
sharedControlEnabledAt: Schema_exports.NullOr(Timestamp).pipe(
|
|
27741
28324
|
Schema_exports.withConstructorDefault(Effect_exports.succeed(null))
|
|
27742
28325
|
),
|
|
28326
|
+
/**
|
|
28327
|
+
* When shared control was first turned on, kept after it is turned off (docs/adr/0016,
|
|
28328
|
+
* decision 9): a session once shared runs on no one's memory and credits nobody until it ends.
|
|
28329
|
+
*/
|
|
28330
|
+
sharedControlEverAt: Schema_exports.NullOr(Timestamp).pipe(
|
|
28331
|
+
Schema_exports.withDecodingDefaultKey(Effect_exports.succeed(null)),
|
|
28332
|
+
Schema_exports.withConstructorDefault(Effect_exports.succeed(null))
|
|
28333
|
+
),
|
|
28334
|
+
/**
|
|
28335
|
+
* The people with a process live in the session's executor as their own user, in a per-person
|
|
28336
|
+
* executor (docs/adr/0016, decision 13): filled by the API's session list and view only, in the
|
|
28337
|
+
* same query; empty everywhere else, in a shared executor, and from older servers.
|
|
28338
|
+
*/
|
|
28339
|
+
livePeople: Schema_exports.Array(LivePerson).pipe(
|
|
28340
|
+
Schema_exports.withDecodingDefaultKey(Effect_exports.succeed([])),
|
|
28341
|
+
Schema_exports.withConstructorDefault(Effect_exports.succeed([]))
|
|
28342
|
+
),
|
|
28343
|
+
/**
|
|
28344
|
+
* The session's executor waits to be replaced (docs/adr/0016, decision 14): `marked` or
|
|
28345
|
+
* `retiring`; null otherwise. Read with `livePeople`, in the same query, so a client asks for the
|
|
28346
|
+
* retirement's detail only when there is one. Null everywhere else and from older servers.
|
|
28347
|
+
*/
|
|
28348
|
+
workspaceRetirement: Schema_exports.NullOr(Schema_exports.Literals(["marked", "retiring"])).pipe(
|
|
28349
|
+
Schema_exports.withDecodingDefaultKey(Effect_exports.succeed(null)),
|
|
28350
|
+
Schema_exports.withConstructorDefault(Effect_exports.succeed(null))
|
|
28351
|
+
),
|
|
28352
|
+
/**
|
|
28353
|
+
* Who launched the session's executor: the owner of the session whose own launch made it
|
|
28354
|
+
* (`SessionsRepo.executorSessionOf`), which a joined session is not. Remote-SSH into the workspace
|
|
28355
|
+
* admits that person only (docs/adr/0016), in either harness layout, so an editor asks before it
|
|
28356
|
+
* opens. Filled on every API read that hands sessions out (the session list, retained additions
|
|
28357
|
+
* included, the session view and the project view): the view reads in their own statement, the
|
|
28358
|
+
* plain reads from one batched read (`SessionsRepo.launchersOf`). Null with no executor, on the
|
|
28359
|
+
* repository's other reads, and from older servers.
|
|
28360
|
+
*/
|
|
28361
|
+
workspaceLauncherUserId: Schema_exports.NullOr(Schema_exports.String).pipe(
|
|
28362
|
+
Schema_exports.withDecodingDefaultKey(Effect_exports.succeed(null)),
|
|
28363
|
+
Schema_exports.withConstructorDefault(Effect_exports.succeed(null))
|
|
28364
|
+
),
|
|
27743
28365
|
/**
|
|
27744
28366
|
* Whether the harness left a conversation behind — a transcript Mend captured at settle or
|
|
27745
28367
|
* found in the live harness home. False is a dead end: nothing to resume, nothing to hand
|
|
@@ -27884,6 +28506,7 @@ var HotWorkspaceEnvironment = Schema_exports.Struct({
|
|
|
27884
28506
|
clusterBindingNames: Schema_exports.optional(Schema_exports.Array(Schema_exports.String)),
|
|
27885
28507
|
clusterServiceAccount: Schema_exports.optional(Schema_exports.NullOr(Schema_exports.String))
|
|
27886
28508
|
});
|
|
28509
|
+
var RemoteSsh = Schema_exports.Literals(["owner", "unbound", "not-taken"]);
|
|
27887
28510
|
var HotWorkspace = class extends Schema_exports.Class("HotWorkspace")({
|
|
27888
28511
|
id: SessionId,
|
|
27889
28512
|
projectId: ProjectId,
|
|
@@ -27903,6 +28526,20 @@ var HotWorkspace = class extends Schema_exports.Class("HotWorkspace")({
|
|
|
27903
28526
|
error: Schema_exports.NullOr(Schema_exports.String),
|
|
27904
28527
|
/** Hash of every create-time-fixed input; claims require an exact match. */
|
|
27905
28528
|
fingerprint: Schema_exports.String,
|
|
28529
|
+
/**
|
|
28530
|
+
* The harness layout the standby booted in (docs/adr/0016): `person` booted with its owner's
|
|
28531
|
+
* capture owner map and their logins in their own home, so it serves only that owner's launch
|
|
28532
|
+
* decided `person`; `shared` serves only a launch decided `shared`. Rows from before it are
|
|
28533
|
+
* `shared`.
|
|
28534
|
+
*/
|
|
28535
|
+
harnessLayout: HarnessLayout,
|
|
28536
|
+
/**
|
|
28537
|
+
* Who Remote-SSH into the standby runs as (docs/adr/0016, decision 10), decided at its create and
|
|
28538
|
+
* kept for its claim: `owner` its owner's own user; `unbound` root, because Core could not bind
|
|
28539
|
+
* the owner's person; `not-taken` root, because Core runs no SSH session as a user. Rows from
|
|
28540
|
+
* before it are `not-taken`.
|
|
28541
|
+
*/
|
|
28542
|
+
remoteSsh: RemoteSsh,
|
|
27906
28543
|
/** Worktree directory name inside the project's store (derived from `id`). */
|
|
27907
28544
|
worktree: Schema_exports.NullOr(Schema_exports.String),
|
|
27908
28545
|
/** The pre-created session branch the worktree is on. */
|
|
@@ -27926,6 +28563,32 @@ var HotWorkspace = class extends Schema_exports.Class("HotWorkspace")({
|
|
|
27926
28563
|
}) {
|
|
27927
28564
|
};
|
|
27928
28565
|
|
|
28566
|
+
// ../../packages/domain/src/workbench/model-catalog.ts
|
|
28567
|
+
var HarnessModel = class extends Schema_exports.Class("HarnessModel")({
|
|
28568
|
+
id: Schema_exports.String,
|
|
28569
|
+
label: Schema_exports.String,
|
|
28570
|
+
/** The model a launch runs when the request names none; one per harness. */
|
|
28571
|
+
isDefault: Schema_exports.Boolean,
|
|
28572
|
+
/** The efforts this model takes when fewer than its harness's; null means the harness's. */
|
|
28573
|
+
efforts: Schema_exports.NullOr(Schema_exports.Array(Schema_exports.Literals(EFFORT_LEVELS)))
|
|
28574
|
+
}) {
|
|
28575
|
+
};
|
|
28576
|
+
var HarnessModelCatalog = class extends Schema_exports.Class("HarnessModelCatalog")({
|
|
28577
|
+
harness: Schema_exports.String,
|
|
28578
|
+
/** In the order the picker shows them; empty when the harness takes no model flag Mend knows. */
|
|
28579
|
+
models: Schema_exports.Array(HarnessModel),
|
|
28580
|
+
/**
|
|
28581
|
+
* The model a launch runs when none is named; null when the list is empty, or when the harness
|
|
28582
|
+
* chooses its own and no row is flagged (`HARNESSES_CHOOSING_THEIR_OWN_MODEL`).
|
|
28583
|
+
*/
|
|
28584
|
+
defaultModel: Schema_exports.NullOr(Schema_exports.String),
|
|
28585
|
+
/** What the harness CLI accepts at all; a model may take fewer. */
|
|
28586
|
+
efforts: Schema_exports.Array(Schema_exports.Literals(EFFORT_LEVELS)),
|
|
28587
|
+
/** Whether a launch may ask for priority processing. */
|
|
28588
|
+
fastCapable: Schema_exports.Boolean
|
|
28589
|
+
}) {
|
|
28590
|
+
};
|
|
28591
|
+
|
|
27929
28592
|
// ../../packages/domain/src/workbench/notifications.ts
|
|
27930
28593
|
var NotificationKind = Schema_exports.Literals(["finished", "needs-input", "failed"]);
|
|
27931
28594
|
var NotificationSettings = class extends Schema_exports.Class(
|
|
@@ -27950,6 +28613,45 @@ var DEFAULT_NOTIFICATION_SETTINGS = new NotificationSettings({
|
|
|
27950
28613
|
});
|
|
27951
28614
|
var SlackThreadReach = Schema_exports.Literals(["replies", "status", "none"]);
|
|
27952
28615
|
|
|
28616
|
+
// ../../packages/domain/src/workbench/host-user-namespaces.ts
|
|
28617
|
+
var HOST_USER_NAMESPACE_FILES = [
|
|
28618
|
+
"/proc/sys/kernel/apparmor_restrict_unprivileged_userns",
|
|
28619
|
+
"/sys/module/apparmor/parameters/enabled",
|
|
28620
|
+
"/proc/sys/kernel/unprivileged_userns_clone"
|
|
28621
|
+
];
|
|
28622
|
+
var HOST_USER_NAMESPACE_SYSCTL_FILE = "/etc/sysctl.d/60-mend-rootless-docker.conf";
|
|
28623
|
+
var HOST_USER_NAMESPACE_SYSCTL_MARKER = "# written by mend server setup; mend uninstall removes it";
|
|
28624
|
+
var PREVIOUS_SETTINGS = {
|
|
28625
|
+
"kernel.apparmor_restrict_unprivileged_userns = 0": "kernel.apparmor_restrict_unprivileged_userns = 1",
|
|
28626
|
+
"kernel.unprivileged_userns_clone = 1": "kernel.unprivileged_userns_clone = 0"
|
|
28627
|
+
};
|
|
28628
|
+
var HOST_USER_NAMESPACE_SYSCTL_PREVIOUS = "# previous: ";
|
|
28629
|
+
var hostUserNamespacesSysctlLines = (setting) => {
|
|
28630
|
+
const previous = PREVIOUS_SETTINGS[setting];
|
|
28631
|
+
return [
|
|
28632
|
+
HOST_USER_NAMESPACE_SYSCTL_MARKER,
|
|
28633
|
+
...previous === void 0 ? [] : [`${HOST_USER_NAMESPACE_SYSCTL_PREVIOUS}${previous}`],
|
|
28634
|
+
setting
|
|
28635
|
+
];
|
|
28636
|
+
};
|
|
28637
|
+
var hostUserNamespacesOf = (readings) => {
|
|
28638
|
+
const restrict = readings.apparmorRestrictUnprivilegedUserns?.trim();
|
|
28639
|
+
const apparmorOff = readings.apparmorEnabled?.trim() === "N";
|
|
28640
|
+
if (restrict === "1" && !apparmorOff) {
|
|
28641
|
+
return { allowed: false, setting: "kernel.apparmor_restrict_unprivileged_userns = 0" };
|
|
28642
|
+
}
|
|
28643
|
+
if (readings.unprivilegedUsernsClone?.trim() === "0") {
|
|
28644
|
+
return { allowed: false, setting: "kernel.unprivileged_userns_clone = 1" };
|
|
28645
|
+
}
|
|
28646
|
+
return { allowed: true };
|
|
28647
|
+
};
|
|
28648
|
+
var hostUserNamespacesFix = (setting) => `echo '${setting}' | sudo tee ${HOST_USER_NAMESPACE_SYSCTL_FILE} && sudo sysctl --system`;
|
|
28649
|
+
var HOST_USER_NAMESPACE_FIXES = Object.keys(PREVIOUS_SETTINGS).map(hostUserNamespacesFix);
|
|
28650
|
+
var HOST_USER_NAMESPACES_REFUSED = "the server's host refuses user namespaces \xB7 no workspace can start";
|
|
28651
|
+
var HOST_USER_NAMESPACES_FIX_LEAD = "on the server's host: ";
|
|
28652
|
+
var HOST_USER_NAMESPACES_SETUP_ROUTE = "re-run mend server setup with --allow-userns (mend uninstall --all then undoes it), or ";
|
|
28653
|
+
var hostUserNamespacesFixLine = (setting) => `${HOST_USER_NAMESPACES_SETUP_ROUTE}${HOST_USER_NAMESPACES_FIX_LEAD}${hostUserNamespacesFix(setting)}`;
|
|
28654
|
+
|
|
27953
28655
|
// ../../packages/domain/src/workbench/link.ts
|
|
27954
28656
|
var ProjectLink = class extends Schema_exports.Class("ProjectLink")({
|
|
27955
28657
|
id: ProjectLinkId,
|
|
@@ -28004,7 +28706,7 @@ var ProjectClusterBindingsSnapshot = class extends Schema_exports.Class(
|
|
|
28004
28706
|
}) {
|
|
28005
28707
|
};
|
|
28006
28708
|
|
|
28007
|
-
// ../../node_modules/.pnpm/@sealant+api-contracts@0.
|
|
28709
|
+
// ../../node_modules/.pnpm/@sealant+api-contracts-next@0.39.0-next.726_effect@4.0.0-beta.93/node_modules/@sealant/api-contracts-next/dist/workspace-environment.js
|
|
28008
28710
|
var RESERVED_NAMES = new Map([
|
|
28009
28711
|
// Identity/process roots the daemon and shells own.
|
|
28010
28712
|
...[
|
|
@@ -28175,7 +28877,18 @@ var SessionProcess = class extends Schema_exports.Class("SessionProcess")({
|
|
|
28175
28877
|
Schema_exports.withConstructorDefault(Effect_exports.succeed(null))
|
|
28176
28878
|
),
|
|
28177
28879
|
exitedAt: Schema_exports.NullOr(Timestamp),
|
|
28178
|
-
updatedAt: Timestamp
|
|
28880
|
+
updatedAt: Timestamp,
|
|
28881
|
+
/**
|
|
28882
|
+
* The Mend account whose Linux user the process runs as in a person-layout executor
|
|
28883
|
+
* (docs/adr/0016, decision 1: "the person a process runs as is recorded on the process when it
|
|
28884
|
+
* starts"). An observed agent (`agent-external`): the person whose saved directory its
|
|
28885
|
+
* transcript is in. Null for a process that runs as root (a `shared` executor), on rows from
|
|
28886
|
+
* before it was recorded, and where older servers omit it.
|
|
28887
|
+
*/
|
|
28888
|
+
runsAs: Schema_exports.NullOr(Schema_exports.String).pipe(
|
|
28889
|
+
Schema_exports.withDecodingDefaultKey(Effect_exports.succeed(null)),
|
|
28890
|
+
Schema_exports.withConstructorDefault(Effect_exports.succeed(null))
|
|
28891
|
+
)
|
|
28179
28892
|
}) {
|
|
28180
28893
|
};
|
|
28181
28894
|
|
|
@@ -28186,6 +28899,38 @@ var servicesHoldLine = (input) => {
|
|
|
28186
28899
|
return input.agentOutcome === null ? hold : `agent ${input.agentOutcome} \xB7 ${hold}`;
|
|
28187
28900
|
};
|
|
28188
28901
|
|
|
28902
|
+
// ../../packages/domain/src/workbench/repository.ts
|
|
28903
|
+
var SessionRepositoryState = Schema_exports.Literals(["adding", "ready", "failed", "missing"]);
|
|
28904
|
+
var SessionRepositoryCapture = Schema_exports.Literals(["nested", "own"]);
|
|
28905
|
+
var SessionRepositorySource = Schema_exports.Literals(["origin", "store"]);
|
|
28906
|
+
var SessionRepository = class extends Schema_exports.Class("SessionRepository")({
|
|
28907
|
+
id: SessionRepositoryId,
|
|
28908
|
+
sessionId: SessionId,
|
|
28909
|
+
/** The repository's project, never the session's own. */
|
|
28910
|
+
projectId: ProjectId,
|
|
28911
|
+
/** The worktree of that project this session works in. */
|
|
28912
|
+
worktreeId: WorktreeId,
|
|
28913
|
+
/** The directory name under `/workspace/repos/`. */
|
|
28914
|
+
name: Schema_exports.String,
|
|
28915
|
+
/** `repositoryPath(name)`, recorded so the record reads without computing. */
|
|
28916
|
+
path: Schema_exports.String,
|
|
28917
|
+
/** Mirrors of the worktree row, as the session's own `branch` and `baseSha` are. */
|
|
28918
|
+
branch: Schema_exports.String,
|
|
28919
|
+
baseSha: Sha,
|
|
28920
|
+
baseRef: Schema_exports.NullOr(Schema_exports.String),
|
|
28921
|
+
state: SessionRepositoryState,
|
|
28922
|
+
/** Why it `failed` or went `missing`, in the words the person reads. */
|
|
28923
|
+
error: Schema_exports.NullOr(Schema_exports.String),
|
|
28924
|
+
capture: SessionRepositoryCapture,
|
|
28925
|
+
source: SessionRepositorySource,
|
|
28926
|
+
/** The account that asked for it: the session's owner. */
|
|
28927
|
+
addedByUserId: Schema_exports.NullOr(Schema_exports.String),
|
|
28928
|
+
createdAt: Timestamp,
|
|
28929
|
+
updatedAt: Timestamp,
|
|
28930
|
+
readyAt: Schema_exports.NullOr(Timestamp)
|
|
28931
|
+
}) {
|
|
28932
|
+
};
|
|
28933
|
+
|
|
28189
28934
|
// ../../packages/domain/src/workbench/review-comment.ts
|
|
28190
28935
|
var CommentAuthor = Schema_exports.Literals(["reviewer", "mend"]);
|
|
28191
28936
|
var CommentState = Schema_exports.Literals(["draft", "open", "addressed", "dismissed"]);
|
|
@@ -28244,6 +28989,83 @@ var ReviewComment = class extends Schema_exports.Class("ReviewComment")({
|
|
|
28244
28989
|
}) {
|
|
28245
28990
|
};
|
|
28246
28991
|
|
|
28992
|
+
// ../../packages/domain/src/workbench/secret-file.ts
|
|
28993
|
+
var SECRET_FILE_MAX_BYTES = 256 * 1024;
|
|
28994
|
+
var SECRET_FILES_MAX_TOTAL_BYTES = 1024 * 1024;
|
|
28995
|
+
var SECRET_FILE_MAX_PATH_LENGTH = 512;
|
|
28996
|
+
var SECRET_FILE_RESERVED_PATHS = [
|
|
28997
|
+
".claude",
|
|
28998
|
+
".claude.json",
|
|
28999
|
+
".codex",
|
|
29000
|
+
".pi",
|
|
29001
|
+
".local/share/opencode",
|
|
29002
|
+
".local/state/opencode",
|
|
29003
|
+
".mend"
|
|
29004
|
+
];
|
|
29005
|
+
var SecretFile = class extends Schema_exports.Class("SecretFile")({
|
|
29006
|
+
id: SecretFileId,
|
|
29007
|
+
/** Home-relative POSIX path, as `validateSecretFilePath` accepts it. */
|
|
29008
|
+
path: Schema_exports.String,
|
|
29009
|
+
/** The last segment of `path`: what a list shows first. */
|
|
29010
|
+
name: Schema_exports.String,
|
|
29011
|
+
bytes: Schema_exports.Int,
|
|
29012
|
+
/** Grows with every replace; the content itself never appears. */
|
|
29013
|
+
revision: Schema_exports.Int,
|
|
29014
|
+
createdAt: Timestamp,
|
|
29015
|
+
updatedAt: Timestamp
|
|
29016
|
+
}) {
|
|
29017
|
+
};
|
|
29018
|
+
var SecretFilesView = class extends Schema_exports.Class("SecretFilesView")({
|
|
29019
|
+
files: Schema_exports.Array(SecretFile)
|
|
29020
|
+
}) {
|
|
29021
|
+
};
|
|
29022
|
+
var SecretFileUpload = class extends Schema_exports.Class("SecretFileUpload")({
|
|
29023
|
+
path: Schema_exports.String,
|
|
29024
|
+
encoding: Schema_exports.Literals(["utf8", "base64"]),
|
|
29025
|
+
contents: Schema_exports.String
|
|
29026
|
+
}) {
|
|
29027
|
+
};
|
|
29028
|
+
var SecretFileSaved = class extends Schema_exports.Class("SecretFileSaved")({
|
|
29029
|
+
file: SecretFile,
|
|
29030
|
+
action: Schema_exports.Literals(["created", "replaced"])
|
|
29031
|
+
}) {
|
|
29032
|
+
};
|
|
29033
|
+
var SecretFileRemoved = class extends Schema_exports.Class("SecretFileRemoved")({
|
|
29034
|
+
removed: Schema_exports.Boolean
|
|
29035
|
+
}) {
|
|
29036
|
+
};
|
|
29037
|
+
var validateSecretFilePath = (filePath) => {
|
|
29038
|
+
const syntax = validateSecretFilePathSyntax(filePath);
|
|
29039
|
+
if (syntax !== null) return syntax;
|
|
29040
|
+
const reserved = reservedSecretFileRoot(filePath);
|
|
29041
|
+
if (reserved !== null) {
|
|
29042
|
+
return `${filePath} is under ${reserved}, which sessions capture`;
|
|
29043
|
+
}
|
|
29044
|
+
return null;
|
|
29045
|
+
};
|
|
29046
|
+
var reservedSecretFileRoot = (filePath) => SECRET_FILE_RESERVED_PATHS.find(
|
|
29047
|
+
(prefix) => filePath === prefix || filePath.startsWith(`${prefix}/`)
|
|
29048
|
+
) ?? null;
|
|
29049
|
+
var validateSecretFilePathSyntax = (filePath) => {
|
|
29050
|
+
if (filePath.length === 0) return "a path under the home directory is required";
|
|
29051
|
+
if (filePath.length > SECRET_FILE_MAX_PATH_LENGTH) {
|
|
29052
|
+
return `${filePath} is longer than ${SECRET_FILE_MAX_PATH_LENGTH} characters`;
|
|
29053
|
+
}
|
|
29054
|
+
if (filePath.startsWith("/") || filePath.startsWith("~")) {
|
|
29055
|
+
return `${filePath} must be relative to the home directory, as .aws/credentials is`;
|
|
29056
|
+
}
|
|
29057
|
+
const control = [...filePath].some((char) => {
|
|
29058
|
+
const code = char.codePointAt(0) ?? 0;
|
|
29059
|
+
return code < 32 || code === 127;
|
|
29060
|
+
});
|
|
29061
|
+
if (filePath.includes("\\") || control) return `${filePath} is not a POSIX path`;
|
|
29062
|
+
const segments = filePath.split("/");
|
|
29063
|
+
if (segments.some((segment) => segment === "" || segment === "." || segment === "..")) {
|
|
29064
|
+
return `${filePath} must not contain empty, "." or ".." segments`;
|
|
29065
|
+
}
|
|
29066
|
+
return null;
|
|
29067
|
+
};
|
|
29068
|
+
|
|
28247
29069
|
// ../../packages/domain/src/workbench/service-recipe.ts
|
|
28248
29070
|
var ServiceRecipe = class extends Schema_exports.Class("ServiceRecipe")({
|
|
28249
29071
|
name: Schema_exports.String,
|
|
@@ -28354,11 +29176,13 @@ var ServiceView = class extends Schema_exports.Class("ServiceView")({
|
|
|
28354
29176
|
previousEndpoints: Schema_exports.Array(ServiceEndpoint)
|
|
28355
29177
|
}) {
|
|
28356
29178
|
};
|
|
29179
|
+
var serviceStartCorrelation = (serviceId, startId) => `service-start:${serviceId}:${startId}`;
|
|
28357
29180
|
|
|
28358
29181
|
// ../../packages/domain/src/workbench/session-control.ts
|
|
28359
29182
|
var SessionControlKind = Schema_exports.Literals([
|
|
28360
29183
|
"interrupt",
|
|
28361
29184
|
"terminal-attach",
|
|
29185
|
+
"terminal-watch",
|
|
28362
29186
|
"shell-open",
|
|
28363
29187
|
"stop",
|
|
28364
29188
|
"services-stop",
|
|
@@ -28377,6 +29201,7 @@ var SessionControlEvent = class extends Schema_exports.Class("SessionControlEven
|
|
|
28377
29201
|
createdAt: Timestamp
|
|
28378
29202
|
}) {
|
|
28379
29203
|
};
|
|
29204
|
+
var terminalReadOnlyLine = (ownerName) => `This session runs in a terminal. Only ${ownerName} types here; they can continue it as a conversation.`;
|
|
28380
29205
|
|
|
28381
29206
|
// ../../packages/domain/src/workbench/session-run.ts
|
|
28382
29207
|
var SessionRun = class extends Schema_exports.Class("SessionRun")({
|
|
@@ -28521,6 +29346,98 @@ var SlackLinkedMentionJob = Schema_exports.Struct({
|
|
|
28521
29346
|
linkedAt: Schema_exports.String
|
|
28522
29347
|
});
|
|
28523
29348
|
|
|
29349
|
+
// ../../packages/domain/src/workbench/shared-workspace.ts
|
|
29350
|
+
var listed = (names) => names.length <= 1 ? names[0] ?? "" : `${names.slice(0, -1).join(", ")} and ${names[names.length - 1] ?? ""}`;
|
|
29351
|
+
var joinWorktreeLine = (others) => others.length <= 1 ? `${others[0] ?? "Another person"}'s session is running in this worktree. You share its workspace: everything you run runs as you, on your own logins, but either of you can read the other's files, logins included.` : `${listed(others)}'s sessions are running in this worktree. You share its workspace: everything you run runs as you, on your own logins, but any of you can read the others' files, logins included.`;
|
|
29352
|
+
var JOIN_SHARED_HOME_LINE = "Another person's session is running in this worktree, in a workspace that shares one home: what you start there runs on the logins and Git identity of whoever started that workspace, not yours.";
|
|
29353
|
+
var sharedWorkspaceLine = (livePeople, viewer) => {
|
|
29354
|
+
if (livePeople.length < 2) return null;
|
|
29355
|
+
const others = livePeople.filter((person) => person.accountId !== viewer).map((p) => p.name);
|
|
29356
|
+
if (others.length === livePeople.length) {
|
|
29357
|
+
return `Shared workspace: ${listed(others)} \xB7 each runs as themselves \xB7 ${others.length === 2 ? "either can read the other's files" : "any of them can read the others' files"}.`;
|
|
29358
|
+
}
|
|
29359
|
+
return others.length === 1 && livePeople.length === 2 ? `Shared workspace with ${others[0]} \xB7 each of you runs as yourself \xB7 either of you can read the other's files.` : `Shared workspace with ${listed(others)} \xB7 each of you runs as yourself \xB7 any of you can read the others' files.`;
|
|
29360
|
+
};
|
|
29361
|
+
var SHARED_CONTROL_LINE = "Each turn runs on its sender's login. From now until this session ends, the agent uses no one's personal memory or instructions. The conversation so far, including what your agent loaded before, becomes visible to whoever steers.";
|
|
29362
|
+
var SHARED_CONTROL_LINE_OWNER_LOGINS = "Each turn runs on your provider logins and Git access, whoever sends it.";
|
|
29363
|
+
var sharedControlLine = (turnsOnSendersLogin) => turnsOnSendersLogin ? SHARED_CONTROL_LINE : SHARED_CONTROL_LINE_OWNER_LOGINS;
|
|
29364
|
+
var sharedControlConfirm = (turnsOnSendersLogin) => ({
|
|
29365
|
+
title: "Turn on shared control?",
|
|
29366
|
+
body: turnsOnSendersLogin ? SHARED_CONTROL_LINE : `Everyone who can see this project can send turns, answer approvals and interrupt. ${SHARED_CONTROL_LINE_OWNER_LOGINS}`,
|
|
29367
|
+
confirm: "Turn on",
|
|
29368
|
+
cancel: "Keep it off"
|
|
29369
|
+
});
|
|
29370
|
+
var workspaceRetirementLine = (retirement, launcherName) => {
|
|
29371
|
+
if (retirement.state === "retiring") {
|
|
29372
|
+
return "Replacing this workspace so that each person runs as themselves \xB7 nothing new starts until it has been saved and replaced";
|
|
29373
|
+
}
|
|
29374
|
+
const started = retirement.preRelease ? "This workspace started before Mend 0.36 and shares one home" : "This workspace shares one home";
|
|
29375
|
+
const reason = retirement.reason === null ? "" : ` \xB7 ${retirement.reason}`;
|
|
29376
|
+
return `${started} \xB7 it takes only ${launcherName}'s sessions and turns until it is replaced${reason}`;
|
|
29377
|
+
};
|
|
29378
|
+
var STOP_WORDS = {
|
|
29379
|
+
terminal: "terminal session (ends resumable)",
|
|
29380
|
+
shell: "shell",
|
|
29381
|
+
service: "Service started by hand",
|
|
29382
|
+
turn: "agent turn in flight",
|
|
29383
|
+
process: "process Mend did not start",
|
|
29384
|
+
container: "running container",
|
|
29385
|
+
unchecked: "could not check"
|
|
29386
|
+
};
|
|
29387
|
+
var REPLACE_WORKSPACE_ACTION = "Replace this workspace now";
|
|
29388
|
+
var timeOf3 = (at) => `${at.toISOString().slice(11, 16)} UTC`;
|
|
29389
|
+
var retirementStopLines = (retirement) => {
|
|
29390
|
+
const checked = retirement.checkedAt === null ? "Checked: Mend's records only \xB7 processes Mend did not start and running containers not checked yet" : `Checked at ${timeOf3(retirement.checkedAt)}: Mend's records, the processes in the workspace and its running containers`;
|
|
29391
|
+
const found = retirement.stops.length === 0 ? ["Found nothing that would stop."] : retirement.stops.map(
|
|
29392
|
+
(stop) => stop.label === "" ? STOP_WORDS[stop.kind] : `${STOP_WORDS[stop.kind]} \xB7 ${stop.label}`
|
|
29393
|
+
);
|
|
29394
|
+
return [checked, ...found, "Mend starts the launching session's mend.toml Services again."];
|
|
29395
|
+
};
|
|
29396
|
+
|
|
29397
|
+
// ../../packages/domain/src/workbench/steering.ts
|
|
29398
|
+
var ConversationWaitWork = Schema_exports.Struct({
|
|
29399
|
+
kind: Schema_exports.Literals([
|
|
29400
|
+
"task",
|
|
29401
|
+
"paused-task",
|
|
29402
|
+
"sub-agent",
|
|
29403
|
+
"terminal",
|
|
29404
|
+
"goal",
|
|
29405
|
+
"wakeup",
|
|
29406
|
+
"monitor",
|
|
29407
|
+
"cron",
|
|
29408
|
+
"unknown"
|
|
29409
|
+
]),
|
|
29410
|
+
/** The harness's own id: what ending it names. */
|
|
29411
|
+
id: Schema_exports.String,
|
|
29412
|
+
description: Schema_exports.NullOr(Schema_exports.String),
|
|
29413
|
+
/**
|
|
29414
|
+
* The person the process runs as, or the session's owner, can end it from the waiting line
|
|
29415
|
+
* (Claude's task stop, a monitor's included, Codex's terminal terminate and goal clear). A
|
|
29416
|
+
* wakeup ends on its own within an hour; a scheduled prompt and what the harness would not say
|
|
29417
|
+
* are waited for at most `CONVERSATION_WAIT_BOUNDS_MS`.
|
|
29418
|
+
*/
|
|
29419
|
+
endable: Schema_exports.Boolean
|
|
29420
|
+
});
|
|
29421
|
+
var ConversationWait = class extends Schema_exports.Class("ConversationWait")({
|
|
29422
|
+
sessionId: SessionId,
|
|
29423
|
+
/** The turn that waits; the turns behind it wait with it. */
|
|
29424
|
+
turnId: AgentTurnId,
|
|
29425
|
+
/** Whose process finishes its work: the person it runs as. */
|
|
29426
|
+
runsAs: Schema_exports.NullOr(Schema_exports.String),
|
|
29427
|
+
/** Whose turn waits. */
|
|
29428
|
+
sender: Schema_exports.String,
|
|
29429
|
+
/** A turn still runs in the process. */
|
|
29430
|
+
openTurn: Schema_exports.Boolean,
|
|
29431
|
+
work: Schema_exports.Array(ConversationWaitWork),
|
|
29432
|
+
/** The waiting line, in words: "Waits for Alice's 2 background tasks … before Bob's turn starts." */
|
|
29433
|
+
line: Schema_exports.String,
|
|
29434
|
+
since: Timestamp
|
|
29435
|
+
}) {
|
|
29436
|
+
};
|
|
29437
|
+
var CONVERSATION_WAIT_BOUNDS_MS = {
|
|
29438
|
+
cron: 10 * 6e4
|
|
29439
|
+
};
|
|
29440
|
+
|
|
28524
29441
|
// ../../packages/domain/src/workbench/tour.ts
|
|
28525
29442
|
var TourStop = class extends Schema_exports.Class("TourStop")({
|
|
28526
29443
|
title: Schema_exports.String,
|
|
@@ -28577,6 +29494,9 @@ var Worktree = class extends Schema_exports.Class("Worktree")({
|
|
|
28577
29494
|
}) {
|
|
28578
29495
|
};
|
|
28579
29496
|
|
|
29497
|
+
// ../../packages/domain/src/workbench/worktree-removal.ts
|
|
29498
|
+
var WORKTREE_REMOVAL_FORCE_HINT = "or pass force=true to remove it anyway";
|
|
29499
|
+
|
|
28580
29500
|
// src/shared.ts
|
|
28581
29501
|
import { spawnSync } from "node:child_process";
|
|
28582
29502
|
import * as path from "node:path";
|
|
@@ -28584,10 +29504,18 @@ var HARNESS_COMMANDS = {
|
|
|
28584
29504
|
codex: ["codex"],
|
|
28585
29505
|
claude: ["claude"],
|
|
28586
29506
|
opencode: ["opencode"],
|
|
29507
|
+
pi: ["pi"],
|
|
28587
29508
|
// Not a coding agent: a plain bash session in its own recorded worktree.
|
|
28588
29509
|
shell: ["bash"]
|
|
28589
29510
|
};
|
|
28590
|
-
var EFFORT_LEVELS2 = [
|
|
29511
|
+
var EFFORT_LEVELS2 = [
|
|
29512
|
+
"low",
|
|
29513
|
+
"medium",
|
|
29514
|
+
"high",
|
|
29515
|
+
"xhigh",
|
|
29516
|
+
"max",
|
|
29517
|
+
"ultra"
|
|
29518
|
+
];
|
|
28591
29519
|
var PENDING_ID_PREFIX = "pending:";
|
|
28592
29520
|
var pendingId = () => `${PENDING_ID_PREFIX}${crypto.randomUUID()}`;
|
|
28593
29521
|
var isPendingId = (id2) => id2.startsWith(PENDING_ID_PREFIX);
|
|
@@ -28605,6 +29533,7 @@ var LAUNCH_ERROR = {
|
|
|
28605
29533
|
foreground: false,
|
|
28606
29534
|
noTunnel: false,
|
|
28607
29535
|
autoLand: null,
|
|
29536
|
+
json: false,
|
|
28608
29537
|
custom: []
|
|
28609
29538
|
};
|
|
28610
29539
|
var parseLaunchArgs = (args2) => {
|
|
@@ -28625,6 +29554,7 @@ var parseLaunchArgs = (args2) => {
|
|
|
28625
29554
|
let noTunnel = false;
|
|
28626
29555
|
let land = false;
|
|
28627
29556
|
let noLand = false;
|
|
29557
|
+
let json2 = false;
|
|
28628
29558
|
for (let index2 = 0; index2 < flagArgs.length; index2 += 1) {
|
|
28629
29559
|
const arg = flagArgs[index2] ?? "";
|
|
28630
29560
|
if (arg === "--ask") {
|
|
@@ -28655,6 +29585,10 @@ var parseLaunchArgs = (args2) => {
|
|
|
28655
29585
|
noLand = true;
|
|
28656
29586
|
continue;
|
|
28657
29587
|
}
|
|
29588
|
+
if (arg === "--json") {
|
|
29589
|
+
json2 = true;
|
|
29590
|
+
continue;
|
|
29591
|
+
}
|
|
28658
29592
|
if (arg === "--project" || arg === "--model" || arg === "--effort" || arg === "--base" || arg === "--name" || arg === "--worktree") {
|
|
28659
29593
|
const value3 = flagArgs[index2 + 1];
|
|
28660
29594
|
if (value3 === void 0) return { ...LAUNCH_ERROR, error: `${arg} needs a value` };
|
|
@@ -28710,6 +29644,7 @@ var parseLaunchArgs = (args2) => {
|
|
|
28710
29644
|
foreground,
|
|
28711
29645
|
noTunnel,
|
|
28712
29646
|
autoLand: land ? true : noLand ? false : null,
|
|
29647
|
+
json: json2,
|
|
28713
29648
|
custom,
|
|
28714
29649
|
error: null
|
|
28715
29650
|
};
|
|
@@ -28835,9 +29770,11 @@ var isCtrlChord = (key) => (key.mods & ~SHIFT2) === CTRL;
|
|
|
28835
29770
|
var isPressOrRepeat = (key) => key.event === 1 || key.event === 2;
|
|
28836
29771
|
var isPasteChunk = (data) => {
|
|
28837
29772
|
if (data.length === 1 && data[0] === 22) return true;
|
|
29773
|
+
const match7 = data.toString("latin1").matchAll(CSI_U).next().value;
|
|
29774
|
+
if (match7 === void 0 || match7.index !== 0 || match7[0].length !== data.length) return false;
|
|
28838
29775
|
const keys3 = csiUKeysOf(data);
|
|
28839
29776
|
const key = keys3[0];
|
|
28840
|
-
return keys3.length === 1 && key !== void 0 && (key.code === 118 || key.code === 86) && isCtrlChord(key) && isPressOrRepeat(key)
|
|
29777
|
+
return keys3.length === 1 && key !== void 0 && (key.code === 118 || key.code === 86) && isCtrlChord(key) && isPressOrRepeat(key);
|
|
28841
29778
|
};
|
|
28842
29779
|
var trackBracketedPaste = (output, current) => {
|
|
28843
29780
|
const text = output.toString("latin1");
|
|
@@ -28847,16 +29784,75 @@ var trackBracketedPaste = (output, current) => {
|
|
|
28847
29784
|
return on > off;
|
|
28848
29785
|
};
|
|
28849
29786
|
var pasteBytes = (text, bracketed) => Buffer.from(bracketed ? `\x1B[200~${text}\x1B[201~` : text, "utf8");
|
|
29787
|
+
var firstPositional = (args2, valued) => args2.find(
|
|
29788
|
+
(argument, index2) => !argument.startsWith("--") && (index2 === 0 || !valued.includes(args2[index2 - 1] ?? ""))
|
|
29789
|
+
);
|
|
29790
|
+
var redactCredentials = (text) => redactUrlCredentials(text);
|
|
29791
|
+
var redactKeys = (field) => Object.fromEntries(Object.entries(field).map(([key, value3]) => [redactCredentials(key), value3]));
|
|
29792
|
+
var isPlainObject = (field) => typeof field === "object" && field !== null && (Object.getPrototypeOf(field) === Object.prototype || Object.getPrototypeOf(field) === null);
|
|
29793
|
+
var jsonWithoutCredentials = (value3) => {
|
|
29794
|
+
const printed = JSON.stringify(
|
|
29795
|
+
value3,
|
|
29796
|
+
(_key, field) => {
|
|
29797
|
+
if (typeof field === "string") return redactCredentials(field);
|
|
29798
|
+
if (Object.prototype.toString.call(field) === "[object String]") {
|
|
29799
|
+
return redactCredentials(String(field));
|
|
29800
|
+
}
|
|
29801
|
+
return isPlainObject(field) ? redactKeys(field) : field;
|
|
29802
|
+
},
|
|
29803
|
+
2
|
|
29804
|
+
);
|
|
29805
|
+
return printed ?? "null";
|
|
29806
|
+
};
|
|
29807
|
+
var serviceViewAttempt = (view) => view.service.currentAttemptId === null ? null : view.attempts.find((candidate) => candidate.id === view.service.currentAttemptId) ?? null;
|
|
29808
|
+
var serviceViewStatus = (view) => {
|
|
29809
|
+
const observation = view.currentForward !== null && view.latestObservation?.forwardId === view.currentForward.id ? view.latestObservation : null;
|
|
29810
|
+
return observation?.state ?? view.currentForward?.state ?? serviceViewAttempt(view)?.status ?? "stopped";
|
|
29811
|
+
};
|
|
29812
|
+
var serviceViewHostPort = (view) => (view.endpoints.find((candidate) => candidate.scope === "private") ?? view.endpoints[0] ?? null)?.hostPort ?? null;
|
|
29813
|
+
|
|
29814
|
+
// src/dashboard-adoption.ts
|
|
29815
|
+
var ADOPT_MODE_ORDER = ["mend-key", "bridge"];
|
|
29816
|
+
var deriveAdoptOffer = (facts, savedMode = null) => {
|
|
29817
|
+
if (facts.repoRoot === null || facts.originUrl === null || repositoryCloneUrlIssue(facts.originUrl) !== null)
|
|
29818
|
+
return null;
|
|
29819
|
+
return {
|
|
29820
|
+
source: RepositoryCloneUrl.make(facts.originUrl),
|
|
29821
|
+
name: normalizeProjectName(facts.repoRoot.split("/").at(-1) ?? "project"),
|
|
29822
|
+
modeIndex: Math.max(0, ADOPT_MODE_ORDER.indexOf(savedMode ?? "mend-key"))
|
|
29823
|
+
};
|
|
29824
|
+
};
|
|
29825
|
+
var refusedAdoptOffer = (offer, reason) => ({
|
|
29826
|
+
...offer,
|
|
29827
|
+
failure: reason
|
|
29828
|
+
});
|
|
29829
|
+
var submitDashboardAdoption = async (api, input) => {
|
|
29830
|
+
const issue = repositoryCloneUrlIssue(input.source);
|
|
29831
|
+
if (issue !== null) return { kind: "invalid-source", message: issue };
|
|
29832
|
+
const project = await api("POST", "/projects", {
|
|
29833
|
+
name: input.name,
|
|
29834
|
+
source: RepositoryCloneUrl.make(input.source),
|
|
29835
|
+
gitAuthMode: input.gitAuthMode
|
|
29836
|
+
});
|
|
29837
|
+
return { kind: "adopted", project };
|
|
29838
|
+
};
|
|
29839
|
+
var configuredGitAuth = (mode) => {
|
|
29840
|
+
if (mode !== "mend-key" && mode !== "bridge") return null;
|
|
29841
|
+
return mode === "mend-key" ? { value: "mend key", note: "configured for SSH remotes" } : { value: "bridge", note: "configured to use `mend keys share` for SSH remotes" };
|
|
29842
|
+
};
|
|
28850
29843
|
|
|
28851
29844
|
// src/server-request.ts
|
|
28852
29845
|
var MendRequestError = class extends Error {
|
|
28853
29846
|
kind;
|
|
28854
29847
|
status;
|
|
28855
|
-
|
|
29848
|
+
/** The refused call and its tag, for code and diagnostics (`MEND_DEBUG`); never in the words. */
|
|
29849
|
+
refused;
|
|
29850
|
+
constructor(kind, message, status = null, refused = null) {
|
|
28856
29851
|
super(message);
|
|
28857
29852
|
this.name = "MendRequestError";
|
|
28858
29853
|
this.kind = kind;
|
|
28859
29854
|
this.status = status;
|
|
29855
|
+
this.refused = refused;
|
|
28860
29856
|
}
|
|
28861
29857
|
};
|
|
28862
29858
|
var TIMEOUT_CODES = /* @__PURE__ */ new Set([
|
|
@@ -28915,6 +29911,120 @@ var GATEWAY_STATUSES = /* @__PURE__ */ new Set([
|
|
|
28915
29911
|
]);
|
|
28916
29912
|
var mayStillBeWorking = (error) => error instanceof MendRequestError && (error.kind === "timeout" || error.kind === "dropped" || error.kind === "http" && error.status !== null && GATEWAY_STATUSES.has(error.status));
|
|
28917
29913
|
|
|
29914
|
+
// src/shared-workspace.ts
|
|
29915
|
+
var checkedAtOf = (retirement) => {
|
|
29916
|
+
if (retirement.checkedAt === null) return null;
|
|
29917
|
+
const at = new Date(retirement.checkedAt);
|
|
29918
|
+
return Number.isNaN(at.getTime()) ? null : at;
|
|
29919
|
+
};
|
|
29920
|
+
var retirementEvidenceLines = (retirement) => retirementStopLines({ stops: retirement.stops, checkedAt: checkedAtOf(retirement) });
|
|
29921
|
+
var workspaceReadsOf = (session) => ({
|
|
29922
|
+
waiting: (session.livePeople ?? []).length > 0 && session.sharedControlEnabledAt !== void 0 && session.sharedControlEnabledAt !== null,
|
|
29923
|
+
retirement: session.workspaceRetirement !== void 0 && session.workspaceRetirement !== null
|
|
29924
|
+
});
|
|
29925
|
+
var hasPersonFacts = (sessions) => sessions.some(
|
|
29926
|
+
(session) => (session.livePeople ?? []).length > 0 || session.workspaceRetirement !== void 0 && session.workspaceRetirement !== null
|
|
29927
|
+
);
|
|
29928
|
+
var worktreeListsPeople = (sessions, worktreeId) => sessions.some(
|
|
29929
|
+
(session) => session.worktreeId === worktreeId && (session.livePeople ?? []).length > 0
|
|
29930
|
+
);
|
|
29931
|
+
var othersLiveInWorktree = (sessions, worktreeId, viewer) => {
|
|
29932
|
+
if (viewer === null) return [];
|
|
29933
|
+
const names = /* @__PURE__ */ new Map();
|
|
29934
|
+
for (const session of sessions) {
|
|
29935
|
+
if (session.worktreeId !== worktreeId) continue;
|
|
29936
|
+
for (const person of session.livePeople ?? []) {
|
|
29937
|
+
if (person.accountId !== viewer) names.set(person.accountId, person.name);
|
|
29938
|
+
}
|
|
29939
|
+
}
|
|
29940
|
+
return [...names.values()];
|
|
29941
|
+
};
|
|
29942
|
+
var worktreeJoinLine = (sessions, worktreeId, viewer) => {
|
|
29943
|
+
const others = othersLiveInWorktree(sessions, worktreeId, viewer);
|
|
29944
|
+
if (others.length > 0) return joinWorktreeLine(others);
|
|
29945
|
+
if (viewer === null || worktreeListsPeople(sessions, worktreeId)) return null;
|
|
29946
|
+
const anotherLive = sessions.some(
|
|
29947
|
+
(session) => session.worktreeId === worktreeId && session.status !== void 0 && LIVE_STATUSES.has(session.status) && session.ownerUserId !== void 0 && session.ownerUserId !== null && session.ownerUserId !== viewer
|
|
29948
|
+
);
|
|
29949
|
+
return anotherLive ? JOIN_SHARED_HOME_LINE : null;
|
|
29950
|
+
};
|
|
29951
|
+
var launcherNameOf = (launcher, livePeople, members) => livePeople.find((person) => person.accountId === launcher)?.name ?? members.find((member) => member.userId === launcher)?.name ?? "its launcher";
|
|
29952
|
+
var sessionWorkspaceLines = (facts) => {
|
|
29953
|
+
const { retirement } = facts;
|
|
29954
|
+
return {
|
|
29955
|
+
shared: sharedWorkspaceLine(facts.livePeople, facts.viewer),
|
|
29956
|
+
waiting: facts.wait?.line ?? null,
|
|
29957
|
+
retirement: retirement === null ? null : workspaceRetirementLine(
|
|
29958
|
+
retirement,
|
|
29959
|
+
launcherNameOf(retirement.launcher, facts.livePeople, facts.members)
|
|
29960
|
+
),
|
|
29961
|
+
// Only the change's owner replaces it, and only while it is marked: a retiring one is
|
|
29962
|
+
// already being replaced.
|
|
29963
|
+
replace: retirement === null || !retirement.canReplace || retirement.state !== "marked" ? null : {
|
|
29964
|
+
action: REPLACE_WORKSPACE_ACTION,
|
|
29965
|
+
command: `mend workspace replace ${facts.sessionId.slice(0, 8)}`,
|
|
29966
|
+
stops: retirementEvidenceLines(retirement)
|
|
29967
|
+
}
|
|
29968
|
+
};
|
|
29969
|
+
};
|
|
29970
|
+
var workspaceLineList = (lines) => [
|
|
29971
|
+
...lines.shared === null ? [] : [lines.shared],
|
|
29972
|
+
...lines.waiting === null ? [] : [lines.waiting],
|
|
29973
|
+
...lines.retirement === null ? [] : [lines.retirement],
|
|
29974
|
+
...lines.replace === null ? [] : [
|
|
29975
|
+
`${lines.replace.action} \xB7 ${lines.replace.command}`,
|
|
29976
|
+
...lines.replace.stops.map((stop) => ` ${stop}`)
|
|
29977
|
+
]
|
|
29978
|
+
];
|
|
29979
|
+
var wrapWords = (text, width) => {
|
|
29980
|
+
const limit = Math.max(8, width);
|
|
29981
|
+
const lines = [];
|
|
29982
|
+
let current = "";
|
|
29983
|
+
for (const raw of text.split(/\s+/)) {
|
|
29984
|
+
if (raw === "") continue;
|
|
29985
|
+
let word = raw;
|
|
29986
|
+
while (word.length > limit) {
|
|
29987
|
+
if (current !== "") {
|
|
29988
|
+
lines.push(current);
|
|
29989
|
+
current = "";
|
|
29990
|
+
}
|
|
29991
|
+
lines.push(word.slice(0, limit));
|
|
29992
|
+
word = word.slice(limit);
|
|
29993
|
+
}
|
|
29994
|
+
if (current === "") current = word;
|
|
29995
|
+
else if (current.length + 1 + word.length <= limit) current = `${current} ${word}`;
|
|
29996
|
+
else {
|
|
29997
|
+
lines.push(current);
|
|
29998
|
+
current = word;
|
|
29999
|
+
}
|
|
30000
|
+
}
|
|
30001
|
+
if (current !== "") lines.push(current);
|
|
30002
|
+
return lines;
|
|
30003
|
+
};
|
|
30004
|
+
var confirmPlan = (args2, interactive) => args2.includes("--yes") || args2.includes("-y") ? "confirmed" : interactive ? "ask" : "refuse";
|
|
30005
|
+
var sharedControlConfirmLines = (turnsOnSendersLogin) => {
|
|
30006
|
+
const confirm = sharedControlConfirm(turnsOnSendersLogin);
|
|
30007
|
+
return [confirm.title, confirm.body];
|
|
30008
|
+
};
|
|
30009
|
+
var sharedControlQuestion = (turnsOnSendersLogin) => {
|
|
30010
|
+
const confirm = sharedControlConfirm(turnsOnSendersLogin);
|
|
30011
|
+
return `${confirm.confirm.toLowerCase()}? (n: ${confirm.cancel.toLowerCase()})`;
|
|
30012
|
+
};
|
|
30013
|
+
var replaceConfirmLines = (retirement) => [
|
|
30014
|
+
`${REPLACE_WORKSPACE_ACTION}?`,
|
|
30015
|
+
...retirementEvidenceLines(retirement).map((stop) => ` ${stop}`)
|
|
30016
|
+
];
|
|
30017
|
+
var askYesNo = async (question) => {
|
|
30018
|
+
const readline = await import("node:readline/promises");
|
|
30019
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
30020
|
+
try {
|
|
30021
|
+
const answer = (await rl.question(`${question} [y/N] `)).trim().toLowerCase();
|
|
30022
|
+
return answer === "y" || answer === "yes";
|
|
30023
|
+
} finally {
|
|
30024
|
+
rl.close();
|
|
30025
|
+
}
|
|
30026
|
+
};
|
|
30027
|
+
|
|
28918
30028
|
// src/workbench-events.ts
|
|
28919
30029
|
var createSseParser = () => {
|
|
28920
30030
|
let buffer = "";
|
|
@@ -28964,18 +30074,51 @@ var eventFamilies = (payload) => {
|
|
|
28964
30074
|
};
|
|
28965
30075
|
|
|
28966
30076
|
export {
|
|
30077
|
+
takesReviewFollowUp,
|
|
30078
|
+
noReviewFollowUpLine,
|
|
30079
|
+
resumesOwnHarness,
|
|
28967
30080
|
agentStartingLine,
|
|
28968
30081
|
agentStartingFacts,
|
|
30082
|
+
AMBIENT_REMOVED_GUIDANCE,
|
|
28969
30083
|
repositoryCloneUrlIssue,
|
|
28970
|
-
RepositoryCloneUrl,
|
|
28971
30084
|
landingFactsFromWire,
|
|
28972
30085
|
landingFactLine,
|
|
30086
|
+
AGENT_MEMORY_ROOTS,
|
|
30087
|
+
CODEX_MEMORY_DATABASE,
|
|
30088
|
+
AGENT_MEMORY_MAX_FILE_BYTES,
|
|
30089
|
+
AGENT_MEMORY_MAX_DATABASE_BYTES,
|
|
30090
|
+
agentMemoryNameOf,
|
|
30091
|
+
agentMemoryPathOf,
|
|
30092
|
+
checkpointSourceWords,
|
|
28973
30093
|
narrowCredential,
|
|
28974
30094
|
claudeGrantFacts,
|
|
28975
30095
|
sameGrant,
|
|
28976
30096
|
normalizeGitAuthor,
|
|
28977
30097
|
gitAuthorIssue,
|
|
30098
|
+
withoutLaunchPhase,
|
|
30099
|
+
launchPhaseOf,
|
|
30100
|
+
HOST_USER_NAMESPACE_FILES,
|
|
30101
|
+
HOST_USER_NAMESPACE_SYSCTL_FILE,
|
|
30102
|
+
HOST_USER_NAMESPACE_SYSCTL_MARKER,
|
|
30103
|
+
HOST_USER_NAMESPACE_SYSCTL_PREVIOUS,
|
|
30104
|
+
hostUserNamespacesSysctlLines,
|
|
30105
|
+
hostUserNamespacesOf,
|
|
30106
|
+
hostUserNamespacesFix,
|
|
30107
|
+
HOST_USER_NAMESPACES_REFUSED,
|
|
30108
|
+
hostUserNamespacesFixLine,
|
|
30109
|
+
PI_PROFILE_AGENT_PATH,
|
|
30110
|
+
PI_PROFILE_LOCAL_PACKAGES,
|
|
30111
|
+
PI_PROFILE_MAX_FILE_BYTES,
|
|
30112
|
+
validatePiProfile,
|
|
28978
30113
|
servicesHoldLine,
|
|
30114
|
+
validateSecretFilePath,
|
|
30115
|
+
serviceStartCorrelation,
|
|
30116
|
+
terminalReadOnlyLine,
|
|
30117
|
+
sharedControlLine,
|
|
30118
|
+
sharedControlConfirm,
|
|
30119
|
+
workspaceRetirementLine,
|
|
30120
|
+
REPLACE_WORKSPACE_ACTION,
|
|
30121
|
+
WORKTREE_REMOVAL_FORCE_HINT,
|
|
28979
30122
|
HARNESS_COMMANDS,
|
|
28980
30123
|
pendingId,
|
|
28981
30124
|
isPendingId,
|
|
@@ -28994,14 +30137,39 @@ export {
|
|
|
28994
30137
|
gitOriginUrl,
|
|
28995
30138
|
gitTopLevel,
|
|
28996
30139
|
normalizeProjectName,
|
|
30140
|
+
csiUKeysOf,
|
|
28997
30141
|
isPasteChunk,
|
|
28998
30142
|
trackBracketedPaste,
|
|
28999
30143
|
pasteBytes,
|
|
30144
|
+
firstPositional,
|
|
30145
|
+
redactCredentials,
|
|
30146
|
+
jsonWithoutCredentials,
|
|
30147
|
+
serviceViewAttempt,
|
|
30148
|
+
serviceViewStatus,
|
|
30149
|
+
serviceViewHostPort,
|
|
30150
|
+
ADOPT_MODE_ORDER,
|
|
30151
|
+
deriveAdoptOffer,
|
|
30152
|
+
refusedAdoptOffer,
|
|
30153
|
+
submitDashboardAdoption,
|
|
30154
|
+
configuredGitAuth,
|
|
29000
30155
|
MendRequestError,
|
|
29001
30156
|
spoken,
|
|
29002
30157
|
noAnswerError,
|
|
29003
30158
|
GATEWAY_STATUSES,
|
|
29004
30159
|
mayStillBeWorking,
|
|
30160
|
+
workspaceReadsOf,
|
|
30161
|
+
hasPersonFacts,
|
|
30162
|
+
worktreeListsPeople,
|
|
30163
|
+
worktreeJoinLine,
|
|
30164
|
+
launcherNameOf,
|
|
30165
|
+
sessionWorkspaceLines,
|
|
30166
|
+
workspaceLineList,
|
|
30167
|
+
wrapWords,
|
|
30168
|
+
confirmPlan,
|
|
30169
|
+
sharedControlConfirmLines,
|
|
30170
|
+
sharedControlQuestion,
|
|
30171
|
+
replaceConfirmLines,
|
|
30172
|
+
askYesNo,
|
|
29005
30173
|
createSseParser,
|
|
29006
30174
|
eventFamilies
|
|
29007
30175
|
};
|