@oxagen/cli 3.0.1-793 → 3.0.1-803
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 +6 -6
- package/oxagen.mjs +989 -1281
- package/package.json +1 -1
package/oxagen.mjs
CHANGED
|
@@ -9814,8 +9814,8 @@ function candidatePaths(path2, context) {
|
|
|
9814
9814
|
const base2 = fold(lib.normalize(root)).replace(/\/+$/, "");
|
|
9815
9815
|
return resolved.startsWith(`${base2}/`) ? resolved.slice(base2.length + 1) : void 0;
|
|
9816
9816
|
};
|
|
9817
|
-
const
|
|
9818
|
-
if (
|
|
9817
|
+
const relative11 = cwd !== void 0 ? under2(cwd) : void 0;
|
|
9818
|
+
if (relative11 !== void 0) out.push(relative11);
|
|
9819
9819
|
const fromHome = home !== void 0 ? under2(home) : void 0;
|
|
9820
9820
|
if (fromHome !== void 0) out.push(`~/${fromHome}`);
|
|
9821
9821
|
return out;
|
|
@@ -29915,7 +29915,7 @@ import { readFileSync as readFileSync10 } from "node:fs";
|
|
|
29915
29915
|
import { dirname as dirname9, resolve as resolve3 } from "node:path";
|
|
29916
29916
|
import { fileURLToPath } from "node:url";
|
|
29917
29917
|
function readVersion() {
|
|
29918
|
-
if (true) return "3.0.1-
|
|
29918
|
+
if (true) return "3.0.1-803";
|
|
29919
29919
|
try {
|
|
29920
29920
|
const here = dirname9(fileURLToPath(import.meta.url));
|
|
29921
29921
|
const pkg = JSON.parse(
|
|
@@ -30184,11 +30184,11 @@ function harnessFacts(exec4, name2, platform = process.platform, env = process.e
|
|
|
30184
30184
|
path2 ??= shellExecutable(exec4("sh", ["-lc", `command -v ${name2}`]));
|
|
30185
30185
|
}
|
|
30186
30186
|
if (path2 === void 0) {
|
|
30187
|
-
const
|
|
30187
|
+
const sep14 = platform === "win32" ? "\\" : "/";
|
|
30188
30188
|
const names2 = platform === "win32" ? [`${name2}.exe`, `${name2}.cmd`] : [name2];
|
|
30189
30189
|
outer: for (const dir of wellKnownBinDirs(home, platform, env)) {
|
|
30190
30190
|
for (const file of names2) {
|
|
30191
|
-
const candidate = `${dir}${
|
|
30191
|
+
const candidate = `${dir}${sep14}${file}`;
|
|
30192
30192
|
if (exists(candidate)) {
|
|
30193
30193
|
path2 = candidate;
|
|
30194
30194
|
break outer;
|
|
@@ -36873,8 +36873,8 @@ function harnessFileProblems(harnesses, deps) {
|
|
|
36873
36873
|
if (harnesses.includes("codex"))
|
|
36874
36874
|
check3(deps.paths.codexHooks, deps.readCodexHooks, hooksShapeProblem);
|
|
36875
36875
|
if (harnesses.includes("cursor")) {
|
|
36876
|
-
const
|
|
36877
|
-
if (
|
|
36876
|
+
const relative11 = absoluteHookCommandProblem(deps.runtime.hookCommand);
|
|
36877
|
+
if (relative11 !== void 0) problems.push(relative11);
|
|
36878
36878
|
for (const path2 of deps.paths.cursorHooks)
|
|
36879
36879
|
check3(path2, () => deps.readCursorHooks(path2), cursorHooksShapeProblem);
|
|
36880
36880
|
}
|
|
@@ -39830,6 +39830,9 @@ var init_github2 = __esm({
|
|
|
39830
39830
|
});
|
|
39831
39831
|
|
|
39832
39832
|
// ../../packages/tacho/src/contained/sandbox/profile.ts
|
|
39833
|
+
function sandboxCheckoutPath(repository) {
|
|
39834
|
+
return `${SANDBOX_WORKSPACE}/${repository}`;
|
|
39835
|
+
}
|
|
39833
39836
|
function sandboxMeasurement(placement, guest) {
|
|
39834
39837
|
const digests = [
|
|
39835
39838
|
placement.templateDigest,
|
|
@@ -39878,7 +39881,7 @@ function modalSandboxMeasurement(placement, guest) {
|
|
|
39878
39881
|
function sandboxLaunchMeasurement(placement, guest) {
|
|
39879
39882
|
return placement.profile === MODAL_SANDBOX_PROFILE ? modalSandboxMeasurement(placement, guest) : sandboxMeasurement(placement, guest);
|
|
39880
39883
|
}
|
|
39881
|
-
var SANDBOX_PROFILE, MODAL_SANDBOX_PROFILE, SANDBOX_HARNESSES, SANDBOX_AGENT_USER, SANDBOX_AGENT_UID, SANDBOX_AGENT_GID, SANDBOX_WORKSPACE, SANDBOX_AGENT_HOME, SANDBOX_GATEWAY_PORT, DIGEST, HOST_ID, VM_ID, MODAL_ENVIRONMENT, MODAL_ID;
|
|
39884
|
+
var SANDBOX_PROFILE, MODAL_SANDBOX_PROFILE, SANDBOX_HARNESSES, SANDBOX_AGENT_USER, SANDBOX_AGENT_UID, SANDBOX_AGENT_GID, SANDBOX_WORKSPACE, SANDBOX_AGENT_HOME, SANDBOX_INCLUDED_REPOSITORIES_MAX, SANDBOX_CHECKOUT_HELP_MARKER, SANDBOX_GATEWAY_PORT, DIGEST, HOST_ID, VM_ID, MODAL_ENVIRONMENT, MODAL_ID;
|
|
39882
39885
|
var init_profile = __esm({
|
|
39883
39886
|
"../../packages/tacho/src/contained/sandbox/profile.ts"() {
|
|
39884
39887
|
"use strict";
|
|
@@ -39890,6 +39893,8 @@ var init_profile = __esm({
|
|
|
39890
39893
|
SANDBOX_AGENT_GID = 1e3;
|
|
39891
39894
|
SANDBOX_WORKSPACE = "/workspace";
|
|
39892
39895
|
SANDBOX_AGENT_HOME = "/home/agent";
|
|
39896
|
+
SANDBOX_INCLUDED_REPOSITORIES_MAX = 50;
|
|
39897
|
+
SANDBOX_CHECKOUT_HELP_MARKER = "/workspace/<owner>/<name>";
|
|
39893
39898
|
SANDBOX_GATEWAY_PORT = 43801;
|
|
39894
39899
|
DIGEST = /^sha256:[a-f0-9]{64}$/;
|
|
39895
39900
|
HOST_ID = /^shs_[0-9a-z]+$/;
|
|
@@ -39900,7 +39905,7 @@ var init_profile = __esm({
|
|
|
39900
39905
|
});
|
|
39901
39906
|
|
|
39902
39907
|
// ../../packages/tacho/src/contained/sandbox/request.ts
|
|
39903
|
-
var digest2, hostPlacementSchema, modalPlacementSchema, sandboxPlacementSchema, sandboxRunRequestSchema;
|
|
39908
|
+
var digest2, hostPlacementSchema, modalPlacementSchema, sandboxPlacementSchema, sandboxIncludedRepositorySchema, sandboxRunRequestSchema;
|
|
39904
39909
|
var init_request = __esm({
|
|
39905
39910
|
"../../packages/tacho/src/contained/sandbox/request.ts"() {
|
|
39906
39911
|
"use strict";
|
|
@@ -39927,6 +39932,20 @@ var init_request = __esm({
|
|
|
39927
39932
|
modalPlacementSchema,
|
|
39928
39933
|
hostPlacementSchema
|
|
39929
39934
|
]);
|
|
39935
|
+
sandboxIncludedRepositorySchema = external_exports.object({
|
|
39936
|
+
/** `owner/name` on GitHub, or the project's full path on GitLab. */
|
|
39937
|
+
repository: external_exports.string().min(3).max(1024),
|
|
39938
|
+
/** Present when the repository is a GitLab project. */
|
|
39939
|
+
gitlab: containedGitLabSchema.optional()
|
|
39940
|
+
}).strict().superRefine((included, ctx2) => {
|
|
39941
|
+
const valid = included.gitlab === void 0 ? containedGitHubSchema.shape.repository.safeParse(included.repository).success : isGitLabProjectPath(included.repository);
|
|
39942
|
+
if (!valid)
|
|
39943
|
+
ctx2.addIssue({
|
|
39944
|
+
code: external_exports.ZodIssueCode.custom,
|
|
39945
|
+
path: ["repository"],
|
|
39946
|
+
message: "The repository is not owner/name or a GitLab project path"
|
|
39947
|
+
});
|
|
39948
|
+
});
|
|
39930
39949
|
sandboxRunRequestSchema = external_exports.object({
|
|
39931
39950
|
/** `sbx_…`, the sandbox the control plane placed. */
|
|
39932
39951
|
sandboxId: external_exports.string().regex(/^sbx_[0-9a-z]+$/),
|
|
@@ -39948,8 +39967,28 @@ var init_request = __esm({
|
|
|
39948
39967
|
* launcher resumes the harness's session from disk and sends no prompt.
|
|
39949
39968
|
*/
|
|
39950
39969
|
resume: external_exports.boolean().default(false),
|
|
39970
|
+
/**
|
|
39971
|
+
* The other repositories the run checks out, in the workspace's order
|
|
39972
|
+
* (ADR-8604). Present, every repository sits at its own path under the
|
|
39973
|
+
* workspace folder and the harness starts in the target's. Absent, the
|
|
39974
|
+
* run keeps its one clone at the workspace folder, as before.
|
|
39975
|
+
*/
|
|
39976
|
+
repositories: external_exports.array(sandboxIncludedRepositorySchema).max(SANDBOX_INCLUDED_REPOSITORIES_MAX).optional(),
|
|
39951
39977
|
placement: sandboxPlacementSchema
|
|
39952
39978
|
}).strict().superRefine((request3, ctx2) => {
|
|
39979
|
+
if (request3.repositories !== void 0) {
|
|
39980
|
+
const paths = /* @__PURE__ */ new Set([sandboxCheckoutPath(request3.repository)]);
|
|
39981
|
+
for (const included of request3.repositories) {
|
|
39982
|
+
const path2 = sandboxCheckoutPath(included.repository);
|
|
39983
|
+
if (paths.has(path2))
|
|
39984
|
+
ctx2.addIssue({
|
|
39985
|
+
code: external_exports.ZodIssueCode.custom,
|
|
39986
|
+
path: ["repositories"],
|
|
39987
|
+
message: `Two repositories of the run would share ${path2}`
|
|
39988
|
+
});
|
|
39989
|
+
paths.add(path2);
|
|
39990
|
+
}
|
|
39991
|
+
}
|
|
39953
39992
|
const valid = request3.gitlab === void 0 ? containedGitHubSchema.shape.repository.safeParse(request3.repository).success : isGitLabProjectPath(request3.repository);
|
|
39954
39993
|
if (!valid)
|
|
39955
39994
|
ctx2.addIssue({
|
|
@@ -40246,6 +40285,17 @@ var init_provider_launch = __esm({
|
|
|
40246
40285
|
*/
|
|
40247
40286
|
gitlab: external_exports.object({ host: hostName }).strict().optional(),
|
|
40248
40287
|
branch: external_exports.string().min(1).max(255),
|
|
40288
|
+
/**
|
|
40289
|
+
* The other repositories the run checks out, in the workspace's order
|
|
40290
|
+
* (ADR-8604), each on its default branch. Absent for a template built
|
|
40291
|
+
* before this field, whose launcher would refuse it.
|
|
40292
|
+
*/
|
|
40293
|
+
repositories: external_exports.array(
|
|
40294
|
+
external_exports.object({
|
|
40295
|
+
repositoryFullName: external_exports.string().min(3).max(1024),
|
|
40296
|
+
gitlab: external_exports.object({ host: hostName }).strict().optional()
|
|
40297
|
+
}).strict()
|
|
40298
|
+
).max(SANDBOX_INCLUDED_REPOSITORIES_MAX).optional(),
|
|
40249
40299
|
/** `wo_…`, the work order the run holds, or null. */
|
|
40250
40300
|
workOrderId: external_exports.string().nullable(),
|
|
40251
40301
|
modalEnvironment: external_exports.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/),
|
|
@@ -42263,13 +42313,27 @@ var init_gateway = __esm({
|
|
|
42263
42313
|
// ../../packages/tacho/src/contained/sandbox/harness/claude-code.ts
|
|
42264
42314
|
function claudeCodeEnvironment(options) {
|
|
42265
42315
|
const port = options.gatewayPort ?? SANDBOX_GATEWAY_PORT;
|
|
42266
|
-
const
|
|
42316
|
+
const forgeOf = (gitlabHost) => gitlabHost === void 0 ? {
|
|
42267
42317
|
prefix: `http://127.0.0.1:${port}/github/git/`,
|
|
42268
42318
|
origin: "https://github.com/"
|
|
42269
42319
|
} : {
|
|
42270
|
-
prefix: `http://127.0.0.1:${port}/gitlab/git/${
|
|
42271
|
-
origin: `https://${
|
|
42272
|
-
};
|
|
42320
|
+
prefix: `http://127.0.0.1:${port}/gitlab/git/${gitlabHost}/`,
|
|
42321
|
+
origin: `https://${gitlabHost}/`
|
|
42322
|
+
};
|
|
42323
|
+
const forges = [
|
|
42324
|
+
options.gitlabHost,
|
|
42325
|
+
...(options.included ?? []).map((r) => r.gitlabHost)
|
|
42326
|
+
].map(forgeOf).filter(
|
|
42327
|
+
(forge, at2, all) => all.findIndex((other) => other.origin === forge.origin) === at2
|
|
42328
|
+
);
|
|
42329
|
+
const trusted = options.checkouts ?? [SANDBOX_WORKSPACE];
|
|
42330
|
+
const gitConfig = [
|
|
42331
|
+
...forges.map((forge) => [
|
|
42332
|
+
`url.${forge.prefix}.insteadOf`,
|
|
42333
|
+
forge.origin
|
|
42334
|
+
]),
|
|
42335
|
+
...trusted.map((folder) => ["safe.directory", folder])
|
|
42336
|
+
];
|
|
42273
42337
|
return {
|
|
42274
42338
|
PATH: "/usr/local/bin:/usr/bin:/bin",
|
|
42275
42339
|
HOME: SANDBOX_AGENT_HOME,
|
|
@@ -42284,20 +42348,23 @@ function claudeCodeEnvironment(options) {
|
|
|
42284
42348
|
ENABLE_TOOL_SEARCH: "true",
|
|
42285
42349
|
DISABLE_AUTOUPDATER: "1",
|
|
42286
42350
|
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1",
|
|
42287
|
-
GIT_CONFIG_COUNT:
|
|
42288
|
-
|
|
42289
|
-
|
|
42290
|
-
|
|
42291
|
-
|
|
42351
|
+
GIT_CONFIG_COUNT: String(gitConfig.length),
|
|
42352
|
+
...Object.fromEntries(
|
|
42353
|
+
gitConfig.flatMap(([key, value], at2) => [
|
|
42354
|
+
[`GIT_CONFIG_KEY_${at2}`, key],
|
|
42355
|
+
[`GIT_CONFIG_VALUE_${at2}`, value]
|
|
42356
|
+
])
|
|
42357
|
+
),
|
|
42292
42358
|
GIT_TERMINAL_PROMPT: "0",
|
|
42293
42359
|
...options.gitlabHost === void 0 ? { GITHUB_REPOSITORY: options.repository } : {},
|
|
42294
42360
|
...options.workOrderId !== null ? { OXAGEN_WORK_ORDER_ID: options.workOrderId } : {}
|
|
42295
42361
|
};
|
|
42296
42362
|
}
|
|
42297
|
-
function claudeCodeArguments(prompt, resume = false) {
|
|
42363
|
+
function claudeCodeArguments(prompt, resume = false, addDirs = []) {
|
|
42364
|
+
const dirs = addDirs.flatMap((dir) => ["--add-dir", dir]);
|
|
42298
42365
|
if (resume)
|
|
42299
|
-
return prompt === null ? ["--continue"] : ["--continue", "--print"];
|
|
42300
|
-
return prompt === null ?
|
|
42366
|
+
return prompt === null ? ["--continue", ...dirs] : ["--continue", ...dirs, "--print"];
|
|
42367
|
+
return prompt === null ? dirs : [...dirs, "--print", "--", prompt];
|
|
42301
42368
|
}
|
|
42302
42369
|
function claudeCodeManagedSettings(hookCommand) {
|
|
42303
42370
|
const hooks = Object.fromEntries(
|
|
@@ -42322,13 +42389,13 @@ function claudeCodeManagedSettings(hookCommand) {
|
|
|
42322
42389
|
2
|
|
42323
42390
|
) + "\n";
|
|
42324
42391
|
}
|
|
42325
|
-
function claudeCodeUserState(gatewayPort = SANDBOX_GATEWAY_PORT) {
|
|
42392
|
+
function claudeCodeUserState(gatewayPort = SANDBOX_GATEWAY_PORT, project2 = SANDBOX_WORKSPACE) {
|
|
42326
42393
|
return {
|
|
42327
42394
|
".claude.json": JSON.stringify({
|
|
42328
42395
|
hasCompletedOnboarding: true,
|
|
42329
42396
|
autoUpdates: false,
|
|
42330
42397
|
projects: {
|
|
42331
|
-
[
|
|
42398
|
+
[project2]: {
|
|
42332
42399
|
hasTrustDialogAccepted: true,
|
|
42333
42400
|
hasCompletedProjectOnboarding: true,
|
|
42334
42401
|
mcpServers: {
|
|
@@ -42518,6 +42585,30 @@ var init_privilege = __esm({
|
|
|
42518
42585
|
// ../../packages/tacho/src/contained/sandbox/launcher.ts
|
|
42519
42586
|
import { randomBytes as randomBytes9 } from "node:crypto";
|
|
42520
42587
|
import { join as join31 } from "node:path";
|
|
42588
|
+
function sandboxCheckouts(request3) {
|
|
42589
|
+
const target = {
|
|
42590
|
+
repository: request3.repository,
|
|
42591
|
+
...request3.gitlabHost !== void 0 ? { gitlabHost: request3.gitlabHost } : {},
|
|
42592
|
+
path: request3.repositories === void 0 ? SANDBOX_WORKSPACE : sandboxCheckoutPath(request3.repository)
|
|
42593
|
+
};
|
|
42594
|
+
const included = (request3.repositories ?? []).map((other) => ({
|
|
42595
|
+
...other,
|
|
42596
|
+
path: sandboxCheckoutPath(other.repository)
|
|
42597
|
+
}));
|
|
42598
|
+
return { target, included };
|
|
42599
|
+
}
|
|
42600
|
+
function cloneUrl(checkout) {
|
|
42601
|
+
return `https://${checkout.gitlabHost ?? "github.com"}/${checkout.repository}.git`;
|
|
42602
|
+
}
|
|
42603
|
+
function assertRepository(checkout) {
|
|
42604
|
+
if (checkout.gitlabHost !== void 0) {
|
|
42605
|
+
if (!containedGitLabSchema.shape.host.safeParse(checkout.gitlabHost).success || !isGitLabProjectPath(checkout.repository))
|
|
42606
|
+
throw new Error(
|
|
42607
|
+
"The GitLab project must be its full path on a GitLab host name"
|
|
42608
|
+
);
|
|
42609
|
+
} else if (!REPOSITORY.test(checkout.repository) || /\/\.\.?$/.test(checkout.repository))
|
|
42610
|
+
throw new Error("The repository must be owner/name");
|
|
42611
|
+
}
|
|
42521
42612
|
function shellQuote4(value) {
|
|
42522
42613
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
42523
42614
|
}
|
|
@@ -42527,13 +42618,19 @@ function sandboxHarnessEnvironment(request3, gatewayPort) {
|
|
|
42527
42618
|
([name2]) => !isReservedSandboxEnvName(name2)
|
|
42528
42619
|
)
|
|
42529
42620
|
);
|
|
42621
|
+
const checkouts = sandboxCheckouts(request3);
|
|
42530
42622
|
return {
|
|
42531
42623
|
...runtime,
|
|
42532
42624
|
...claudeCodeEnvironment({
|
|
42533
42625
|
...gatewayPort !== void 0 ? { gatewayPort } : {},
|
|
42534
42626
|
repository: request3.repository,
|
|
42535
42627
|
...request3.gitlabHost !== void 0 ? { gitlabHost: request3.gitlabHost } : {},
|
|
42536
|
-
workOrderId: request3.workOrderId
|
|
42628
|
+
workOrderId: request3.workOrderId,
|
|
42629
|
+
included: checkouts.included,
|
|
42630
|
+
checkouts: [
|
|
42631
|
+
checkouts.target.path,
|
|
42632
|
+
...checkouts.included.map((other) => other.path)
|
|
42633
|
+
]
|
|
42537
42634
|
})
|
|
42538
42635
|
};
|
|
42539
42636
|
}
|
|
@@ -42560,13 +42657,19 @@ async function launchSandboxAgent(options) {
|
|
|
42560
42657
|
);
|
|
42561
42658
|
if (!SANDBOX_HARNESSES.includes(request3.harness))
|
|
42562
42659
|
throw new Error(`This sandbox cannot start ${String(request3.harness)}`);
|
|
42563
|
-
|
|
42564
|
-
|
|
42565
|
-
|
|
42566
|
-
|
|
42567
|
-
|
|
42568
|
-
|
|
42569
|
-
|
|
42660
|
+
const checkouts = sandboxCheckouts(request3);
|
|
42661
|
+
assertRepository(checkouts.target);
|
|
42662
|
+
if (checkouts.included.length > SANDBOX_INCLUDED_REPOSITORIES_MAX)
|
|
42663
|
+
throw new Error(
|
|
42664
|
+
`A run checks out at most ${SANDBOX_INCLUDED_REPOSITORIES_MAX} repositories beside its own`
|
|
42665
|
+
);
|
|
42666
|
+
const taken = /* @__PURE__ */ new Set([checkouts.target.path]);
|
|
42667
|
+
for (const other of checkouts.included) {
|
|
42668
|
+
assertRepository(other);
|
|
42669
|
+
if (taken.has(other.path))
|
|
42670
|
+
throw new Error(`Two repositories of the run would share ${other.path}`);
|
|
42671
|
+
taken.add(other.path);
|
|
42672
|
+
}
|
|
42570
42673
|
if (!BRANCH.test(request3.branch) || request3.branch.startsWith("-") || request3.branch.includes(".."))
|
|
42571
42674
|
throw new Error("The branch name is not one Git accepts");
|
|
42572
42675
|
const hooks = pinSandboxHooks(system, {
|
|
@@ -42595,7 +42698,7 @@ async function launchSandboxAgent(options) {
|
|
|
42595
42698
|
try {
|
|
42596
42699
|
prepared = await options.prepare({
|
|
42597
42700
|
sessionId,
|
|
42598
|
-
workspace:
|
|
42701
|
+
workspace: checkouts.target.path
|
|
42599
42702
|
});
|
|
42600
42703
|
for (const directory of [SANDBOX_WORKSPACE, SANDBOX_AGENT_HOME]) {
|
|
42601
42704
|
system.mkdir(directory, 493, AGENT_OWNER);
|
|
@@ -42609,14 +42712,21 @@ async function launchSandboxAgent(options) {
|
|
|
42609
42712
|
request3.branch,
|
|
42610
42713
|
"--single-branch",
|
|
42611
42714
|
"--",
|
|
42612
|
-
|
|
42613
|
-
|
|
42715
|
+
cloneUrl(checkouts.target),
|
|
42716
|
+
checkouts.target.path
|
|
42614
42717
|
],
|
|
42615
42718
|
{ ...asAgent, cwd: SANDBOX_AGENT_HOME, timeoutMs: 15 * 6e4 }
|
|
42616
42719
|
);
|
|
42720
|
+
for (const other of checkouts.included) {
|
|
42721
|
+
await system.exec(
|
|
42722
|
+
"git",
|
|
42723
|
+
["clone", "--single-branch", "--", cloneUrl(other), other.path],
|
|
42724
|
+
{ ...asAgent, cwd: SANDBOX_AGENT_HOME, timeoutMs: 15 * 6e4 }
|
|
42725
|
+
);
|
|
42726
|
+
}
|
|
42617
42727
|
}
|
|
42618
42728
|
for (const [name2, contents] of Object.entries(
|
|
42619
|
-
claudeCodeUserState(options.gatewayPort)
|
|
42729
|
+
claudeCodeUserState(options.gatewayPort, checkouts.target.path)
|
|
42620
42730
|
)) {
|
|
42621
42731
|
system.writeFile(
|
|
42622
42732
|
join31(SANDBOX_AGENT_HOME, name2),
|
|
@@ -42627,7 +42737,7 @@ async function launchSandboxAgent(options) {
|
|
|
42627
42737
|
}
|
|
42628
42738
|
const harnessVersion = (await system.exec("claude", ["--version"], {
|
|
42629
42739
|
...asAgent,
|
|
42630
|
-
cwd:
|
|
42740
|
+
cwd: checkouts.target.path,
|
|
42631
42741
|
timeoutMs: 3e4
|
|
42632
42742
|
})).stdout.trim().split(/\s+/)[0]?.slice(0, 64);
|
|
42633
42743
|
if (!harnessVersion)
|
|
@@ -42645,12 +42755,19 @@ async function launchSandboxAgent(options) {
|
|
|
42645
42755
|
);
|
|
42646
42756
|
const prompt = request3.prompt ?? registered?.prompt ?? null;
|
|
42647
42757
|
const pty = ptyCommand(
|
|
42648
|
-
[
|
|
42758
|
+
[
|
|
42759
|
+
"claude",
|
|
42760
|
+
...claudeCodeArguments(
|
|
42761
|
+
prompt,
|
|
42762
|
+
request3.resume,
|
|
42763
|
+
checkouts.included.map((other) => other.path)
|
|
42764
|
+
)
|
|
42765
|
+
],
|
|
42649
42766
|
options.harnessSession
|
|
42650
42767
|
);
|
|
42651
42768
|
const child = system.spawn(pty.file, pty.args, {
|
|
42652
42769
|
...asAgent,
|
|
42653
|
-
cwd:
|
|
42770
|
+
cwd: checkouts.target.path
|
|
42654
42771
|
});
|
|
42655
42772
|
started = true;
|
|
42656
42773
|
const stop = () => child.kill("SIGTERM");
|
|
@@ -43244,6 +43361,12 @@ function createContainedRunner(options) {
|
|
|
43244
43361
|
repository: input.repository,
|
|
43245
43362
|
...input.gitlab !== void 0 ? { gitlabHost: input.gitlab.host } : {},
|
|
43246
43363
|
branch: input.branch,
|
|
43364
|
+
...input.repositories !== void 0 ? {
|
|
43365
|
+
repositories: input.repositories.map((included) => ({
|
|
43366
|
+
repository: included.repository,
|
|
43367
|
+
...included.gitlab !== void 0 ? { gitlabHost: included.gitlab.host } : {}
|
|
43368
|
+
}))
|
|
43369
|
+
} : {},
|
|
43247
43370
|
workOrderId: input.workOrderId,
|
|
43248
43371
|
environment: input.environment,
|
|
43249
43372
|
resume: input.resume
|
|
@@ -46616,6 +46739,283 @@ var init_git_lane = __esm({
|
|
|
46616
46739
|
}
|
|
46617
46740
|
});
|
|
46618
46741
|
|
|
46742
|
+
// ../../packages/tacho/src/interjection.ts
|
|
46743
|
+
var digest4, timestamp, count5, configVersion, workspaceSlug, interjectionKeySchema, INTERJECTION_RECEIPT_ID_PATTERN, INTERJECTION_QUESTION_MAX, INTERJECTION_OPEN, INTERJECTION_PATHS, INTERJECTION_ANSWER_SOURCES, SKILLS_RESOLVED_REASONS, repoUnknownBodySchema, interjectLinkPathSchema, interjectCreatePathSchema, INTERJECT_PROVIDERS, interjectBodySchema, answerBodySchema, repoBoundBodySchema, workspaceCreatedBodySchema, skillsResolvedBodySchema, interjectionAnswerPayloadSchema;
|
|
46744
|
+
var init_interjection = __esm({
|
|
46745
|
+
"../../packages/tacho/src/interjection.ts"() {
|
|
46746
|
+
"use strict";
|
|
46747
|
+
init_zod();
|
|
46748
|
+
init_digest();
|
|
46749
|
+
init_timestamp();
|
|
46750
|
+
digest4 = external_exports.string().regex(SHA256_DIGEST_PATTERN);
|
|
46751
|
+
timestamp = external_exports.string().refine(isProtocolTimestamp, "protocol timestamp");
|
|
46752
|
+
count5 = external_exports.number().int().nonnegative();
|
|
46753
|
+
configVersion = external_exports.string().min(1).max(64).nullable();
|
|
46754
|
+
workspaceSlug = external_exports.string().min(1).max(64);
|
|
46755
|
+
interjectionKeySchema = external_exports.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/, "a ULID");
|
|
46756
|
+
INTERJECTION_RECEIPT_ID_PATTERN = /^rcp_[0-9a-z]+$/;
|
|
46757
|
+
INTERJECTION_QUESTION_MAX = 2e3;
|
|
46758
|
+
INTERJECTION_OPEN = "interjection_open";
|
|
46759
|
+
INTERJECTION_PATHS = ["link", "create", "deny"];
|
|
46760
|
+
INTERJECTION_ANSWER_SOURCES = ["person", "timeout"];
|
|
46761
|
+
SKILLS_RESOLVED_REASONS = [
|
|
46762
|
+
"skills_off",
|
|
46763
|
+
"denied",
|
|
46764
|
+
"resolved"
|
|
46765
|
+
];
|
|
46766
|
+
repoUnknownBodySchema = external_exports.object({
|
|
46767
|
+
/** sha256 of `canonicalRemote(origin)`; the remote itself never leaves the host. */
|
|
46768
|
+
remote_digest: digest4,
|
|
46769
|
+
/** sha256 of `foldedRemote(canonicalRemote(origin))`; absent when the host does not fold. */
|
|
46770
|
+
remote_digest_folded: digest4.optional(),
|
|
46771
|
+
head_sha: external_exports.string().max(512).optional(),
|
|
46772
|
+
/** The bundle asked only because the workspace has skills on. */
|
|
46773
|
+
skills_enabled: external_exports.literal(true),
|
|
46774
|
+
/** The bundle's `unbound_repo.policy`. */
|
|
46775
|
+
unbound_repo: external_exports.literal("ask"),
|
|
46776
|
+
/** The skills configuration the bundle carried; null when none was named. */
|
|
46777
|
+
config_version: configVersion
|
|
46778
|
+
}).strict();
|
|
46779
|
+
interjectLinkPathSchema = external_exports.object({
|
|
46780
|
+
path: external_exports.literal("link"),
|
|
46781
|
+
workspace_slug: workspaceSlug,
|
|
46782
|
+
config_version: configVersion,
|
|
46783
|
+
/** Skills the workspace's configuration pins; null when not counted. */
|
|
46784
|
+
skills_pinned: count5.nullable(),
|
|
46785
|
+
/** Repositories the workspace already links; null when not counted. */
|
|
46786
|
+
linked_repositories: count5.nullable()
|
|
46787
|
+
}).strict();
|
|
46788
|
+
interjectCreatePathSchema = external_exports.object({
|
|
46789
|
+
path: external_exports.literal("create"),
|
|
46790
|
+
/** From the repository's name; null when the host could not read one. */
|
|
46791
|
+
proposed_name: external_exports.string().min(1).max(120).nullable(),
|
|
46792
|
+
proposed_slug: workspaceSlug.nullable(),
|
|
46793
|
+
skills_enabled: external_exports.literal(false)
|
|
46794
|
+
}).strict();
|
|
46795
|
+
INTERJECT_PROVIDERS = ["github", "gitlab"];
|
|
46796
|
+
interjectBodySchema = external_exports.object({
|
|
46797
|
+
interjection_key: interjectionKeySchema,
|
|
46798
|
+
reason: external_exports.literal("repo_unknown"),
|
|
46799
|
+
question: external_exports.string().min(1).max(INTERJECTION_QUESTION_MAX),
|
|
46800
|
+
remote_digest: digest4,
|
|
46801
|
+
remote_digest_folded: digest4.optional(),
|
|
46802
|
+
/** How long the host waits, from the bundle's `unbound_repo.timeout_ms`. */
|
|
46803
|
+
timeout_ms: external_exports.number().int().positive(),
|
|
46804
|
+
/** The host's clock plus `timeout_ms`. The control plane keeps its own deadline. */
|
|
46805
|
+
expires_at: timestamp,
|
|
46806
|
+
/** What the timeout answers. */
|
|
46807
|
+
on_timeout: external_exports.literal("deny"),
|
|
46808
|
+
/** The two paths a person can take, link first. Deny needs no path. */
|
|
46809
|
+
paths: external_exports.tuple([interjectLinkPathSchema, interjectCreatePathSchema]),
|
|
46810
|
+
/**
|
|
46811
|
+
* The forge the remote's host names (#4439): `github` for github.com and
|
|
46812
|
+
* `gitlab` for gitlab.com. Absent for any other host, and from a host
|
|
46813
|
+
* built before the field, which the control plane reads as GitHub. The
|
|
46814
|
+
* host string itself stays on the machine. A GitLab project binds through
|
|
46815
|
+
* its own project access token, so the control plane offers no link for
|
|
46816
|
+
* a `gitlab` question.
|
|
46817
|
+
*/
|
|
46818
|
+
provider: external_exports.enum(INTERJECT_PROVIDERS).optional()
|
|
46819
|
+
}).strict();
|
|
46820
|
+
answerBodySchema = external_exports.object({
|
|
46821
|
+
interjection_key: interjectionKeySchema,
|
|
46822
|
+
/** The control plane's row (`inj_…`); absent on a timeout the host answered alone. */
|
|
46823
|
+
interjection_id: external_exports.string().regex(/^inj_[0-9a-z]+$/).optional(),
|
|
46824
|
+
path: external_exports.enum(INTERJECTION_PATHS),
|
|
46825
|
+
source: external_exports.enum(INTERJECTION_ANSWER_SOURCES),
|
|
46826
|
+
/** The receipt the control plane recorded; absent on a host-side timeout. */
|
|
46827
|
+
receipt_id: external_exports.string().regex(INTERJECTION_RECEIPT_ID_PATTERN).optional(),
|
|
46828
|
+
/** The person who answered (`usr_…`); absent on a timeout. */
|
|
46829
|
+
answered_by: external_exports.string().regex(/^usr_[0-9a-z]+$/).optional(),
|
|
46830
|
+
/** The `message` command that carried the answer (`tcm_…`). */
|
|
46831
|
+
command_id: external_exports.string().regex(/^tcm_[0-9a-z]+$/).optional()
|
|
46832
|
+
}).strict();
|
|
46833
|
+
repoBoundBodySchema = external_exports.object({
|
|
46834
|
+
interjection_key: interjectionKeySchema,
|
|
46835
|
+
binding_id: external_exports.string().min(1).max(64),
|
|
46836
|
+
workspace_slug: workspaceSlug,
|
|
46837
|
+
role: external_exports.enum(["linked", "main"])
|
|
46838
|
+
}).strict();
|
|
46839
|
+
workspaceCreatedBodySchema = external_exports.object({
|
|
46840
|
+
interjection_key: interjectionKeySchema,
|
|
46841
|
+
workspace_id: external_exports.string().min(1).max(64),
|
|
46842
|
+
workspace_slug: workspaceSlug,
|
|
46843
|
+
skills_enabled: external_exports.literal(false)
|
|
46844
|
+
}).strict();
|
|
46845
|
+
skillsResolvedBodySchema = external_exports.object({
|
|
46846
|
+
/** The interjection that settled it; absent when no question was asked. */
|
|
46847
|
+
interjection_key: interjectionKeySchema.optional(),
|
|
46848
|
+
config_version: configVersion,
|
|
46849
|
+
/** Skills the session may load. */
|
|
46850
|
+
in_scope: count5,
|
|
46851
|
+
/** Skills the configuration holds back; null until the catalog read counts them (#3098). */
|
|
46852
|
+
withheld: count5.nullable(),
|
|
46853
|
+
reason: external_exports.enum(SKILLS_RESOLVED_REASONS)
|
|
46854
|
+
}).strict();
|
|
46855
|
+
interjectionAnswerPayloadSchema = external_exports.object({
|
|
46856
|
+
key: interjectionKeySchema,
|
|
46857
|
+
path: external_exports.enum(INTERJECTION_PATHS),
|
|
46858
|
+
source: external_exports.enum(INTERJECTION_ANSWER_SOURCES),
|
|
46859
|
+
receipt_id: external_exports.string().regex(INTERJECTION_RECEIPT_ID_PATTERN),
|
|
46860
|
+
/** The person who answered (`usr_…`); null on a timeout. */
|
|
46861
|
+
answered_by: external_exports.string().regex(/^usr_[0-9a-z]+$/).nullable(),
|
|
46862
|
+
/** Set on a link or create answer. */
|
|
46863
|
+
binding_id: external_exports.string().min(1).max(64).optional(),
|
|
46864
|
+
/** Set on a create answer. */
|
|
46865
|
+
workspace_id: external_exports.string().min(1).max(64).optional(),
|
|
46866
|
+
workspace_slug: workspaceSlug.optional()
|
|
46867
|
+
}).strict();
|
|
46868
|
+
}
|
|
46869
|
+
});
|
|
46870
|
+
|
|
46871
|
+
// ../../packages/tacho/src/loops.ts
|
|
46872
|
+
function isMcpTool(tool) {
|
|
46873
|
+
return tool.startsWith(MCP_TOOL_PREFIX) || tool.startsWith(CURSOR_MCP_TOOL_PREFIX);
|
|
46874
|
+
}
|
|
46875
|
+
function slotsOf(steps) {
|
|
46876
|
+
return steps.map((step) => "fileChanged" in step ? null : step);
|
|
46877
|
+
}
|
|
46878
|
+
function sameResult(a, b3) {
|
|
46879
|
+
return a.tool === b3.tool && a.inputHash === b3.inputHash && a.outputHash === b3.outputHash;
|
|
46880
|
+
}
|
|
46881
|
+
function sameFailure(a, b3) {
|
|
46882
|
+
return a.tool === b3.tool && a.inputHash === b3.inputHash && a.errorClass === b3.errorClass;
|
|
46883
|
+
}
|
|
46884
|
+
function hashed(c) {
|
|
46885
|
+
return c.inputHash !== "" && c.outputHash !== "";
|
|
46886
|
+
}
|
|
46887
|
+
function failed(c) {
|
|
46888
|
+
return c.inputHash !== "" && c.errorClass !== null && c.errorClass !== "";
|
|
46889
|
+
}
|
|
46890
|
+
function reaches(loop, length) {
|
|
46891
|
+
const calls = loop.positions.length;
|
|
46892
|
+
return "calls" in length ? calls >= length.calls : Math.floor(calls / loop.period) >= length.cycles;
|
|
46893
|
+
}
|
|
46894
|
+
function streaks(slots, kind, joins, matches2) {
|
|
46895
|
+
const out = [];
|
|
46896
|
+
let run3 = [];
|
|
46897
|
+
let positions = [];
|
|
46898
|
+
const close = () => {
|
|
46899
|
+
const first = run3[0];
|
|
46900
|
+
if (first !== void 0 && run3.length >= 2)
|
|
46901
|
+
out.push({ kind, positions, period: 1, tool: first.tool });
|
|
46902
|
+
run3 = [];
|
|
46903
|
+
positions = [];
|
|
46904
|
+
};
|
|
46905
|
+
slots.forEach((c, i2) => {
|
|
46906
|
+
if (c === null || !joins(c)) {
|
|
46907
|
+
close();
|
|
46908
|
+
return;
|
|
46909
|
+
}
|
|
46910
|
+
const last = run3.at(-1);
|
|
46911
|
+
if (last !== void 0 && !matches2(last, c)) close();
|
|
46912
|
+
run3.push(c);
|
|
46913
|
+
positions.push(i2);
|
|
46914
|
+
});
|
|
46915
|
+
close();
|
|
46916
|
+
return out;
|
|
46917
|
+
}
|
|
46918
|
+
function shortCycles(slots) {
|
|
46919
|
+
const out = [];
|
|
46920
|
+
const segments = [[]];
|
|
46921
|
+
slots.forEach((c, i2) => {
|
|
46922
|
+
if (c === null || !hashed(c)) segments.push([]);
|
|
46923
|
+
else segments.at(-1)?.push({ call: c, at: i2 });
|
|
46924
|
+
});
|
|
46925
|
+
for (const segment of segments) {
|
|
46926
|
+
const same = (k, period) => {
|
|
46927
|
+
const a = segment[k];
|
|
46928
|
+
const b3 = segment[k - period];
|
|
46929
|
+
return a !== void 0 && b3 !== void 0 && sameResult(a.call, b3.call);
|
|
46930
|
+
};
|
|
46931
|
+
for (let period = 2; period <= MAX_PERIOD; period += 1) {
|
|
46932
|
+
let k = period;
|
|
46933
|
+
while (k < segment.length) {
|
|
46934
|
+
if (!same(k, period)) {
|
|
46935
|
+
k += 1;
|
|
46936
|
+
continue;
|
|
46937
|
+
}
|
|
46938
|
+
const start = k - period;
|
|
46939
|
+
let end = k;
|
|
46940
|
+
while (same(end, period)) end += 1;
|
|
46941
|
+
const cycle2 = segment.slice(start, start + period).map((s2) => s2.call);
|
|
46942
|
+
const distinct = cycle2.every(
|
|
46943
|
+
(c, j) => cycle2.slice(j + 1).every((d) => !sameResult(c, d))
|
|
46944
|
+
);
|
|
46945
|
+
const first = cycle2[0];
|
|
46946
|
+
if (first !== void 0 && distinct && end - start >= 2 * period)
|
|
46947
|
+
out.push({
|
|
46948
|
+
kind: "short_cycle",
|
|
46949
|
+
positions: segment.slice(start, end).map((s2) => s2.at),
|
|
46950
|
+
period,
|
|
46951
|
+
tool: first.tool
|
|
46952
|
+
});
|
|
46953
|
+
k = end;
|
|
46954
|
+
}
|
|
46955
|
+
}
|
|
46956
|
+
}
|
|
46957
|
+
return out;
|
|
46958
|
+
}
|
|
46959
|
+
function stagnations(slots) {
|
|
46960
|
+
const out = [];
|
|
46961
|
+
const seen = /* @__PURE__ */ new Map();
|
|
46962
|
+
let run3 = [];
|
|
46963
|
+
let positions = [];
|
|
46964
|
+
const close = () => {
|
|
46965
|
+
const first = run3[0];
|
|
46966
|
+
const inputs = new Set(run3.map((c) => c.inputHash));
|
|
46967
|
+
if (first !== void 0 && run3.length >= 2 && inputs.size >= 2)
|
|
46968
|
+
out.push({ kind: "stagnation", positions, period: 1, tool: first.tool });
|
|
46969
|
+
run3 = [];
|
|
46970
|
+
positions = [];
|
|
46971
|
+
};
|
|
46972
|
+
slots.forEach((c, i2) => {
|
|
46973
|
+
if (c === null || !hashed(c)) {
|
|
46974
|
+
close();
|
|
46975
|
+
return;
|
|
46976
|
+
}
|
|
46977
|
+
const outputs = seen.get(c.tool) ?? /* @__PURE__ */ new Set();
|
|
46978
|
+
const repeated = outputs.has(c.outputHash);
|
|
46979
|
+
outputs.add(c.outputHash);
|
|
46980
|
+
seen.set(c.tool, outputs);
|
|
46981
|
+
if (c.mayWrite || isMcpTool(c.tool)) {
|
|
46982
|
+
close();
|
|
46983
|
+
return;
|
|
46984
|
+
}
|
|
46985
|
+
const first = run3[0];
|
|
46986
|
+
if (first !== void 0 && (first.tool !== c.tool || !repeated)) close();
|
|
46987
|
+
run3.push(c);
|
|
46988
|
+
positions.push(i2);
|
|
46989
|
+
});
|
|
46990
|
+
close();
|
|
46991
|
+
return out;
|
|
46992
|
+
}
|
|
46993
|
+
function findLoops(steps, threshold) {
|
|
46994
|
+
const slots = slotsOf(steps);
|
|
46995
|
+
return [
|
|
46996
|
+
...streaks(slots, "exact_repeat", hashed, sameResult),
|
|
46997
|
+
...streaks(slots, "failing_retry", failed, sameFailure),
|
|
46998
|
+
...shortCycles(slots),
|
|
46999
|
+
...stagnations(slots)
|
|
47000
|
+
].filter((loop) => reaches(loop, threshold[loop.kind])).sort((a, b3) => (a.positions[0] ?? 0) - (b3.positions[0] ?? 0));
|
|
47001
|
+
}
|
|
47002
|
+
var LOOP_NOTICE_REASON_CODE, LOOP_START, MAX_PERIOD, MCP_TOOL_PREFIX, CURSOR_MCP_TOOL_PREFIX;
|
|
47003
|
+
var init_loops = __esm({
|
|
47004
|
+
"../../packages/tacho/src/loops.ts"() {
|
|
47005
|
+
"use strict";
|
|
47006
|
+
LOOP_NOTICE_REASON_CODE = "loop_notice";
|
|
47007
|
+
LOOP_START = {
|
|
47008
|
+
exact_repeat: { calls: 3 },
|
|
47009
|
+
failing_retry: { calls: 3 },
|
|
47010
|
+
short_cycle: { cycles: 3 },
|
|
47011
|
+
stagnation: { calls: 6 }
|
|
47012
|
+
};
|
|
47013
|
+
MAX_PERIOD = 3;
|
|
47014
|
+
MCP_TOOL_PREFIX = "mcp__";
|
|
47015
|
+
CURSOR_MCP_TOOL_PREFIX = "MCP:";
|
|
47016
|
+
}
|
|
47017
|
+
});
|
|
47018
|
+
|
|
46619
47019
|
// ../../packages/tacho/src/collector/steering-manifest.ts
|
|
46620
47020
|
function steeringManifestFrame(manifest, bundle2, delivered) {
|
|
46621
47021
|
const steers = delivered.map((prompt) => ({
|
|
@@ -47152,153 +47552,6 @@ var init_subagent_meta = __esm({
|
|
|
47152
47552
|
}
|
|
47153
47553
|
});
|
|
47154
47554
|
|
|
47155
|
-
// ../../packages/tacho/src/loops.ts
|
|
47156
|
-
function isMcpTool(tool) {
|
|
47157
|
-
return tool.startsWith(MCP_TOOL_PREFIX) || tool.startsWith(CURSOR_MCP_TOOL_PREFIX);
|
|
47158
|
-
}
|
|
47159
|
-
function slotsOf(steps) {
|
|
47160
|
-
return steps.map((step) => "fileChanged" in step ? null : step);
|
|
47161
|
-
}
|
|
47162
|
-
function sameResult(a, b3) {
|
|
47163
|
-
return a.tool === b3.tool && a.inputHash === b3.inputHash && a.outputHash === b3.outputHash;
|
|
47164
|
-
}
|
|
47165
|
-
function sameFailure(a, b3) {
|
|
47166
|
-
return a.tool === b3.tool && a.inputHash === b3.inputHash && a.errorClass === b3.errorClass;
|
|
47167
|
-
}
|
|
47168
|
-
function hashed(c) {
|
|
47169
|
-
return c.inputHash !== "" && c.outputHash !== "";
|
|
47170
|
-
}
|
|
47171
|
-
function failed(c) {
|
|
47172
|
-
return c.inputHash !== "" && c.errorClass !== null && c.errorClass !== "";
|
|
47173
|
-
}
|
|
47174
|
-
function reaches(loop, length) {
|
|
47175
|
-
const calls = loop.positions.length;
|
|
47176
|
-
return "calls" in length ? calls >= length.calls : Math.floor(calls / loop.period) >= length.cycles;
|
|
47177
|
-
}
|
|
47178
|
-
function streaks(slots, kind, joins, matches2) {
|
|
47179
|
-
const out = [];
|
|
47180
|
-
let run3 = [];
|
|
47181
|
-
let positions = [];
|
|
47182
|
-
const close = () => {
|
|
47183
|
-
const first = run3[0];
|
|
47184
|
-
if (first !== void 0 && run3.length >= 2)
|
|
47185
|
-
out.push({ kind, positions, period: 1, tool: first.tool });
|
|
47186
|
-
run3 = [];
|
|
47187
|
-
positions = [];
|
|
47188
|
-
};
|
|
47189
|
-
slots.forEach((c, i2) => {
|
|
47190
|
-
if (c === null || !joins(c)) {
|
|
47191
|
-
close();
|
|
47192
|
-
return;
|
|
47193
|
-
}
|
|
47194
|
-
const last = run3.at(-1);
|
|
47195
|
-
if (last !== void 0 && !matches2(last, c)) close();
|
|
47196
|
-
run3.push(c);
|
|
47197
|
-
positions.push(i2);
|
|
47198
|
-
});
|
|
47199
|
-
close();
|
|
47200
|
-
return out;
|
|
47201
|
-
}
|
|
47202
|
-
function shortCycles(slots) {
|
|
47203
|
-
const out = [];
|
|
47204
|
-
const segments = [[]];
|
|
47205
|
-
slots.forEach((c, i2) => {
|
|
47206
|
-
if (c === null || !hashed(c)) segments.push([]);
|
|
47207
|
-
else segments.at(-1)?.push({ call: c, at: i2 });
|
|
47208
|
-
});
|
|
47209
|
-
for (const segment of segments) {
|
|
47210
|
-
const same = (k, period) => {
|
|
47211
|
-
const a = segment[k];
|
|
47212
|
-
const b3 = segment[k - period];
|
|
47213
|
-
return a !== void 0 && b3 !== void 0 && sameResult(a.call, b3.call);
|
|
47214
|
-
};
|
|
47215
|
-
for (let period = 2; period <= MAX_PERIOD; period += 1) {
|
|
47216
|
-
let k = period;
|
|
47217
|
-
while (k < segment.length) {
|
|
47218
|
-
if (!same(k, period)) {
|
|
47219
|
-
k += 1;
|
|
47220
|
-
continue;
|
|
47221
|
-
}
|
|
47222
|
-
const start = k - period;
|
|
47223
|
-
let end = k;
|
|
47224
|
-
while (same(end, period)) end += 1;
|
|
47225
|
-
const cycle2 = segment.slice(start, start + period).map((s2) => s2.call);
|
|
47226
|
-
const distinct = cycle2.every(
|
|
47227
|
-
(c, j) => cycle2.slice(j + 1).every((d) => !sameResult(c, d))
|
|
47228
|
-
);
|
|
47229
|
-
const first = cycle2[0];
|
|
47230
|
-
if (first !== void 0 && distinct && end - start >= 2 * period)
|
|
47231
|
-
out.push({
|
|
47232
|
-
kind: "short_cycle",
|
|
47233
|
-
positions: segment.slice(start, end).map((s2) => s2.at),
|
|
47234
|
-
period,
|
|
47235
|
-
tool: first.tool
|
|
47236
|
-
});
|
|
47237
|
-
k = end;
|
|
47238
|
-
}
|
|
47239
|
-
}
|
|
47240
|
-
}
|
|
47241
|
-
return out;
|
|
47242
|
-
}
|
|
47243
|
-
function stagnations(slots) {
|
|
47244
|
-
const out = [];
|
|
47245
|
-
const seen = /* @__PURE__ */ new Map();
|
|
47246
|
-
let run3 = [];
|
|
47247
|
-
let positions = [];
|
|
47248
|
-
const close = () => {
|
|
47249
|
-
const first = run3[0];
|
|
47250
|
-
const inputs = new Set(run3.map((c) => c.inputHash));
|
|
47251
|
-
if (first !== void 0 && run3.length >= 2 && inputs.size >= 2)
|
|
47252
|
-
out.push({ kind: "stagnation", positions, period: 1, tool: first.tool });
|
|
47253
|
-
run3 = [];
|
|
47254
|
-
positions = [];
|
|
47255
|
-
};
|
|
47256
|
-
slots.forEach((c, i2) => {
|
|
47257
|
-
if (c === null || !hashed(c)) {
|
|
47258
|
-
close();
|
|
47259
|
-
return;
|
|
47260
|
-
}
|
|
47261
|
-
const outputs = seen.get(c.tool) ?? /* @__PURE__ */ new Set();
|
|
47262
|
-
const repeated = outputs.has(c.outputHash);
|
|
47263
|
-
outputs.add(c.outputHash);
|
|
47264
|
-
seen.set(c.tool, outputs);
|
|
47265
|
-
if (c.mayWrite || isMcpTool(c.tool)) {
|
|
47266
|
-
close();
|
|
47267
|
-
return;
|
|
47268
|
-
}
|
|
47269
|
-
const first = run3[0];
|
|
47270
|
-
if (first !== void 0 && (first.tool !== c.tool || !repeated)) close();
|
|
47271
|
-
run3.push(c);
|
|
47272
|
-
positions.push(i2);
|
|
47273
|
-
});
|
|
47274
|
-
close();
|
|
47275
|
-
return out;
|
|
47276
|
-
}
|
|
47277
|
-
function findLoops(steps, threshold) {
|
|
47278
|
-
const slots = slotsOf(steps);
|
|
47279
|
-
return [
|
|
47280
|
-
...streaks(slots, "exact_repeat", hashed, sameResult),
|
|
47281
|
-
...streaks(slots, "failing_retry", failed, sameFailure),
|
|
47282
|
-
...shortCycles(slots),
|
|
47283
|
-
...stagnations(slots)
|
|
47284
|
-
].filter((loop) => reaches(loop, threshold[loop.kind])).sort((a, b3) => (a.positions[0] ?? 0) - (b3.positions[0] ?? 0));
|
|
47285
|
-
}
|
|
47286
|
-
var LOOP_START, MAX_PERIOD, MCP_TOOL_PREFIX, CURSOR_MCP_TOOL_PREFIX;
|
|
47287
|
-
var init_loops = __esm({
|
|
47288
|
-
"../../packages/tacho/src/loops.ts"() {
|
|
47289
|
-
"use strict";
|
|
47290
|
-
LOOP_START = {
|
|
47291
|
-
exact_repeat: { calls: 3 },
|
|
47292
|
-
failing_retry: { calls: 3 },
|
|
47293
|
-
short_cycle: { cycles: 3 },
|
|
47294
|
-
stagnation: { calls: 6 }
|
|
47295
|
-
};
|
|
47296
|
-
MAX_PERIOD = 3;
|
|
47297
|
-
MCP_TOOL_PREFIX = "mcp__";
|
|
47298
|
-
CURSOR_MCP_TOOL_PREFIX = "MCP:";
|
|
47299
|
-
}
|
|
47300
|
-
});
|
|
47301
|
-
|
|
47302
47555
|
// ../../packages/tacho/src/collector/memory-capture/reflection-ask.ts
|
|
47303
47556
|
function stateOf(record2) {
|
|
47304
47557
|
let state = states.get(record2);
|
|
@@ -47705,7 +47958,7 @@ function loopNoticeBody(notice, boundary) {
|
|
|
47705
47958
|
...notice.callSeq !== void 0 ? { call_seq: notice.callSeq } : {}
|
|
47706
47959
|
};
|
|
47707
47960
|
}
|
|
47708
|
-
var NOTICED_LOOP_KINDS, LOOP_NOTICE_BOUNDARIES,
|
|
47961
|
+
var NOTICED_LOOP_KINDS, LOOP_NOTICE_BOUNDARIES, LOOP_REFUSAL_LEAD, LOOP_WINDOW_CALLS, LOOP_CHAINS_PER_SESSION, NOTICED_PER_CHAIN, TOOL_NAME_MAX_CHARS2, ROOT_CHAIN, states2, loopNoticeBodySchema;
|
|
47709
47962
|
var init_loop_notice = __esm({
|
|
47710
47963
|
"../../packages/tacho/src/collector/loop-notice.ts"() {
|
|
47711
47964
|
"use strict";
|
|
@@ -47721,7 +47974,6 @@ var init_loop_notice = __esm({
|
|
|
47721
47974
|
"PostToolUseFailure",
|
|
47722
47975
|
"PreToolUse"
|
|
47723
47976
|
];
|
|
47724
|
-
LOOP_NOTICE_REASON_CODE = "loop_notice";
|
|
47725
47977
|
LOOP_REFUSAL_LEAD = "This call did not run. ";
|
|
47726
47978
|
LOOP_WINDOW_CALLS = 32;
|
|
47727
47979
|
LOOP_CHAINS_PER_SESSION = 16;
|
|
@@ -47743,134 +47995,6 @@ var init_loop_notice = __esm({
|
|
|
47743
47995
|
}
|
|
47744
47996
|
});
|
|
47745
47997
|
|
|
47746
|
-
// ../../packages/tacho/src/interjection.ts
|
|
47747
|
-
var digest4, timestamp, count5, configVersion, workspaceSlug, interjectionKeySchema, INTERJECTION_RECEIPT_ID_PATTERN, INTERJECTION_QUESTION_MAX, INTERJECTION_PATHS, INTERJECTION_ANSWER_SOURCES, SKILLS_RESOLVED_REASONS, repoUnknownBodySchema, interjectLinkPathSchema, interjectCreatePathSchema, INTERJECT_PROVIDERS, interjectBodySchema, answerBodySchema, repoBoundBodySchema, workspaceCreatedBodySchema, skillsResolvedBodySchema, interjectionAnswerPayloadSchema;
|
|
47748
|
-
var init_interjection = __esm({
|
|
47749
|
-
"../../packages/tacho/src/interjection.ts"() {
|
|
47750
|
-
"use strict";
|
|
47751
|
-
init_zod();
|
|
47752
|
-
init_digest();
|
|
47753
|
-
init_timestamp();
|
|
47754
|
-
digest4 = external_exports.string().regex(SHA256_DIGEST_PATTERN);
|
|
47755
|
-
timestamp = external_exports.string().refine(isProtocolTimestamp, "protocol timestamp");
|
|
47756
|
-
count5 = external_exports.number().int().nonnegative();
|
|
47757
|
-
configVersion = external_exports.string().min(1).max(64).nullable();
|
|
47758
|
-
workspaceSlug = external_exports.string().min(1).max(64);
|
|
47759
|
-
interjectionKeySchema = external_exports.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/, "a ULID");
|
|
47760
|
-
INTERJECTION_RECEIPT_ID_PATTERN = /^rcp_[0-9a-z]+$/;
|
|
47761
|
-
INTERJECTION_QUESTION_MAX = 2e3;
|
|
47762
|
-
INTERJECTION_PATHS = ["link", "create", "deny"];
|
|
47763
|
-
INTERJECTION_ANSWER_SOURCES = ["person", "timeout"];
|
|
47764
|
-
SKILLS_RESOLVED_REASONS = [
|
|
47765
|
-
"skills_off",
|
|
47766
|
-
"denied",
|
|
47767
|
-
"resolved"
|
|
47768
|
-
];
|
|
47769
|
-
repoUnknownBodySchema = external_exports.object({
|
|
47770
|
-
/** sha256 of `canonicalRemote(origin)`; the remote itself never leaves the host. */
|
|
47771
|
-
remote_digest: digest4,
|
|
47772
|
-
/** sha256 of `foldedRemote(canonicalRemote(origin))`; absent when the host does not fold. */
|
|
47773
|
-
remote_digest_folded: digest4.optional(),
|
|
47774
|
-
head_sha: external_exports.string().max(512).optional(),
|
|
47775
|
-
/** The bundle asked only because the workspace has skills on. */
|
|
47776
|
-
skills_enabled: external_exports.literal(true),
|
|
47777
|
-
/** The bundle's `unbound_repo.policy`. */
|
|
47778
|
-
unbound_repo: external_exports.literal("ask"),
|
|
47779
|
-
/** The skills configuration the bundle carried; null when none was named. */
|
|
47780
|
-
config_version: configVersion
|
|
47781
|
-
}).strict();
|
|
47782
|
-
interjectLinkPathSchema = external_exports.object({
|
|
47783
|
-
path: external_exports.literal("link"),
|
|
47784
|
-
workspace_slug: workspaceSlug,
|
|
47785
|
-
config_version: configVersion,
|
|
47786
|
-
/** Skills the workspace's configuration pins; null when not counted. */
|
|
47787
|
-
skills_pinned: count5.nullable(),
|
|
47788
|
-
/** Repositories the workspace already links; null when not counted. */
|
|
47789
|
-
linked_repositories: count5.nullable()
|
|
47790
|
-
}).strict();
|
|
47791
|
-
interjectCreatePathSchema = external_exports.object({
|
|
47792
|
-
path: external_exports.literal("create"),
|
|
47793
|
-
/** From the repository's name; null when the host could not read one. */
|
|
47794
|
-
proposed_name: external_exports.string().min(1).max(120).nullable(),
|
|
47795
|
-
proposed_slug: workspaceSlug.nullable(),
|
|
47796
|
-
skills_enabled: external_exports.literal(false)
|
|
47797
|
-
}).strict();
|
|
47798
|
-
INTERJECT_PROVIDERS = ["github", "gitlab"];
|
|
47799
|
-
interjectBodySchema = external_exports.object({
|
|
47800
|
-
interjection_key: interjectionKeySchema,
|
|
47801
|
-
reason: external_exports.literal("repo_unknown"),
|
|
47802
|
-
question: external_exports.string().min(1).max(INTERJECTION_QUESTION_MAX),
|
|
47803
|
-
remote_digest: digest4,
|
|
47804
|
-
remote_digest_folded: digest4.optional(),
|
|
47805
|
-
/** How long the host waits, from the bundle's `unbound_repo.timeout_ms`. */
|
|
47806
|
-
timeout_ms: external_exports.number().int().positive(),
|
|
47807
|
-
/** The host's clock plus `timeout_ms`. The control plane keeps its own deadline. */
|
|
47808
|
-
expires_at: timestamp,
|
|
47809
|
-
/** What the timeout answers. */
|
|
47810
|
-
on_timeout: external_exports.literal("deny"),
|
|
47811
|
-
/** The two paths a person can take, link first. Deny needs no path. */
|
|
47812
|
-
paths: external_exports.tuple([interjectLinkPathSchema, interjectCreatePathSchema]),
|
|
47813
|
-
/**
|
|
47814
|
-
* The forge the remote's host names (#4439): `github` for github.com and
|
|
47815
|
-
* `gitlab` for gitlab.com. Absent for any other host, and from a host
|
|
47816
|
-
* built before the field, which the control plane reads as GitHub. The
|
|
47817
|
-
* host string itself stays on the machine. A GitLab project binds through
|
|
47818
|
-
* its own project access token, so the control plane offers no link for
|
|
47819
|
-
* a `gitlab` question.
|
|
47820
|
-
*/
|
|
47821
|
-
provider: external_exports.enum(INTERJECT_PROVIDERS).optional()
|
|
47822
|
-
}).strict();
|
|
47823
|
-
answerBodySchema = external_exports.object({
|
|
47824
|
-
interjection_key: interjectionKeySchema,
|
|
47825
|
-
/** The control plane's row (`inj_…`); absent on a timeout the host answered alone. */
|
|
47826
|
-
interjection_id: external_exports.string().regex(/^inj_[0-9a-z]+$/).optional(),
|
|
47827
|
-
path: external_exports.enum(INTERJECTION_PATHS),
|
|
47828
|
-
source: external_exports.enum(INTERJECTION_ANSWER_SOURCES),
|
|
47829
|
-
/** The receipt the control plane recorded; absent on a host-side timeout. */
|
|
47830
|
-
receipt_id: external_exports.string().regex(INTERJECTION_RECEIPT_ID_PATTERN).optional(),
|
|
47831
|
-
/** The person who answered (`usr_…`); absent on a timeout. */
|
|
47832
|
-
answered_by: external_exports.string().regex(/^usr_[0-9a-z]+$/).optional(),
|
|
47833
|
-
/** The `message` command that carried the answer (`tcm_…`). */
|
|
47834
|
-
command_id: external_exports.string().regex(/^tcm_[0-9a-z]+$/).optional()
|
|
47835
|
-
}).strict();
|
|
47836
|
-
repoBoundBodySchema = external_exports.object({
|
|
47837
|
-
interjection_key: interjectionKeySchema,
|
|
47838
|
-
binding_id: external_exports.string().min(1).max(64),
|
|
47839
|
-
workspace_slug: workspaceSlug,
|
|
47840
|
-
role: external_exports.enum(["linked", "main"])
|
|
47841
|
-
}).strict();
|
|
47842
|
-
workspaceCreatedBodySchema = external_exports.object({
|
|
47843
|
-
interjection_key: interjectionKeySchema,
|
|
47844
|
-
workspace_id: external_exports.string().min(1).max(64),
|
|
47845
|
-
workspace_slug: workspaceSlug,
|
|
47846
|
-
skills_enabled: external_exports.literal(false)
|
|
47847
|
-
}).strict();
|
|
47848
|
-
skillsResolvedBodySchema = external_exports.object({
|
|
47849
|
-
/** The interjection that settled it; absent when no question was asked. */
|
|
47850
|
-
interjection_key: interjectionKeySchema.optional(),
|
|
47851
|
-
config_version: configVersion,
|
|
47852
|
-
/** Skills the session may load. */
|
|
47853
|
-
in_scope: count5,
|
|
47854
|
-
/** Skills the configuration holds back; null until the catalog read counts them (#3098). */
|
|
47855
|
-
withheld: count5.nullable(),
|
|
47856
|
-
reason: external_exports.enum(SKILLS_RESOLVED_REASONS)
|
|
47857
|
-
}).strict();
|
|
47858
|
-
interjectionAnswerPayloadSchema = external_exports.object({
|
|
47859
|
-
key: interjectionKeySchema,
|
|
47860
|
-
path: external_exports.enum(INTERJECTION_PATHS),
|
|
47861
|
-
source: external_exports.enum(INTERJECTION_ANSWER_SOURCES),
|
|
47862
|
-
receipt_id: external_exports.string().regex(INTERJECTION_RECEIPT_ID_PATTERN),
|
|
47863
|
-
/** The person who answered (`usr_…`); null on a timeout. */
|
|
47864
|
-
answered_by: external_exports.string().regex(/^usr_[0-9a-z]+$/).nullable(),
|
|
47865
|
-
/** Set on a link or create answer. */
|
|
47866
|
-
binding_id: external_exports.string().min(1).max(64).optional(),
|
|
47867
|
-
/** Set on a create answer. */
|
|
47868
|
-
workspace_id: external_exports.string().min(1).max(64).optional(),
|
|
47869
|
-
workspace_slug: workspaceSlug.optional()
|
|
47870
|
-
}).strict();
|
|
47871
|
-
}
|
|
47872
|
-
});
|
|
47873
|
-
|
|
47874
47998
|
// ../../packages/tacho/src/collector/interjection.ts
|
|
47875
47999
|
function showsRefusedPrompt(harness) {
|
|
47876
48000
|
return harness !== "stella";
|
|
@@ -48075,7 +48199,7 @@ function settle2(record2, held, answer, payload, fields) {
|
|
|
48075
48199
|
record2.control.interjection = void 0;
|
|
48076
48200
|
return events;
|
|
48077
48201
|
}
|
|
48078
|
-
var SLUG_PATTERN, SLUG_MIN, SLUG_MAX, NAME_MAX2,
|
|
48202
|
+
var SLUG_PATTERN, SLUG_MIN, SLUG_MAX, NAME_MAX2, INTERJECTION_TIMED_OUT_TEXT, expiredByHook, putBack;
|
|
48079
48203
|
var init_interjection2 = __esm({
|
|
48080
48204
|
"../../packages/tacho/src/collector/interjection.ts"() {
|
|
48081
48205
|
"use strict";
|
|
@@ -48086,7 +48210,6 @@ var init_interjection2 = __esm({
|
|
|
48086
48210
|
SLUG_MIN = 2;
|
|
48087
48211
|
SLUG_MAX = 40;
|
|
48088
48212
|
NAME_MAX2 = 120;
|
|
48089
|
-
INTERJECTION_OPEN = "interjection_open";
|
|
48090
48213
|
INTERJECTION_TIMED_OUT_TEXT = "Oxagen asked a person whether to bind this repository to a workspace, and nobody answered in time. This session goes on without skills.";
|
|
48091
48214
|
expiredByHook = /* @__PURE__ */ new WeakMap();
|
|
48092
48215
|
putBack = /* @__PURE__ */ new WeakSet();
|
|
@@ -49527,6 +49650,8 @@ var init_hook_handler = __esm({
|
|
|
49527
49650
|
init_payload_members();
|
|
49528
49651
|
init_work_order_context();
|
|
49529
49652
|
init_tools();
|
|
49653
|
+
init_interjection();
|
|
49654
|
+
init_loops();
|
|
49530
49655
|
init_steering_manifest();
|
|
49531
49656
|
init_frame_body();
|
|
49532
49657
|
init_harness_limits();
|
|
@@ -60509,10 +60634,10 @@ function toolContext(body2) {
|
|
|
60509
60634
|
continue;
|
|
60510
60635
|
if (path2.startsWith("/") || /^[A-Za-z]:/.test(path2) || path2.includes("\\"))
|
|
60511
60636
|
continue;
|
|
60512
|
-
const
|
|
60513
|
-
if (
|
|
60514
|
-
files2.delete(
|
|
60515
|
-
files2.add(
|
|
60637
|
+
const relative11 = path2.replace(/^\.\//, "");
|
|
60638
|
+
if (relative11.length === 0 || relative11.split("/").includes("..")) continue;
|
|
60639
|
+
files2.delete(relative11);
|
|
60640
|
+
files2.add(relative11);
|
|
60516
60641
|
if (files2.size > 64) files2.delete(files2.values().next().value ?? "");
|
|
60517
60642
|
}
|
|
60518
60643
|
if (name2 === "Skill" && typeof args["skill"] === "string" && args["skill"].length <= 256)
|
|
@@ -66608,6 +66733,12 @@ async function launchSandboxFromEnv(deps) {
|
|
|
66608
66733
|
repository: launch.repositoryFullName,
|
|
66609
66734
|
...launch.gitlab !== void 0 ? { gitlab: launch.gitlab } : {},
|
|
66610
66735
|
branch: launch.branch,
|
|
66736
|
+
...launch.repositories !== void 0 ? {
|
|
66737
|
+
repositories: launch.repositories.map((included) => ({
|
|
66738
|
+
repository: included.repositoryFullName,
|
|
66739
|
+
...included.gitlab !== void 0 ? { gitlab: included.gitlab } : {}
|
|
66740
|
+
}))
|
|
66741
|
+
} : {},
|
|
66611
66742
|
workOrderId: launch.workOrderId,
|
|
66612
66743
|
environment,
|
|
66613
66744
|
resume: launch.resume,
|
|
@@ -67052,16 +67183,16 @@ function gitHeadIn(cwd) {
|
|
|
67052
67183
|
}
|
|
67053
67184
|
function claimRefusalMessage(error2, criterionId, head3) {
|
|
67054
67185
|
const said = controlErrorMessage(error2);
|
|
67055
|
-
const
|
|
67186
|
+
const short4 = head3.slice(0, 7);
|
|
67056
67187
|
if (controlErrorReason(error2) === "stale_head")
|
|
67057
|
-
return `Oxagen refused the claim on ${criterionId} at commit ${
|
|
67188
|
+
return `Oxagen refused the claim on ${criterionId} at commit ${short4}, so nothing was recorded. ${said} Push commit ${short4} to the pull request first, then claim again.`;
|
|
67058
67189
|
if (error2.status === 400)
|
|
67059
67190
|
return `Oxagen refused the claim on ${criterionId}, so nothing was recorded. ${said} Name an item of the Done Checklist in your first prompt, such as c1.`;
|
|
67060
67191
|
return `Oxagen refused the claim on ${criterionId}, so nothing was recorded. ${said}`;
|
|
67061
67192
|
}
|
|
67062
67193
|
function claimAnswerMessage(answer, criterionId, workOrderId, head3) {
|
|
67063
|
-
const
|
|
67064
|
-
return answer.repeat ? `Oxagen already had this claim on ${criterionId} at commit ${
|
|
67194
|
+
const short4 = head3.slice(0, 7);
|
|
67195
|
+
return answer.repeat ? `Oxagen already had this claim on ${criterionId} at commit ${short4}, so nothing new was recorded. The first text stands.` : `Claimed ${criterionId} at commit ${short4} for ${workOrderId}. A person still checks each item and decides.`;
|
|
67065
67196
|
}
|
|
67066
67197
|
async function workClaim(criterionId, options, deps) {
|
|
67067
67198
|
if (!WORK_CRITERION_ID_PATTERN.test(criterionId)) {
|
|
@@ -71180,7 +71311,7 @@ import {
|
|
|
71180
71311
|
writeFileSync as writeFileSync7
|
|
71181
71312
|
} from "node:fs";
|
|
71182
71313
|
import { dirname as dirname32, join as join57, resolve as resolve22 } from "node:path";
|
|
71183
|
-
function bundlePath(root,
|
|
71314
|
+
function bundlePath(root, relative11, create2 = false) {
|
|
71184
71315
|
const absolute = resolve22(root);
|
|
71185
71316
|
if (create2) mkdirSync10(absolute, { recursive: true, mode: 448 });
|
|
71186
71317
|
if (lstatSync11(absolute).isSymbolicLink() || !lstatSync11(absolute).isDirectory()) {
|
|
@@ -71188,14 +71319,14 @@ function bundlePath(root, relative12, create2 = false) {
|
|
|
71188
71319
|
}
|
|
71189
71320
|
const base2 = realpathSync8(absolute);
|
|
71190
71321
|
let current = base2;
|
|
71191
|
-
const parts =
|
|
71322
|
+
const parts = relative11.split("/");
|
|
71192
71323
|
for (let i2 = 0; i2 < parts.length; i2++) {
|
|
71193
71324
|
current = join57(current, parts[i2]);
|
|
71194
71325
|
try {
|
|
71195
71326
|
const stat7 = lstatSync11(current);
|
|
71196
71327
|
if (stat7.isSymbolicLink() || i2 < parts.length - 1 && !stat7.isDirectory()) {
|
|
71197
71328
|
arpFail(
|
|
71198
|
-
`The bundle path ${
|
|
71329
|
+
`The bundle path ${relative11} passes through a symlink or a file where a directory belongs.`
|
|
71199
71330
|
);
|
|
71200
71331
|
}
|
|
71201
71332
|
} catch (error2) {
|
|
@@ -71205,36 +71336,36 @@ function bundlePath(root, relative12, create2 = false) {
|
|
|
71205
71336
|
}
|
|
71206
71337
|
}
|
|
71207
71338
|
if (realpathSync8(dirname32(current)) !== dirname32(current)) {
|
|
71208
|
-
arpFail(`The bundle directory changed while ${
|
|
71339
|
+
arpFail(`The bundle directory changed while ${relative11} was read.`);
|
|
71209
71340
|
}
|
|
71210
71341
|
return current;
|
|
71211
71342
|
}
|
|
71212
|
-
function readBounded(root,
|
|
71213
|
-
const path2 = bundlePath(root,
|
|
71343
|
+
function readBounded(root, relative11, limit = ARP_MAX_BLOB_BYTES) {
|
|
71344
|
+
const path2 = bundlePath(root, relative11);
|
|
71214
71345
|
const fd2 = openSync9(path2, constants7.O_RDONLY | constants7.O_NOFOLLOW);
|
|
71215
71346
|
try {
|
|
71216
71347
|
const stat7 = fstatSync2(fd2);
|
|
71217
71348
|
if (!stat7.isFile() || stat7.size > limit)
|
|
71218
71349
|
arpFail(
|
|
71219
|
-
`The bundle file ${
|
|
71350
|
+
`The bundle file ${relative11} is not a regular file of at most ${limit} bytes.`
|
|
71220
71351
|
);
|
|
71221
71352
|
const bytes = Buffer.alloc(stat7.size);
|
|
71222
71353
|
let offset = 0;
|
|
71223
71354
|
while (offset < bytes.length) {
|
|
71224
71355
|
const count13 = readSync5(fd2, bytes, offset, bytes.length - offset, offset);
|
|
71225
71356
|
if (!count13)
|
|
71226
|
-
arpFail(`The bundle file ${
|
|
71357
|
+
arpFail(`The bundle file ${relative11} changed while it was read.`);
|
|
71227
71358
|
offset += count13;
|
|
71228
71359
|
}
|
|
71229
71360
|
if (readSync5(fd2, Buffer.alloc(1), 0, 1, offset) !== 0)
|
|
71230
|
-
arpFail(`The bundle file ${
|
|
71361
|
+
arpFail(`The bundle file ${relative11} changed while it was read.`);
|
|
71231
71362
|
return bytes;
|
|
71232
71363
|
} finally {
|
|
71233
71364
|
closeSync9(fd2);
|
|
71234
71365
|
}
|
|
71235
71366
|
}
|
|
71236
|
-
function writeNew2(root,
|
|
71237
|
-
const path2 = bundlePath(root,
|
|
71367
|
+
function writeNew2(root, relative11, bytes) {
|
|
71368
|
+
const path2 = bundlePath(root, relative11, true);
|
|
71238
71369
|
const fd2 = openSync9(
|
|
71239
71370
|
path2,
|
|
71240
71371
|
constants7.O_WRONLY | constants7.O_CREAT | constants7.O_EXCL | constants7.O_NOFOLLOW,
|
|
@@ -73211,7 +73342,7 @@ function buildTachoProgram(options = {}) {
|
|
|
73211
73342
|
"The launcher inside a sandbox the control plane started (not meant to be run by hand)"
|
|
73212
73343
|
);
|
|
73213
73344
|
sandbox.command("launch").description(
|
|
73214
|
-
|
|
73345
|
+
`Start the run this sandbox was created for: enroll the daemon with the run token, clone each repository at ${SANDBOX_CHECKOUT_HELP_MARKER}, register the launch, start the harness`
|
|
73215
73346
|
).requiredOption(
|
|
73216
73347
|
"--from-env",
|
|
73217
73348
|
"Read the launch and the run token from OXAGEN_SANDBOX_LAUNCH and OXAGEN_SANDBOX_RUN_TOKEN"
|
|
@@ -73272,6 +73403,7 @@ var init_main = __esm({
|
|
|
73272
73403
|
init_enroll();
|
|
73273
73404
|
init_export();
|
|
73274
73405
|
init_legacy_name();
|
|
73406
|
+
init_profile();
|
|
73275
73407
|
init_mcp_stdio();
|
|
73276
73408
|
init_reassign();
|
|
73277
73409
|
init_run();
|
|
@@ -73315,7 +73447,7 @@ var init_package = __esm({
|
|
|
73315
73447
|
"package.json"() {
|
|
73316
73448
|
package_default = {
|
|
73317
73449
|
name: "@oxagen/cli",
|
|
73318
|
-
version: "3.0.1-
|
|
73450
|
+
version: "3.0.1-803",
|
|
73319
73451
|
description: "Oxagen governance CLI: spend, source tracking, grounding, credentials, and audit (agentic coding lives in the stella CLI)",
|
|
73320
73452
|
type: "module",
|
|
73321
73453
|
main: "./dist/index.js",
|
|
@@ -82102,10 +82234,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
82102
82234
|
let offset = bm.offset;
|
|
82103
82235
|
let commentEnd = null;
|
|
82104
82236
|
for (const collItem of bm.items) {
|
|
82105
|
-
const { start, key, sep:
|
|
82237
|
+
const { start, key, sep: sep14, value } = collItem;
|
|
82106
82238
|
const keyProps = resolveProps.resolveProps(start, {
|
|
82107
82239
|
indicator: "explicit-key-ind",
|
|
82108
|
-
next: key ??
|
|
82240
|
+
next: key ?? sep14?.[0],
|
|
82109
82241
|
offset,
|
|
82110
82242
|
onError,
|
|
82111
82243
|
parentIndent: bm.indent,
|
|
@@ -82119,7 +82251,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
82119
82251
|
else if ("indent" in key && key.indent !== bm.indent)
|
|
82120
82252
|
onError(offset, "BAD_INDENT", startColMsg);
|
|
82121
82253
|
}
|
|
82122
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
82254
|
+
if (!keyProps.anchor && !keyProps.tag && !sep14) {
|
|
82123
82255
|
commentEnd = keyProps.end;
|
|
82124
82256
|
if (keyProps.comment) {
|
|
82125
82257
|
if (map.comment)
|
|
@@ -82143,7 +82275,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
82143
82275
|
ctx2.atKey = false;
|
|
82144
82276
|
if (utilMapIncludes.mapIncludes(ctx2, map.items, keyNode))
|
|
82145
82277
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
82146
|
-
const valueProps = resolveProps.resolveProps(
|
|
82278
|
+
const valueProps = resolveProps.resolveProps(sep14 ?? [], {
|
|
82147
82279
|
indicator: "map-value-ind",
|
|
82148
82280
|
next: value,
|
|
82149
82281
|
offset: keyNode.range[2],
|
|
@@ -82159,7 +82291,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
82159
82291
|
if (ctx2.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
82160
82292
|
onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
82161
82293
|
}
|
|
82162
|
-
const valueNode = value ? composeNode(ctx2, value, valueProps, onError) : composeEmptyNode(ctx2, offset,
|
|
82294
|
+
const valueNode = value ? composeNode(ctx2, value, valueProps, onError) : composeEmptyNode(ctx2, offset, sep14, null, valueProps, onError);
|
|
82163
82295
|
if (ctx2.schema.compat)
|
|
82164
82296
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
82165
82297
|
offset = valueNode.range[2];
|
|
@@ -82250,7 +82382,7 @@ var require_resolve_end = __commonJS({
|
|
|
82250
82382
|
let comment = "";
|
|
82251
82383
|
if (end) {
|
|
82252
82384
|
let hasSpace = false;
|
|
82253
|
-
let
|
|
82385
|
+
let sep14 = "";
|
|
82254
82386
|
for (const token of end) {
|
|
82255
82387
|
const { source, type } = token;
|
|
82256
82388
|
switch (type) {
|
|
@@ -82264,13 +82396,13 @@ var require_resolve_end = __commonJS({
|
|
|
82264
82396
|
if (!comment)
|
|
82265
82397
|
comment = cb;
|
|
82266
82398
|
else
|
|
82267
|
-
comment +=
|
|
82268
|
-
|
|
82399
|
+
comment += sep14 + cb;
|
|
82400
|
+
sep14 = "";
|
|
82269
82401
|
break;
|
|
82270
82402
|
}
|
|
82271
82403
|
case "newline":
|
|
82272
82404
|
if (comment)
|
|
82273
|
-
|
|
82405
|
+
sep14 += source;
|
|
82274
82406
|
hasSpace = true;
|
|
82275
82407
|
break;
|
|
82276
82408
|
default:
|
|
@@ -82313,18 +82445,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
82313
82445
|
let offset = fc.offset + fc.start.source.length;
|
|
82314
82446
|
for (let i2 = 0; i2 < fc.items.length; ++i2) {
|
|
82315
82447
|
const collItem = fc.items[i2];
|
|
82316
|
-
const { start, key, sep:
|
|
82448
|
+
const { start, key, sep: sep14, value } = collItem;
|
|
82317
82449
|
const props = resolveProps.resolveProps(start, {
|
|
82318
82450
|
flow: fcName,
|
|
82319
82451
|
indicator: "explicit-key-ind",
|
|
82320
|
-
next: key ??
|
|
82452
|
+
next: key ?? sep14?.[0],
|
|
82321
82453
|
offset,
|
|
82322
82454
|
onError,
|
|
82323
82455
|
parentIndent: fc.indent,
|
|
82324
82456
|
startOnNewline: false
|
|
82325
82457
|
});
|
|
82326
82458
|
if (!props.found) {
|
|
82327
|
-
if (!props.anchor && !props.tag && !
|
|
82459
|
+
if (!props.anchor && !props.tag && !sep14 && !value) {
|
|
82328
82460
|
if (i2 === 0 && props.comma)
|
|
82329
82461
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
82330
82462
|
else if (i2 < fc.items.length - 1)
|
|
@@ -82378,8 +82510,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
82378
82510
|
}
|
|
82379
82511
|
}
|
|
82380
82512
|
}
|
|
82381
|
-
if (!isMap3 && !
|
|
82382
|
-
const valueNode = value ? composeNode(ctx2, value, props, onError) : composeEmptyNode(ctx2, props.end,
|
|
82513
|
+
if (!isMap3 && !sep14 && !props.found) {
|
|
82514
|
+
const valueNode = value ? composeNode(ctx2, value, props, onError) : composeEmptyNode(ctx2, props.end, sep14, null, props, onError);
|
|
82383
82515
|
coll.items.push(valueNode);
|
|
82384
82516
|
offset = valueNode.range[2];
|
|
82385
82517
|
if (isBlock(value))
|
|
@@ -82391,7 +82523,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
82391
82523
|
if (isBlock(key))
|
|
82392
82524
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
82393
82525
|
ctx2.atKey = false;
|
|
82394
|
-
const valueProps = resolveProps.resolveProps(
|
|
82526
|
+
const valueProps = resolveProps.resolveProps(sep14 ?? [], {
|
|
82395
82527
|
flow: fcName,
|
|
82396
82528
|
indicator: "map-value-ind",
|
|
82397
82529
|
next: value,
|
|
@@ -82402,8 +82534,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
82402
82534
|
});
|
|
82403
82535
|
if (valueProps.found) {
|
|
82404
82536
|
if (!isMap3 && !props.found && ctx2.options.strict) {
|
|
82405
|
-
if (
|
|
82406
|
-
for (const st of
|
|
82537
|
+
if (sep14)
|
|
82538
|
+
for (const st of sep14) {
|
|
82407
82539
|
if (st === valueProps.found)
|
|
82408
82540
|
break;
|
|
82409
82541
|
if (st.type === "newline") {
|
|
@@ -82420,7 +82552,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
82420
82552
|
else
|
|
82421
82553
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
82422
82554
|
}
|
|
82423
|
-
const valueNode = value ? composeNode(ctx2, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx2, valueProps.end,
|
|
82555
|
+
const valueNode = value ? composeNode(ctx2, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx2, valueProps.end, sep14, null, valueProps, onError) : null;
|
|
82424
82556
|
if (valueNode) {
|
|
82425
82557
|
if (isBlock(value))
|
|
82426
82558
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -82600,7 +82732,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
82600
82732
|
chompStart = i2 + 1;
|
|
82601
82733
|
}
|
|
82602
82734
|
let value = "";
|
|
82603
|
-
let
|
|
82735
|
+
let sep14 = "";
|
|
82604
82736
|
let prevMoreIndented = false;
|
|
82605
82737
|
for (let i2 = 0; i2 < contentStart; ++i2)
|
|
82606
82738
|
value += lines[i2][0].slice(trimIndent) + "\n";
|
|
@@ -82617,24 +82749,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
82617
82749
|
indent = "";
|
|
82618
82750
|
}
|
|
82619
82751
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
82620
|
-
value +=
|
|
82621
|
-
|
|
82752
|
+
value += sep14 + indent.slice(trimIndent) + content;
|
|
82753
|
+
sep14 = "\n";
|
|
82622
82754
|
} else if (indent.length > trimIndent || content[0] === " ") {
|
|
82623
|
-
if (
|
|
82624
|
-
|
|
82625
|
-
else if (!prevMoreIndented &&
|
|
82626
|
-
|
|
82627
|
-
value +=
|
|
82628
|
-
|
|
82755
|
+
if (sep14 === " ")
|
|
82756
|
+
sep14 = "\n";
|
|
82757
|
+
else if (!prevMoreIndented && sep14 === "\n")
|
|
82758
|
+
sep14 = "\n\n";
|
|
82759
|
+
value += sep14 + indent.slice(trimIndent) + content;
|
|
82760
|
+
sep14 = "\n";
|
|
82629
82761
|
prevMoreIndented = true;
|
|
82630
82762
|
} else if (content === "") {
|
|
82631
|
-
if (
|
|
82763
|
+
if (sep14 === "\n")
|
|
82632
82764
|
value += "\n";
|
|
82633
82765
|
else
|
|
82634
|
-
|
|
82766
|
+
sep14 = "\n";
|
|
82635
82767
|
} else {
|
|
82636
|
-
value +=
|
|
82637
|
-
|
|
82768
|
+
value += sep14 + content;
|
|
82769
|
+
sep14 = " ";
|
|
82638
82770
|
prevMoreIndented = false;
|
|
82639
82771
|
}
|
|
82640
82772
|
}
|
|
@@ -82817,25 +82949,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
82817
82949
|
trimBoth = /^[ \t]+|[ \t]+$/g;
|
|
82818
82950
|
}
|
|
82819
82951
|
let res = match[1].replace(trimEnd, "");
|
|
82820
|
-
let
|
|
82952
|
+
let sep14 = " ";
|
|
82821
82953
|
let pos = line.lastIndex;
|
|
82822
82954
|
while (match = line.exec(source)) {
|
|
82823
82955
|
const lm = match[1].replace(trimBoth, "");
|
|
82824
82956
|
if (lm === "") {
|
|
82825
|
-
if (
|
|
82826
|
-
res +=
|
|
82957
|
+
if (sep14 === "\n")
|
|
82958
|
+
res += sep14;
|
|
82827
82959
|
else
|
|
82828
|
-
|
|
82960
|
+
sep14 = "\n";
|
|
82829
82961
|
} else {
|
|
82830
|
-
res +=
|
|
82831
|
-
|
|
82962
|
+
res += sep14 + lm;
|
|
82963
|
+
sep14 = " ";
|
|
82832
82964
|
}
|
|
82833
82965
|
pos = line.lastIndex;
|
|
82834
82966
|
}
|
|
82835
82967
|
const last = /[ \t]*(.*)/sy;
|
|
82836
82968
|
last.lastIndex = pos;
|
|
82837
82969
|
match = last.exec(source);
|
|
82838
|
-
return res +
|
|
82970
|
+
return res + sep14 + (match?.[1] ?? "");
|
|
82839
82971
|
}
|
|
82840
82972
|
function doubleQuotedValue(source, onError) {
|
|
82841
82973
|
let res = "";
|
|
@@ -83645,14 +83777,14 @@ var require_cst_stringify = __commonJS({
|
|
|
83645
83777
|
}
|
|
83646
83778
|
}
|
|
83647
83779
|
}
|
|
83648
|
-
function stringifyItem({ start, key, sep:
|
|
83780
|
+
function stringifyItem({ start, key, sep: sep14, value }) {
|
|
83649
83781
|
let res = "";
|
|
83650
83782
|
for (const st of start)
|
|
83651
83783
|
res += st.source;
|
|
83652
83784
|
if (key)
|
|
83653
83785
|
res += stringifyToken(key);
|
|
83654
|
-
if (
|
|
83655
|
-
for (const st of
|
|
83786
|
+
if (sep14)
|
|
83787
|
+
for (const st of sep14)
|
|
83656
83788
|
res += st.source;
|
|
83657
83789
|
if (value)
|
|
83658
83790
|
res += stringifyToken(value);
|
|
@@ -84819,18 +84951,18 @@ var require_parser = __commonJS({
|
|
|
84819
84951
|
if (this.type === "map-value-ind") {
|
|
84820
84952
|
const prev = getPrevProps(this.peek(2));
|
|
84821
84953
|
const start = getFirstKeyStartProps(prev);
|
|
84822
|
-
let
|
|
84954
|
+
let sep14;
|
|
84823
84955
|
if (scalar2.end) {
|
|
84824
|
-
|
|
84825
|
-
|
|
84956
|
+
sep14 = scalar2.end;
|
|
84957
|
+
sep14.push(this.sourceToken);
|
|
84826
84958
|
delete scalar2.end;
|
|
84827
84959
|
} else
|
|
84828
|
-
|
|
84960
|
+
sep14 = [this.sourceToken];
|
|
84829
84961
|
const map = {
|
|
84830
84962
|
type: "block-map",
|
|
84831
84963
|
offset: scalar2.offset,
|
|
84832
84964
|
indent: scalar2.indent,
|
|
84833
|
-
items: [{ start, key: scalar2, sep:
|
|
84965
|
+
items: [{ start, key: scalar2, sep: sep14 }]
|
|
84834
84966
|
};
|
|
84835
84967
|
this.onKeyLine = true;
|
|
84836
84968
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -84983,15 +85115,15 @@ var require_parser = __commonJS({
|
|
|
84983
85115
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
84984
85116
|
const start2 = getFirstKeyStartProps(it.start);
|
|
84985
85117
|
const key = it.key;
|
|
84986
|
-
const
|
|
84987
|
-
|
|
85118
|
+
const sep14 = it.sep;
|
|
85119
|
+
sep14.push(this.sourceToken);
|
|
84988
85120
|
delete it.key;
|
|
84989
85121
|
delete it.sep;
|
|
84990
85122
|
this.stack.push({
|
|
84991
85123
|
type: "block-map",
|
|
84992
85124
|
offset: this.offset,
|
|
84993
85125
|
indent: this.indent,
|
|
84994
|
-
items: [{ start: start2, key, sep:
|
|
85126
|
+
items: [{ start: start2, key, sep: sep14 }]
|
|
84995
85127
|
});
|
|
84996
85128
|
} else if (start.length > 0) {
|
|
84997
85129
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -85185,13 +85317,13 @@ var require_parser = __commonJS({
|
|
|
85185
85317
|
const prev = getPrevProps(parent);
|
|
85186
85318
|
const start = getFirstKeyStartProps(prev);
|
|
85187
85319
|
fixFlowSeqItems(fc);
|
|
85188
|
-
const
|
|
85189
|
-
|
|
85320
|
+
const sep14 = fc.end.splice(1, fc.end.length);
|
|
85321
|
+
sep14.push(this.sourceToken);
|
|
85190
85322
|
const map = {
|
|
85191
85323
|
type: "block-map",
|
|
85192
85324
|
offset: fc.offset,
|
|
85193
85325
|
indent: fc.indent,
|
|
85194
|
-
items: [{ start, key: fc, sep:
|
|
85326
|
+
items: [{ start, key: fc, sep: sep14 }]
|
|
85195
85327
|
};
|
|
85196
85328
|
this.onKeyLine = true;
|
|
85197
85329
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -86890,6 +87022,18 @@ async function sandboxRun(opts, writer = stdoutWriter, deps = {}) {
|
|
|
86890
87022
|
if (!workspace) return fail3(NO_WORKSPACE, "usage");
|
|
86891
87023
|
const org = getOrgId();
|
|
86892
87024
|
if (!org) return fail3(NO_ORG, "not_logged_in");
|
|
87025
|
+
if (opts.accountSource !== void 0 && !ACCOUNT_SOURCES.includes(opts.accountSource)) {
|
|
87026
|
+
return fail3(
|
|
87027
|
+
`Pass --account-source with one of: ${ACCOUNT_SOURCES.join(", ")}.`,
|
|
87028
|
+
"usage"
|
|
87029
|
+
);
|
|
87030
|
+
}
|
|
87031
|
+
if (opts.workOrder && (opts.accountSource || opts.confirmWorkspaceBilling)) {
|
|
87032
|
+
return fail3(
|
|
87033
|
+
"A work order runs on the account source its send recorded. Leave out --account-source and --confirm-workspace-billing.",
|
|
87034
|
+
"usage"
|
|
87035
|
+
);
|
|
87036
|
+
}
|
|
86893
87037
|
if (opts.workOrder) {
|
|
86894
87038
|
if (opts.repo || opts.repoProvider || opts.branch || opts.prompt || opts.promptFile) {
|
|
86895
87039
|
return fail3(
|
|
@@ -86940,6 +87084,8 @@ async function sandboxRun(opts, writer = stdoutWriter, deps = {}) {
|
|
|
86940
87084
|
...opts.runtime ? { runtime: opts.runtime } : {},
|
|
86941
87085
|
...prompt !== void 0 ? { prompt } : {},
|
|
86942
87086
|
...opts.workOrder ? { workOrderId: opts.workOrder } : {},
|
|
87087
|
+
...opts.accountSource ? { accountSource: opts.accountSource } : {},
|
|
87088
|
+
...opts.confirmWorkspaceBilling ? { confirmWorkspaceBilling: true } : {},
|
|
86943
87089
|
launchedVia: "cli"
|
|
86944
87090
|
};
|
|
86945
87091
|
let run3;
|
|
@@ -87154,13 +87300,18 @@ async function sandboxShow(run3, opts, writer = stdoutWriter) {
|
|
|
87154
87300
|
}
|
|
87155
87301
|
}
|
|
87156
87302
|
}
|
|
87157
|
-
var NO_WORKSPACE, NO_ORG, NO_RUNTIME_HINT, REPO_SLUG, REPO_PROVIDERS, SANDBOX_STATES;
|
|
87303
|
+
var ACCOUNT_SOURCES, NO_WORKSPACE, NO_ORG, NO_RUNTIME_HINT, REPO_SLUG, REPO_PROVIDERS, SANDBOX_STATES;
|
|
87158
87304
|
var init_sandbox_run = __esm({
|
|
87159
87305
|
"src/commands/sandbox-run.ts"() {
|
|
87160
87306
|
init_api();
|
|
87161
87307
|
init_config();
|
|
87162
87308
|
init_capture_writer();
|
|
87163
87309
|
init_output();
|
|
87310
|
+
ACCOUNT_SOURCES = [
|
|
87311
|
+
"operator",
|
|
87312
|
+
"workspace",
|
|
87313
|
+
"operator_then_workspace"
|
|
87314
|
+
];
|
|
87164
87315
|
NO_WORKSPACE = "Name a workspace with --workspace-slug <slug> or OXAGEN_WORKSPACE. The CLI does not pick one for you.";
|
|
87165
87316
|
NO_ORG = "No organization is selected. Run `oxagen login`, or set OXAGEN_ORG_ID.";
|
|
87166
87317
|
NO_RUNTIME_HINT = "A sandbox run starts on a sandbox runtime. An org Owner adds one on the Runtimes page, with the workspace's Modal account connected.";
|
|
@@ -87348,6 +87499,7 @@ var sandbox_template_exports = {};
|
|
|
87348
87499
|
__export(sandbox_template_exports, {
|
|
87349
87500
|
STARTER_IDS: () => STARTER_IDS,
|
|
87350
87501
|
sandboxTemplateGenerate: () => sandboxTemplateGenerate,
|
|
87502
|
+
sandboxTemplateLog: () => sandboxTemplateLog,
|
|
87351
87503
|
sandboxTemplateTest: () => sandboxTemplateTest
|
|
87352
87504
|
});
|
|
87353
87505
|
async function sandboxTemplateGenerate(opts, writer = stdoutWriter) {
|
|
@@ -87563,7 +87715,51 @@ function testLines(test) {
|
|
|
87563
87715
|
}
|
|
87564
87716
|
return lines;
|
|
87565
87717
|
}
|
|
87566
|
-
|
|
87718
|
+
async function sandboxTemplateLog(runtime, build, opts, writer = stdoutWriter) {
|
|
87719
|
+
const out = createOutput({ json: opts.json }, writer);
|
|
87720
|
+
if (!RUNTIME_ID2.test(runtime)) {
|
|
87721
|
+
return out.error(
|
|
87722
|
+
`Name the sandbox runtime by its id, which starts with rtm_. "${runtime}" is not a runtime id.`,
|
|
87723
|
+
"usage"
|
|
87724
|
+
);
|
|
87725
|
+
}
|
|
87726
|
+
if (!TEMPLATE_ID.test(build)) {
|
|
87727
|
+
return out.error(
|
|
87728
|
+
`Name the build by its id, which starts with rtp_. "${build}" is not a build id. \`oxagen sandbox runtime list --json\` lists each runtime's builds.`,
|
|
87729
|
+
"usage"
|
|
87730
|
+
);
|
|
87731
|
+
}
|
|
87732
|
+
const workspace = namedWorkspace(opts.workspaceSlug);
|
|
87733
|
+
if (!workspace) return out.error(NO_WORKSPACE, "usage");
|
|
87734
|
+
const org = getOrgId();
|
|
87735
|
+
if (!org) return out.error(NO_ORG, "not_logged_in");
|
|
87736
|
+
let answer;
|
|
87737
|
+
try {
|
|
87738
|
+
answer = await apiPostOrThrow(
|
|
87739
|
+
"sandbox-templates/build-log",
|
|
87740
|
+
{ runtimeId: runtime, templateId: build },
|
|
87741
|
+
{ org, ws: workspace }
|
|
87742
|
+
);
|
|
87743
|
+
} catch (err2) {
|
|
87744
|
+
const refusal = refusalOf3(err2);
|
|
87745
|
+
return out.error(refusal.message, refusal.reason ?? "api");
|
|
87746
|
+
}
|
|
87747
|
+
if (out.isJson) {
|
|
87748
|
+
out.data(answer);
|
|
87749
|
+
return;
|
|
87750
|
+
}
|
|
87751
|
+
if (answer.log === null) {
|
|
87752
|
+
writer.writeErr(
|
|
87753
|
+
`Build ${build} stored no log. \`oxagen sandbox runtime list --json\` shows its failure reason.`
|
|
87754
|
+
);
|
|
87755
|
+
return;
|
|
87756
|
+
}
|
|
87757
|
+
if (answer.log.truncated) {
|
|
87758
|
+
writer.writeErr("The log is long, so this shows its last 256 KiB.");
|
|
87759
|
+
}
|
|
87760
|
+
writer.write(answer.log.text);
|
|
87761
|
+
}
|
|
87762
|
+
var STARTERS, STARTER_IDS, ROUTE_TEXT, POLL_MS, MAX_WAIT_MS, RUNTIME_ID2, TEMPLATE_ID;
|
|
87567
87763
|
var init_sandbox_template = __esm({
|
|
87568
87764
|
"src/commands/sandbox-template.ts"() {
|
|
87569
87765
|
init_api();
|
|
@@ -87587,6 +87783,7 @@ var init_sandbox_template = __esm({
|
|
|
87587
87783
|
POLL_MS = 5e3;
|
|
87588
87784
|
MAX_WAIT_MS = 12 * 6e4;
|
|
87589
87785
|
RUNTIME_ID2 = /^rtm_[0-9a-z]+$/;
|
|
87786
|
+
TEMPLATE_ID = /^rtp_[0-9a-z]+$/;
|
|
87590
87787
|
}
|
|
87591
87788
|
});
|
|
87592
87789
|
|
|
@@ -87607,6 +87804,15 @@ function templateFromFlags(flags) {
|
|
|
87607
87804
|
if (flags.dockerfile !== void 0)
|
|
87608
87805
|
named.push(["dockerfile", flags.dockerfile]);
|
|
87609
87806
|
const services = flags.service ?? [];
|
|
87807
|
+
const setup = flags.setupCommand === void 0 ? void 0 : {
|
|
87808
|
+
command: flags.setupCommand,
|
|
87809
|
+
workingDirectory: flags.setupDir ?? "/"
|
|
87810
|
+
};
|
|
87811
|
+
if (flags.setupDir !== void 0 && setup === void 0) {
|
|
87812
|
+
return {
|
|
87813
|
+
error: "--setup-dir names the folder the setup command runs in. Pass --setup-command with it."
|
|
87814
|
+
};
|
|
87815
|
+
}
|
|
87610
87816
|
if (named.length > 1) {
|
|
87611
87817
|
return {
|
|
87612
87818
|
error: "Pass one of --image, --pinned-image, or --dockerfile. Each names a whole template."
|
|
@@ -87614,16 +87820,21 @@ function templateFromFlags(flags) {
|
|
|
87614
87820
|
}
|
|
87615
87821
|
const [first] = named;
|
|
87616
87822
|
if (first === void 0) {
|
|
87617
|
-
|
|
87618
|
-
|
|
87619
|
-
|
|
87823
|
+
if (services.length > 0)
|
|
87824
|
+
return {
|
|
87825
|
+
error: "--service adds a service to a template. Pass --image, --pinned-image, or --dockerfile with it."
|
|
87826
|
+
};
|
|
87827
|
+
return setup === void 0 ? {} : {
|
|
87828
|
+
error: "--setup-command is part of a template. Pass --image, --pinned-image, or --dockerfile with it."
|
|
87829
|
+
};
|
|
87620
87830
|
}
|
|
87621
87831
|
const [sourceKind, sourceRef] = first;
|
|
87622
87832
|
return {
|
|
87623
87833
|
template: {
|
|
87624
87834
|
sourceKind,
|
|
87625
87835
|
sourceRef,
|
|
87626
|
-
...services.length > 0 ? { services } : {}
|
|
87836
|
+
...services.length > 0 ? { services } : {},
|
|
87837
|
+
...setup === void 0 ? {} : { setup }
|
|
87627
87838
|
}
|
|
87628
87839
|
};
|
|
87629
87840
|
}
|
|
@@ -88227,6 +88438,15 @@ var init_loop_detected = __esm({
|
|
|
88227
88438
|
}
|
|
88228
88439
|
});
|
|
88229
88440
|
|
|
88441
|
+
// ../../packages/tacho/src/remote-digests.ts
|
|
88442
|
+
var init_remote_digests = __esm({
|
|
88443
|
+
"../../packages/tacho/src/remote-digests.ts"() {
|
|
88444
|
+
"use strict";
|
|
88445
|
+
init_digest();
|
|
88446
|
+
init_remote();
|
|
88447
|
+
}
|
|
88448
|
+
});
|
|
88449
|
+
|
|
88230
88450
|
// ../../packages/tacho/src/evidence/merkle.ts
|
|
88231
88451
|
import { createHash as createHash20 } from "node:crypto";
|
|
88232
88452
|
function digestToBytes(digest6) {
|
|
@@ -92199,6 +92419,7 @@ var init_src4 = __esm({
|
|
|
92199
92419
|
init_loop_detected();
|
|
92200
92420
|
init_record_basis();
|
|
92201
92421
|
init_remote();
|
|
92422
|
+
init_remote_digests();
|
|
92202
92423
|
init_timestamp();
|
|
92203
92424
|
init_wire();
|
|
92204
92425
|
init_evidence();
|
|
@@ -93455,7 +93676,7 @@ function compareModels(usage3) {
|
|
|
93455
93676
|
function listRateCard() {
|
|
93456
93677
|
return RATE_CARD.filter((e) => !e.alias);
|
|
93457
93678
|
}
|
|
93458
|
-
var HAIKU_5_5_LONG_CONTEXT, RATE_CARD, FALLBACK_RATE;
|
|
93679
|
+
var HAIKU_5_5_LONG_CONTEXT, QWEN_3_7_FLASH_LONG_CONTEXT, RATE_CARD, FALLBACK_RATE;
|
|
93459
93680
|
var init_rate_card = __esm({
|
|
93460
93681
|
"../../packages/billing/src/rate-card.ts"() {
|
|
93461
93682
|
"use strict";
|
|
@@ -93466,6 +93687,13 @@ var init_rate_card = __esm({
|
|
|
93466
93687
|
cachedInputPer1M: 0.05,
|
|
93467
93688
|
cacheWritePer1M: 0.625
|
|
93468
93689
|
};
|
|
93690
|
+
QWEN_3_7_FLASH_LONG_CONTEXT = {
|
|
93691
|
+
abovePromptTokens: 32e3,
|
|
93692
|
+
inputPer1M: 0.1,
|
|
93693
|
+
outputPer1M: 0.4,
|
|
93694
|
+
cachedInputPer1M: 0.02,
|
|
93695
|
+
cacheWritePer1M: 0.125
|
|
93696
|
+
};
|
|
93469
93697
|
RATE_CARD = [
|
|
93470
93698
|
// Fable 5.1 and Opus 5.5 break from their family's price, so each gets a row
|
|
93471
93699
|
// for both the hyphenated and the dotted gateway spelling, the dotted one
|
|
@@ -93914,7 +94142,20 @@ var init_rate_card = __esm({
|
|
|
93914
94142
|
},
|
|
93915
94143
|
// Zhipu GLM rows from the AI Gateway's /v1/models pricing (2026-07-10).
|
|
93916
94144
|
// Specific families MUST sort before the generic "glm" prefix row (same
|
|
93917
|
-
// first-match rule as the gpt-5.5 rows above).
|
|
94145
|
+
// first-match rule as the gpt-5.5 rows above). GLM 5.3 Flash is from
|
|
94146
|
+
// OpenRouter's model list (2026-10-28), which prices a cache read at the
|
|
94147
|
+
// fresh input rate.
|
|
94148
|
+
{
|
|
94149
|
+
family: "glm-5.3-flash",
|
|
94150
|
+
label: "GLM 5.3 Flash",
|
|
94151
|
+
vendor: "zai",
|
|
94152
|
+
rate: {
|
|
94153
|
+
inputPer1M: 0.0259,
|
|
94154
|
+
outputPer1M: 0.1042,
|
|
94155
|
+
cachedInputPer1M: 0.0259,
|
|
94156
|
+
cacheWritePer1M: 0.0259
|
|
94157
|
+
}
|
|
94158
|
+
},
|
|
93918
94159
|
{
|
|
93919
94160
|
family: "glm-5.2-fast",
|
|
93920
94161
|
label: "GLM 5.2 Fast",
|
|
@@ -94046,6 +94287,22 @@ var init_rate_card = __esm({
|
|
|
94046
94287
|
cacheWritePer1M: 0.28
|
|
94047
94288
|
}
|
|
94048
94289
|
},
|
|
94290
|
+
// Qwen3.7 Flash at OpenRouter's price (2026-10-28). Unlike the other
|
|
94291
|
+
// vendors here, OpenRouter lists a cache write above fresh input for it:
|
|
94292
|
+
// $0.038 against $0.03. There is no generic "qwen" row, so another Qwen
|
|
94293
|
+
// model still falls back.
|
|
94294
|
+
{
|
|
94295
|
+
family: "qwen3.7-flash",
|
|
94296
|
+
label: "Qwen3.7 Flash",
|
|
94297
|
+
vendor: "qwen",
|
|
94298
|
+
rate: {
|
|
94299
|
+
inputPer1M: 0.03,
|
|
94300
|
+
outputPer1M: 0.13,
|
|
94301
|
+
cachedInputPer1M: 6e-3,
|
|
94302
|
+
cacheWritePer1M: 0.038,
|
|
94303
|
+
longContext: QWEN_3_7_FLASH_LONG_CONTEXT
|
|
94304
|
+
}
|
|
94305
|
+
},
|
|
94049
94306
|
// Gateway /v1/models 2026-07-07 (base tier ≤200k): gemini-3-pro* $2/$12.
|
|
94050
94307
|
{
|
|
94051
94308
|
family: "gemini-3-pro",
|
|
@@ -94085,6 +94342,19 @@ var init_rate_card = __esm({
|
|
|
94085
94342
|
cacheWritePer1M: 0.5
|
|
94086
94343
|
}
|
|
94087
94344
|
},
|
|
94345
|
+
// Gemini 3.8 Flash at OpenRouter's price (2026-10-28), the batch triage
|
|
94346
|
+
// model. It MUST sort before the generic "gemini" row.
|
|
94347
|
+
{
|
|
94348
|
+
family: "gemini-3.8-flash",
|
|
94349
|
+
label: "Gemini 3.8 Flash",
|
|
94350
|
+
vendor: "google",
|
|
94351
|
+
rate: {
|
|
94352
|
+
inputPer1M: 0.825,
|
|
94353
|
+
outputPer1M: 4.125,
|
|
94354
|
+
cachedInputPer1M: 0.0825,
|
|
94355
|
+
cacheWritePer1M: 0.825
|
|
94356
|
+
}
|
|
94357
|
+
},
|
|
94088
94358
|
{
|
|
94089
94359
|
family: "gemini",
|
|
94090
94360
|
label: "Gemini",
|
|
@@ -96004,13 +96274,17 @@ var init_finding_shared = __esm({
|
|
|
96004
96274
|
"retry_loops",
|
|
96005
96275
|
"commits_never_shipped",
|
|
96006
96276
|
"overpowered_prompts",
|
|
96007
|
-
"underpowered_prompts"
|
|
96277
|
+
"underpowered_prompts",
|
|
96278
|
+
"repeated_refusals",
|
|
96279
|
+
"recurring_setup_failures",
|
|
96280
|
+
"failing_tool_calls"
|
|
96008
96281
|
]);
|
|
96009
96282
|
findingLevelSchema = external_exports.enum([
|
|
96010
96283
|
"tool",
|
|
96011
96284
|
"agent",
|
|
96012
96285
|
"operator",
|
|
96013
|
-
"workspace"
|
|
96286
|
+
"workspace",
|
|
96287
|
+
"repository"
|
|
96014
96288
|
]);
|
|
96015
96289
|
findingConfidenceSchema = external_exports.enum(["high", "medium"]);
|
|
96016
96290
|
findingStatusSchema = external_exports.enum(["open", "applied", "dismissed"]);
|
|
@@ -97874,7 +98148,7 @@ async function findingsList(opts, writer = stdoutWriter) {
|
|
|
97874
98148
|
if (opts.level !== void 0 && !isLevel(opts.level)) {
|
|
97875
98149
|
process.exitCode = 2;
|
|
97876
98150
|
out.error(
|
|
97877
|
-
`Invalid --level "${opts.level}". Use tool, agent, operator or
|
|
98151
|
+
`Invalid --level "${opts.level}". Use tool, agent, operator, workspace or repository.`,
|
|
97878
98152
|
"usage"
|
|
97879
98153
|
);
|
|
97880
98154
|
return;
|
|
@@ -97977,7 +98251,13 @@ var init_findings = __esm({
|
|
|
97977
98251
|
init_capture_writer();
|
|
97978
98252
|
init_output();
|
|
97979
98253
|
STATUSES = ["open", "applied", "dismissed"];
|
|
97980
|
-
LEVELS = [
|
|
98254
|
+
LEVELS = [
|
|
98255
|
+
"tool",
|
|
98256
|
+
"agent",
|
|
98257
|
+
"operator",
|
|
98258
|
+
"workspace",
|
|
98259
|
+
"repository"
|
|
98260
|
+
];
|
|
97981
98261
|
CURSOR_MAX = 256;
|
|
97982
98262
|
SUBJECT_MAX = 256;
|
|
97983
98263
|
FRAMES_SHOWN = 5;
|
|
@@ -98238,26 +98518,14 @@ var init_steering_findings = __esm({
|
|
|
98238
98518
|
// src/commands/repo.ts
|
|
98239
98519
|
var repo_exports = {};
|
|
98240
98520
|
__export(repo_exports, {
|
|
98241
|
-
draftGovernanceToml: () => draftGovernanceToml,
|
|
98242
98521
|
parseRepositoryRef: () => parseRepositoryRef,
|
|
98243
98522
|
repoBranch: () => repoBranch,
|
|
98244
98523
|
repoGovernance: () => repoGovernance,
|
|
98245
|
-
repoInit: () => repoInit,
|
|
98246
98524
|
repoLink: () => repoLink,
|
|
98247
98525
|
repoList: () => repoList,
|
|
98248
98526
|
repoTree: () => repoTree,
|
|
98249
98527
|
repoUnlink: () => repoUnlink
|
|
98250
98528
|
});
|
|
98251
|
-
import { readFile as readFile6 } from "node:fs/promises";
|
|
98252
|
-
function draftGovernanceToml(mode) {
|
|
98253
|
-
return [
|
|
98254
|
-
"# Read on the production branch when a pull request is opened and again",
|
|
98255
|
-
"# when it is merged. A missing file means team.",
|
|
98256
|
-
`mode = "${mode}"`,
|
|
98257
|
-
`separation_of_duties = ${mode === "regulated" ? "true" : "false"}`,
|
|
98258
|
-
""
|
|
98259
|
-
].join("\n");
|
|
98260
|
-
}
|
|
98261
98529
|
function parseRepositoryRef(ref) {
|
|
98262
98530
|
const parts = ref.trim().split("/");
|
|
98263
98531
|
if (parts.length !== 2) return null;
|
|
@@ -98380,20 +98648,21 @@ async function repoUnlink(bindingId, opts = {}, writer = stdoutWriter) {
|
|
|
98380
98648
|
"Its binding versions stay as evidence for the runs that cited them. Link it again to write the next version."
|
|
98381
98649
|
);
|
|
98382
98650
|
}
|
|
98383
|
-
async function repoTree(
|
|
98384
|
-
const id2 = bindingId.trim();
|
|
98385
|
-
if (id2.length === 0) {
|
|
98386
|
-
return usageError(
|
|
98387
|
-
writer,
|
|
98388
|
-
"a binding id is required",
|
|
98389
|
-
"oxagen repo tree <bindingId> [--json]"
|
|
98390
|
-
);
|
|
98391
|
-
}
|
|
98651
|
+
async function repoTree(opts = {}, writer = stdoutWriter) {
|
|
98392
98652
|
const out = createOutput({ json: opts.json }, writer);
|
|
98393
98653
|
let result2;
|
|
98394
98654
|
try {
|
|
98655
|
+
const { repositories } = await apiGetOrThrow("repositories");
|
|
98656
|
+
const steeringRepo = repositories.find((repo) => repo.role === "main");
|
|
98657
|
+
if (steeringRepo === void 0) {
|
|
98658
|
+
out.error(
|
|
98659
|
+
"This workspace has no steering repository yet.",
|
|
98660
|
+
"main_repo_unbound"
|
|
98661
|
+
);
|
|
98662
|
+
return;
|
|
98663
|
+
}
|
|
98395
98664
|
result2 = await apiPostOrThrow("repository/tree", {
|
|
98396
|
-
bindingId:
|
|
98665
|
+
bindingId: steeringRepo.bindingId
|
|
98397
98666
|
});
|
|
98398
98667
|
} catch (err2) {
|
|
98399
98668
|
out.error(err2, "api");
|
|
@@ -98413,9 +98682,7 @@ async function repoTree(bindingId, opts = {}, writer = stdoutWriter) {
|
|
|
98413
98682
|
}
|
|
98414
98683
|
const steering = result2.steering?.present === true;
|
|
98415
98684
|
if (!steering && !result2.oxagen.present) {
|
|
98416
|
-
writer.write(
|
|
98417
|
-
result2.initPullRequest === null ? "No .oxagen/ on the production branch. Add it with `oxagen repo init`." : `No .oxagen/ yet. The init pull request is open: ${result2.initPullRequest.htmlUrl}`
|
|
98418
|
-
);
|
|
98685
|
+
writer.write("No steering files on the production branch.");
|
|
98419
98686
|
return;
|
|
98420
98687
|
}
|
|
98421
98688
|
writer.write(`governance mode: ${result2.governanceMode}`);
|
|
@@ -98451,59 +98718,6 @@ async function repoBranch(bindingId, branch, opts = {}, writer = stdoutWriter) {
|
|
|
98451
98718
|
result2.changed ? `${result2.fullName}: production branch ${result2.previousBranch} \u2192 ${result2.productionBranch} \xB7 ${result2.bindingId}` : `${result2.fullName}: production branch is already ${result2.productionBranch}; nothing was written`
|
|
98452
98719
|
);
|
|
98453
98720
|
}
|
|
98454
|
-
async function repoInit(bindingId, opts = {}, writer = stdoutWriter) {
|
|
98455
|
-
const line = "oxagen repo init <bindingId> --workspace-toml <file> [--mode solo|team|regulated] [--governance-toml <file>] [--json]";
|
|
98456
|
-
const id2 = bindingId.trim();
|
|
98457
|
-
if (id2.length === 0) {
|
|
98458
|
-
return usageError(writer, "a binding id is required", line);
|
|
98459
|
-
}
|
|
98460
|
-
const mode = opts.mode ?? "team";
|
|
98461
|
-
if (!GOVERNANCE_MODES.includes(mode)) {
|
|
98462
|
-
return usageError(
|
|
98463
|
-
writer,
|
|
98464
|
-
`expected a mode of solo, team or regulated, got ${JSON.stringify(opts.mode)}`,
|
|
98465
|
-
line
|
|
98466
|
-
);
|
|
98467
|
-
}
|
|
98468
|
-
if (opts.workspaceToml === void 0) {
|
|
98469
|
-
return usageError(writer, "--workspace-toml is required", line);
|
|
98470
|
-
}
|
|
98471
|
-
let workspaceToml;
|
|
98472
|
-
let governanceToml;
|
|
98473
|
-
try {
|
|
98474
|
-
workspaceToml = await readFile6(opts.workspaceToml, "utf8");
|
|
98475
|
-
governanceToml = opts.governanceToml === void 0 ? draftGovernanceToml(mode) : await readFile6(opts.governanceToml, "utf8");
|
|
98476
|
-
} catch (err2) {
|
|
98477
|
-
return usageError(
|
|
98478
|
-
writer,
|
|
98479
|
-
`could not read a file: ${err2 instanceof Error ? err2.message : String(err2)}`,
|
|
98480
|
-
line
|
|
98481
|
-
);
|
|
98482
|
-
}
|
|
98483
|
-
const out = createOutput({ json: opts.json }, writer);
|
|
98484
|
-
let result2;
|
|
98485
|
-
try {
|
|
98486
|
-
result2 = await apiPostOrThrow("repository/init-pr", {
|
|
98487
|
-
bindingId: id2,
|
|
98488
|
-
governanceMode: mode,
|
|
98489
|
-
workspaceToml,
|
|
98490
|
-
governanceToml
|
|
98491
|
-
});
|
|
98492
|
-
} catch (err2) {
|
|
98493
|
-
out.error(err2, "api");
|
|
98494
|
-
return;
|
|
98495
|
-
}
|
|
98496
|
-
if (out.isJson) {
|
|
98497
|
-
out.data(result2);
|
|
98498
|
-
return;
|
|
98499
|
-
}
|
|
98500
|
-
writer.write(
|
|
98501
|
-
result2.reused ? `An init pull request is already open on ${result2.fullName}: ${result2.pullRequest.htmlUrl}` : `Opened ${result2.pullRequest.htmlUrl} on ${result2.fullName}: ${result2.branch} \u2192 ${result2.base}, ${result2.files.length} files`
|
|
98502
|
-
);
|
|
98503
|
-
writer.write(
|
|
98504
|
-
"Nothing reaches the production branch until a person merges it."
|
|
98505
|
-
);
|
|
98506
|
-
}
|
|
98507
98721
|
async function repoGovernance(opts = {}, writer = stdoutWriter) {
|
|
98508
98722
|
const line = "oxagen repo governance --mode solo|team|regulated [--workspace <wrk_\u2026>] [--apply-now] [--json]";
|
|
98509
98723
|
const mode = opts.mode;
|
|
@@ -99208,7 +99422,7 @@ function recordLineageFromPath(path2) {
|
|
|
99208
99422
|
return parts[parts.length - 1].slice(0, -3);
|
|
99209
99423
|
return null;
|
|
99210
99424
|
}
|
|
99211
|
-
var AGENTS_MD_PATH, CLAUDE_MD_PATH, README_PATH, GITATTRIBUTES_PATH, WORKSPACE_TOML_PATH, AGENTS_DIR, STEERING_DIR, PEOPLE_DIR, PERSON_FOLDER, GOVERNANCE_TOML_PATH, SKILLS_DIR, TOOLS_DIR, TOOL_SERVERS_DIR, POLICY_DIR, CEDAR_SCHEMA_PATH, CODEGRAPH_SETTINGS_DIR, SANDBOX_TEMPLATE_DIR, SKILL_FILE_NAME, SERVER_TOML_NAME, TOOLS_TOML_NAME, TOOLS_LOCK_NAME, LEDGER_ROTATIONS, LEDGER_FILE, ROOT_FILES, SERVER_FILES, SANDBOX_SERVICE_NAME
|
|
99425
|
+
var AGENTS_MD_PATH, CLAUDE_MD_PATH, README_PATH, GITATTRIBUTES_PATH, WORKSPACE_TOML_PATH, AGENTS_DIR, STEERING_DIR, PEOPLE_DIR, PERSON_FOLDER, GOVERNANCE_TOML_PATH, SKILLS_DIR, TOOLS_DIR, TOOL_SERVERS_DIR, POLICY_DIR, CEDAR_SCHEMA_PATH, CODEGRAPH_SETTINGS_DIR, SANDBOX_TEMPLATE_DIR, SKILL_FILE_NAME, SERVER_TOML_NAME, TOOLS_TOML_NAME, TOOLS_LOCK_NAME, LEDGER_ROTATIONS, LEDGER_FILE, ROOT_FILES, SERVER_FILES, SANDBOX_SERVICE_NAME;
|
|
99212
99426
|
var init_paths2 = __esm({
|
|
99213
99427
|
"../../packages/oxagen/src/steering-repo/paths.ts"() {
|
|
99214
99428
|
"use strict";
|
|
@@ -99260,7 +99474,6 @@ var init_paths2 = __esm({
|
|
|
99260
99474
|
"schema.graphql": "server-definition"
|
|
99261
99475
|
};
|
|
99262
99476
|
SANDBOX_SERVICE_NAME = /^[a-z0-9][a-z0-9@._-]{0,127}$/;
|
|
99263
|
-
WORKSPACE_LINK_PATH = ".oxagen/workspace.json";
|
|
99264
99477
|
}
|
|
99265
99478
|
});
|
|
99266
99479
|
|
|
@@ -104249,15 +104462,35 @@ var init_schemas2 = __esm({
|
|
|
104249
104462
|
});
|
|
104250
104463
|
|
|
104251
104464
|
// ../../packages/oxagen/src/steering-repo/settings-baseline.ts
|
|
104252
|
-
var OXAGEN_STEERING_APP, GITLAB_SETTINGS_BASELINE;
|
|
104465
|
+
var OXAGEN_STEERING_APP, GITHUB_MAIN_PROTECTION, GITLAB_SETTINGS_BASELINE;
|
|
104253
104466
|
var init_settings_baseline = __esm({
|
|
104254
104467
|
"../../packages/oxagen/src/steering-repo/settings-baseline.ts"() {
|
|
104255
104468
|
"use strict";
|
|
104256
104469
|
init_names();
|
|
104257
104470
|
OXAGEN_STEERING_APP = "oxagen-steering";
|
|
104471
|
+
GITHUB_MAIN_PROTECTION = {
|
|
104472
|
+
name: "Oxagen steering",
|
|
104473
|
+
target: "branch",
|
|
104474
|
+
enforcement: "active",
|
|
104475
|
+
include: [`refs/heads/${STEERING_DEFAULT_BRANCH}`],
|
|
104476
|
+
bypass_actors: [],
|
|
104477
|
+
rules: [
|
|
104478
|
+
{
|
|
104479
|
+
type: "pull_request",
|
|
104480
|
+
parameters: {
|
|
104481
|
+
required_approving_review_count: 0,
|
|
104482
|
+
dismiss_stale_reviews_on_push: false,
|
|
104483
|
+
require_code_owner_review: false,
|
|
104484
|
+
require_last_push_approval: false,
|
|
104485
|
+
required_review_thread_resolution: false
|
|
104486
|
+
}
|
|
104487
|
+
}
|
|
104488
|
+
]
|
|
104489
|
+
};
|
|
104258
104490
|
GITLAB_SETTINGS_BASELINE = {
|
|
104259
104491
|
visibility: "private",
|
|
104260
104492
|
default_branch: STEERING_DEFAULT_BRANCH,
|
|
104493
|
+
// Creation protects main so no one pushes and only the Oxagen bot merges.
|
|
104261
104494
|
protected_branches: {
|
|
104262
104495
|
[STEERING_DEFAULT_BRANCH]: {
|
|
104263
104496
|
push_access: "no_one",
|
|
@@ -106678,32 +106911,19 @@ function shown2(value) {
|
|
|
106678
106911
|
return text6.length > 120 ? `${text6.slice(0, 117)}...` : text6;
|
|
106679
106912
|
}
|
|
106680
106913
|
function describe7(difference) {
|
|
106681
|
-
const { setting: setting2, actual } = difference;
|
|
106682
|
-
|
|
106683
|
-
if (setting2 === "actions.enabled" && actual === true) {
|
|
106684
|
-
return {
|
|
106685
|
-
rule: "actions-enabled",
|
|
106686
|
-
message: "GitHub Actions is on",
|
|
106687
|
-
fix: `${REPAIR} Or turn Actions off by hand. Oxagen runs every check itself.`
|
|
106688
|
-
};
|
|
106689
|
-
}
|
|
106690
|
-
if (setting2 === "ci_cd.builds_access_level" && actual !== "disabled") {
|
|
106914
|
+
const { setting: setting2, expected, actual } = difference;
|
|
106915
|
+
if (SQUASH_SETTINGS.has(setting2) && actual === false) {
|
|
106691
106916
|
return {
|
|
106692
|
-
rule: "
|
|
106693
|
-
message: "
|
|
106694
|
-
|
|
106695
|
-
|
|
106696
|
-
}
|
|
106697
|
-
if (parts[0] === "protected_branches" && parts[2] === "allow_force_push" && actual === true) {
|
|
106698
|
-
return {
|
|
106699
|
-
rule: "force-push-allowed",
|
|
106700
|
-
message: `The protected branch ${parts[1]} allows force pushes`,
|
|
106701
|
-
fix: `${REPAIR} Or turn force pushes off by hand.`
|
|
106917
|
+
rule: "squash-merge-off",
|
|
106918
|
+
message: "Squash merging is off",
|
|
106919
|
+
expected: "Squash merging is on.",
|
|
106920
|
+
fix: `${REPAIR} Or turn squash merging back on by hand. Oxagen merges every steering pull request with a squash.`
|
|
106702
106921
|
};
|
|
106703
106922
|
}
|
|
106704
106923
|
return {
|
|
106705
106924
|
rule: "setting-differs",
|
|
106706
106925
|
message: `${setting2} is ${shown2(actual)}`,
|
|
106926
|
+
expected: `${setting2} is ${shown2(expected)}.`,
|
|
106707
106927
|
fix: `${REPAIR} Or set it back by hand.`
|
|
106708
106928
|
};
|
|
106709
106929
|
}
|
|
@@ -106715,13 +106935,17 @@ function changedBy(difference) {
|
|
|
106715
106935
|
if (by) return ` (by ${by})`;
|
|
106716
106936
|
return "";
|
|
106717
106937
|
}
|
|
106718
|
-
var find11, REPAIR, settingsCheck;
|
|
106938
|
+
var find11, REPAIR, SQUASH_SETTINGS, settingsCheck;
|
|
106719
106939
|
var init_settings = __esm({
|
|
106720
106940
|
"../../packages/steering-check/src/checks/settings.ts"() {
|
|
106721
106941
|
"use strict";
|
|
106722
106942
|
init_finding();
|
|
106723
106943
|
find11 = finder("settings");
|
|
106724
106944
|
REPAIR = "A workspace admin opens Workspace settings, then Steering repo, and selects Repair settings.";
|
|
106945
|
+
SQUASH_SETTINGS = /* @__PURE__ */ new Set([
|
|
106946
|
+
"merge.allow_squash_merge",
|
|
106947
|
+
"merge_requests.squash_allowed"
|
|
106948
|
+
]);
|
|
106725
106949
|
settingsCheck = (env) => {
|
|
106726
106950
|
if (env.health === null) {
|
|
106727
106951
|
return {
|
|
@@ -106729,20 +106953,20 @@ var init_settings = __esm({
|
|
|
106729
106953
|
};
|
|
106730
106954
|
}
|
|
106731
106955
|
const findings = env.health.differences.map((difference) => {
|
|
106732
|
-
const { rule, message: message2, fix } = describe7(difference);
|
|
106956
|
+
const { rule, message: message2, expected, fix } = describe7(difference);
|
|
106733
106957
|
return find11({
|
|
106734
106958
|
rule,
|
|
106735
106959
|
path: difference.setting,
|
|
106736
106960
|
line: null,
|
|
106737
106961
|
field: null,
|
|
106738
106962
|
message: `${message2}${changedBy(difference)}.`,
|
|
106739
|
-
expected
|
|
106963
|
+
expected,
|
|
106740
106964
|
fix
|
|
106741
106965
|
});
|
|
106742
106966
|
});
|
|
106743
106967
|
return findings.length === 0 ? { findings } : {
|
|
106744
106968
|
findings,
|
|
106745
|
-
note: "
|
|
106969
|
+
note: "Oxagen merges no steering pull request while these settings differ."
|
|
106746
106970
|
};
|
|
106747
106971
|
};
|
|
106748
106972
|
}
|
|
@@ -107220,7 +107444,7 @@ var init_memory_client = __esm({
|
|
|
107220
107444
|
});
|
|
107221
107445
|
|
|
107222
107446
|
// src/lib/markdown-import.ts
|
|
107223
|
-
import { readFile as
|
|
107447
|
+
import { readFile as readFile6 } from "node:fs/promises";
|
|
107224
107448
|
import {
|
|
107225
107449
|
basename as basename10,
|
|
107226
107450
|
dirname as dirname35,
|
|
@@ -107249,7 +107473,7 @@ async function readImportDocuments(sources, target, writer) {
|
|
|
107249
107473
|
for (const source of sources) {
|
|
107250
107474
|
let content;
|
|
107251
107475
|
try {
|
|
107252
|
-
content = await
|
|
107476
|
+
content = await readFile6(source.path, "utf8");
|
|
107253
107477
|
} catch {
|
|
107254
107478
|
unreadable.push(source.path);
|
|
107255
107479
|
continue;
|
|
@@ -107272,7 +107496,7 @@ async function readImportDocuments(sources, target, writer) {
|
|
|
107272
107496
|
for (const file of source.files) {
|
|
107273
107497
|
let text6;
|
|
107274
107498
|
try {
|
|
107275
|
-
text6 = await
|
|
107499
|
+
text6 = await readFile6(file.file, "utf8");
|
|
107276
107500
|
} catch {
|
|
107277
107501
|
unreadable.push(file.file);
|
|
107278
107502
|
continue;
|
|
@@ -108154,9 +108378,9 @@ function formatDismissResult(result2, restore) {
|
|
|
108154
108378
|
}
|
|
108155
108379
|
function formatDropResult(result2) {
|
|
108156
108380
|
const pr = result2.pull_request;
|
|
108157
|
-
const
|
|
108381
|
+
const short4 = result2.commit_sha.slice(0, 7);
|
|
108158
108382
|
return [
|
|
108159
|
-
result2.already_dropped ? `${result2.path} was already dropped from memory PR #${pr.number} in commit ${
|
|
108383
|
+
result2.already_dropped ? `${result2.path} was already dropped from memory PR #${pr.number} in commit ${short4}.` : `Dropped ${result2.path} from memory PR #${pr.number} in commit ${short4} on ${pr.branch}.`,
|
|
108160
108384
|
"When the PR merges, the record's statements are rejected and its memories wait again.",
|
|
108161
108385
|
pr.url
|
|
108162
108386
|
].join("\n");
|
|
@@ -109722,6 +109946,12 @@ __export(credentials_exports, {
|
|
|
109722
109946
|
credentialsUpdate: () => credentialsUpdate,
|
|
109723
109947
|
readSecret: () => readSecret
|
|
109724
109948
|
});
|
|
109949
|
+
function sharedBody(opts) {
|
|
109950
|
+
return opts.shared ? { scope: "workspace" } : {};
|
|
109951
|
+
}
|
|
109952
|
+
function sharedQuery(opts) {
|
|
109953
|
+
return opts.shared ? "?scope=workspace" : "";
|
|
109954
|
+
}
|
|
109725
109955
|
async function readSecret(label, io = {
|
|
109726
109956
|
stdin: process.stdin,
|
|
109727
109957
|
prompt: (text6) => process.stderr.write(text6)
|
|
@@ -109876,13 +110106,17 @@ async function credentialsAdd(opts, writer = stdoutWriter, deps = {}) {
|
|
|
109876
110106
|
);
|
|
109877
110107
|
}
|
|
109878
110108
|
try {
|
|
109879
|
-
const { credential } = await apiPostOrThrow(
|
|
110109
|
+
const { credential } = await apiPostOrThrow(
|
|
110110
|
+
"user/model-credentials",
|
|
110111
|
+
{ ...body2, ...sharedBody(opts), secret },
|
|
110112
|
+
scope
|
|
110113
|
+
);
|
|
109880
110114
|
if (out.isJson) {
|
|
109881
110115
|
out.data({ credential });
|
|
109882
110116
|
return;
|
|
109883
110117
|
}
|
|
109884
110118
|
writer.write(
|
|
109885
|
-
credential.baseUrl ? `Stored the key ending ${credential.hint} for ${credential.baseUrl} as ${credential.id}. Sandbox runs don't use your own endpoint yet. Oxagen keeps the key until they do.` : `Stored the ${credential.provider} credential ending ${credential.hint} as ${credential.id}. Only your own runs use it.`
|
|
110119
|
+
credential.baseUrl ? `Stored the key ending ${credential.hint} for ${credential.baseUrl} as ${credential.id}. Sandbox runs don't use your own endpoint yet. Oxagen keeps the key until they do.` : opts.shared ? `Stored the ${credential.provider} account ending ${credential.hint} as ${credential.id}. Runs whose account source names this workspace can use it.` : `Stored the ${credential.provider} credential ending ${credential.hint} as ${credential.id}. Only your own runs use it.`
|
|
109886
110120
|
);
|
|
109887
110121
|
} catch (err2) {
|
|
109888
110122
|
const refusal = refusalOf3(err2);
|
|
@@ -109896,7 +110130,7 @@ async function credentialsList(opts, writer = stdoutWriter) {
|
|
|
109896
110130
|
try {
|
|
109897
110131
|
const { items } = await apiGetOrThrow(
|
|
109898
110132
|
"user/model-credentials",
|
|
109899
|
-
void 0,
|
|
110133
|
+
opts.shared ? { scope: "workspace" } : void 0,
|
|
109900
110134
|
scope
|
|
109901
110135
|
);
|
|
109902
110136
|
if (out.isJson) {
|
|
@@ -109964,7 +110198,8 @@ async function credentialsUpdate(credentialId, opts, writer = stdoutWriter) {
|
|
|
109964
110198
|
{
|
|
109965
110199
|
...opts.label !== void 0 ? { label: opts.label } : {},
|
|
109966
110200
|
...opts.pause ? { paused: true } : {},
|
|
109967
|
-
...opts.resume ? { paused: false } : {}
|
|
110201
|
+
...opts.resume ? { paused: false } : {},
|
|
110202
|
+
...sharedBody(opts)
|
|
109968
110203
|
},
|
|
109969
110204
|
scope
|
|
109970
110205
|
);
|
|
@@ -110010,7 +110245,7 @@ async function credentialsRotate(credentialId, opts, writer = stdoutWriter, deps
|
|
|
110010
110245
|
try {
|
|
110011
110246
|
const { items } = await apiGetOrThrow(
|
|
110012
110247
|
"user/model-credentials",
|
|
110013
|
-
void 0,
|
|
110248
|
+
opts.shared ? { scope: "workspace" } : void 0,
|
|
110014
110249
|
scope
|
|
110015
110250
|
);
|
|
110016
110251
|
current = items.find((c) => c.id === credentialId);
|
|
@@ -110059,7 +110294,7 @@ async function credentialsRotate(credentialId, opts, writer = stdoutWriter, deps
|
|
|
110059
110294
|
try {
|
|
110060
110295
|
const { credential } = await apiPostOrThrow(
|
|
110061
110296
|
`user/model-credentials/${encodeURIComponent(credentialId)}/rotate`,
|
|
110062
|
-
{ secret },
|
|
110297
|
+
{ secret, ...sharedBody(opts) },
|
|
110063
110298
|
scope
|
|
110064
110299
|
);
|
|
110065
110300
|
if (out.isJson) {
|
|
@@ -110080,7 +110315,10 @@ async function credentialsRemove(credentialId, opts, writer = stdoutWriter) {
|
|
|
110080
110315
|
const scope = scopeFor(opts);
|
|
110081
110316
|
if ("error" in scope) return out.error(scope.error, "usage");
|
|
110082
110317
|
try {
|
|
110083
|
-
const { credential } = await apiDeleteOrThrow(
|
|
110318
|
+
const { credential } = await apiDeleteOrThrow(
|
|
110319
|
+
`user/model-credentials/${encodeURIComponent(credentialId)}${sharedQuery(opts)}`,
|
|
110320
|
+
scope
|
|
110321
|
+
);
|
|
110084
110322
|
if (out.isJson) {
|
|
110085
110323
|
out.data({ credential });
|
|
110086
110324
|
return;
|
|
@@ -124726,49 +124964,49 @@ var require_fast_uri = __commonJS({
|
|
|
124726
124964
|
schemelessOptions.skipEscape = true;
|
|
124727
124965
|
return serialize2(resolved, schemelessOptions);
|
|
124728
124966
|
}
|
|
124729
|
-
function resolveComponent(base2,
|
|
124967
|
+
function resolveComponent(base2, relative11, options, skipNormalization) {
|
|
124730
124968
|
const target = {};
|
|
124731
124969
|
if (!skipNormalization) {
|
|
124732
124970
|
base2 = parse4(serialize2(base2, options), options);
|
|
124733
|
-
|
|
124971
|
+
relative11 = parse4(serialize2(relative11, options), options);
|
|
124734
124972
|
}
|
|
124735
124973
|
options = options || {};
|
|
124736
|
-
if (!options.tolerant &&
|
|
124737
|
-
target.scheme =
|
|
124738
|
-
target.userinfo =
|
|
124739
|
-
target.host =
|
|
124740
|
-
target.port =
|
|
124741
|
-
target.path = removeDotSegments(
|
|
124742
|
-
target.query =
|
|
124974
|
+
if (!options.tolerant && relative11.scheme) {
|
|
124975
|
+
target.scheme = relative11.scheme;
|
|
124976
|
+
target.userinfo = relative11.userinfo;
|
|
124977
|
+
target.host = relative11.host;
|
|
124978
|
+
target.port = relative11.port;
|
|
124979
|
+
target.path = removeDotSegments(relative11.path || "");
|
|
124980
|
+
target.query = relative11.query;
|
|
124743
124981
|
} else {
|
|
124744
|
-
if (
|
|
124745
|
-
target.userinfo =
|
|
124746
|
-
target.host =
|
|
124747
|
-
target.port =
|
|
124748
|
-
target.path = removeDotSegments(
|
|
124749
|
-
target.query =
|
|
124982
|
+
if (relative11.userinfo !== void 0 || relative11.host !== void 0 || relative11.port !== void 0) {
|
|
124983
|
+
target.userinfo = relative11.userinfo;
|
|
124984
|
+
target.host = relative11.host;
|
|
124985
|
+
target.port = relative11.port;
|
|
124986
|
+
target.path = removeDotSegments(relative11.path || "");
|
|
124987
|
+
target.query = relative11.query;
|
|
124750
124988
|
} else {
|
|
124751
|
-
if (!
|
|
124989
|
+
if (!relative11.path) {
|
|
124752
124990
|
target.path = base2.path;
|
|
124753
|
-
if (
|
|
124754
|
-
target.query =
|
|
124991
|
+
if (relative11.query !== void 0) {
|
|
124992
|
+
target.query = relative11.query;
|
|
124755
124993
|
} else {
|
|
124756
124994
|
target.query = base2.query;
|
|
124757
124995
|
}
|
|
124758
124996
|
} else {
|
|
124759
|
-
if (
|
|
124760
|
-
target.path = removeDotSegments(
|
|
124997
|
+
if (relative11.path[0] === "/") {
|
|
124998
|
+
target.path = removeDotSegments(relative11.path);
|
|
124761
124999
|
} else {
|
|
124762
125000
|
if ((base2.userinfo !== void 0 || base2.host !== void 0 || base2.port !== void 0) && !base2.path) {
|
|
124763
|
-
target.path = "/" +
|
|
125001
|
+
target.path = "/" + relative11.path;
|
|
124764
125002
|
} else if (!base2.path) {
|
|
124765
|
-
target.path =
|
|
125003
|
+
target.path = relative11.path;
|
|
124766
125004
|
} else {
|
|
124767
|
-
target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) +
|
|
125005
|
+
target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) + relative11.path;
|
|
124768
125006
|
}
|
|
124769
125007
|
target.path = removeDotSegments(target.path);
|
|
124770
125008
|
}
|
|
124771
|
-
target.query =
|
|
125009
|
+
target.query = relative11.query;
|
|
124772
125010
|
}
|
|
124773
125011
|
target.userinfo = base2.userinfo;
|
|
124774
125012
|
target.host = base2.host;
|
|
@@ -124776,7 +125014,7 @@ var require_fast_uri = __commonJS({
|
|
|
124776
125014
|
}
|
|
124777
125015
|
target.scheme = base2.scheme;
|
|
124778
125016
|
}
|
|
124779
|
-
target.fragment =
|
|
125017
|
+
target.fragment = relative11.fragment;
|
|
124780
125018
|
return target;
|
|
124781
125019
|
}
|
|
124782
125020
|
function equal(uriA, uriB, options) {
|
|
@@ -128946,7 +129184,7 @@ __export(mcp_exports, {
|
|
|
128946
129184
|
mcpDescribe: () => mcpDescribe,
|
|
128947
129185
|
mcpList: () => mcpList
|
|
128948
129186
|
});
|
|
128949
|
-
import { readFile as
|
|
129187
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
128950
129188
|
function errorDetails(error2) {
|
|
128951
129189
|
return {
|
|
128952
129190
|
message: error2 instanceof Error ? error2.message : "The MCP request failed.",
|
|
@@ -129006,7 +129244,7 @@ async function readInput(options) {
|
|
|
129006
129244
|
}
|
|
129007
129245
|
text6 = Buffer.concat(chunks).toString("utf8");
|
|
129008
129246
|
} else {
|
|
129009
|
-
text6 = await
|
|
129247
|
+
text6 = await readFile7(options.inputFile, "utf8");
|
|
129010
129248
|
}
|
|
129011
129249
|
}
|
|
129012
129250
|
let value;
|
|
@@ -129510,7 +129748,6 @@ var init_open_browser = __esm({
|
|
|
129510
129748
|
import { execFile as execFile6 } from "node:child_process";
|
|
129511
129749
|
import { createHash as createHash29, randomBytes as randomBytes14 } from "node:crypto";
|
|
129512
129750
|
import {
|
|
129513
|
-
appendFileSync as appendFileSync5,
|
|
129514
129751
|
existsSync as existsSync30,
|
|
129515
129752
|
lstatSync as lstatSync13,
|
|
129516
129753
|
mkdirSync as mkdirSync14,
|
|
@@ -129520,7 +129757,7 @@ import {
|
|
|
129520
129757
|
writeFileSync as writeFileSync11
|
|
129521
129758
|
} from "node:fs";
|
|
129522
129759
|
import { homedir as homedir13, hostname as osHostname3 } from "node:os";
|
|
129523
|
-
import { join as join68,
|
|
129760
|
+
import { join as join68, resolve as resolve26, sep as sep12 } from "node:path";
|
|
129524
129761
|
function git3(cwd, args) {
|
|
129525
129762
|
return new Promise((done) => {
|
|
129526
129763
|
try {
|
|
@@ -129637,7 +129874,6 @@ async function probeWorkingCopy(opts) {
|
|
|
129637
129874
|
return "";
|
|
129638
129875
|
}
|
|
129639
129876
|
})();
|
|
129640
|
-
const pulled = opts.pulledCommit ?? null;
|
|
129641
129877
|
return {
|
|
129642
129878
|
machineId: machineId(opts.configDir),
|
|
129643
129879
|
hostname: host.length > 0 ? host : "unknown",
|
|
@@ -129648,8 +129884,8 @@ async function probeWorkingCopy(opts) {
|
|
|
129648
129884
|
headCommit: head3 && COMMIT_SHA.test(head3) ? head3 : null,
|
|
129649
129885
|
oxagenPresent: oxagenPresent(root),
|
|
129650
129886
|
symlinks: symlinkState(root),
|
|
129651
|
-
pulledCommit:
|
|
129652
|
-
event:
|
|
129887
|
+
pulledCommit: null,
|
|
129888
|
+
event: "init",
|
|
129653
129889
|
cliVersion: cliVersion()
|
|
129654
129890
|
};
|
|
129655
129891
|
}
|
|
@@ -129670,35 +129906,6 @@ async function reportWorkingCopy(opts) {
|
|
|
129670
129906
|
return { error: err2 instanceof Error ? err2.message : String(err2) };
|
|
129671
129907
|
}
|
|
129672
129908
|
}
|
|
129673
|
-
function realpathOr(path2) {
|
|
129674
|
-
try {
|
|
129675
|
-
return realpathSync10(path2);
|
|
129676
|
-
} catch {
|
|
129677
|
-
return resolve26(path2);
|
|
129678
|
-
}
|
|
129679
|
-
}
|
|
129680
|
-
async function ensureWorkspaceLinkIgnored(root) {
|
|
129681
|
-
const top = await git3(root, ["rev-parse", "--show-toplevel"]);
|
|
129682
|
-
if (!top) return null;
|
|
129683
|
-
const topDir = resolve26(top);
|
|
129684
|
-
const entry2 = relative10(
|
|
129685
|
-
topDir,
|
|
129686
|
-
join68(realpathOr(root), ".oxagen", "workspace.json")
|
|
129687
|
-
).split(sep12).join("/");
|
|
129688
|
-
if (entry2.startsWith("../")) return null;
|
|
129689
|
-
const rule = await git3(topDir, ["check-ignore", "--no-index", "-v", entry2]);
|
|
129690
|
-
if (rule !== null) return null;
|
|
129691
|
-
const gitignore = join68(resolve26(top), ".gitignore");
|
|
129692
|
-
let existing = "";
|
|
129693
|
-
try {
|
|
129694
|
-
existing = readFileSync31(gitignore, "utf8");
|
|
129695
|
-
} catch {
|
|
129696
|
-
}
|
|
129697
|
-
const prefix = existing.length > 0 && !existing.endsWith("\n") ? "\n" : "";
|
|
129698
|
-
appendFileSync5(gitignore, `${prefix}${entry2}
|
|
129699
|
-
`, "utf8");
|
|
129700
|
-
return gitignore;
|
|
129701
|
-
}
|
|
129702
129909
|
var GIT_TIMEOUT_MS2, REPORT_TIMEOUT_MS, MACHINE_ID_FILE, STELLA_LINKS, COMMIT_SHA;
|
|
129703
129910
|
var init_working_copy = __esm({
|
|
129704
129911
|
"src/lib/working-copy.ts"() {
|
|
@@ -129717,84 +129924,6 @@ var init_working_copy = __esm({
|
|
|
129717
129924
|
}
|
|
129718
129925
|
});
|
|
129719
129926
|
|
|
129720
|
-
// src/commands/workspace-link.ts
|
|
129721
|
-
import { existsSync as existsSync31, mkdirSync as mkdirSync15, readFileSync as readFileSync32 } from "node:fs";
|
|
129722
|
-
import { dirname as dirname37, join as join69 } from "node:path";
|
|
129723
|
-
function workspaceLinkPath(cwd) {
|
|
129724
|
-
return join69(cwd, WORKSPACE_LINK_PATH);
|
|
129725
|
-
}
|
|
129726
|
-
function isRecord10(value) {
|
|
129727
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
129728
|
-
}
|
|
129729
|
-
function stringsWherePresent(value, keys) {
|
|
129730
|
-
return keys.every(
|
|
129731
|
-
(key) => value[key] === void 0 || typeof value[key] === "string"
|
|
129732
|
-
);
|
|
129733
|
-
}
|
|
129734
|
-
function linkProblem(value) {
|
|
129735
|
-
if (!isRecord10(value)) return "it is not a JSON object";
|
|
129736
|
-
if (!stringsWherePresent(value, LINK_STRING_FIELDS))
|
|
129737
|
-
return "an org or workspace field is not a string";
|
|
129738
|
-
if (value.repos !== void 0) {
|
|
129739
|
-
const repos = value.repos;
|
|
129740
|
-
if (!Array.isArray(repos) || !repos.every((r) => isRecord10(r) && typeof r.fullName === "string"))
|
|
129741
|
-
return "`repos` is not a list of repositories";
|
|
129742
|
-
}
|
|
129743
|
-
if (value.pull !== void 0) {
|
|
129744
|
-
const pull2 = value.pull;
|
|
129745
|
-
if (!isRecord10(pull2) || !["commit", "bindingId", "fullName", "pulledAt"].every(
|
|
129746
|
-
(key) => typeof pull2[key] === "string"
|
|
129747
|
-
) || !isRecord10(pull2.files) || !Object.values(pull2.files).every((hash4) => typeof hash4 === "string"))
|
|
129748
|
-
return "`pull` is not the record of a pull";
|
|
129749
|
-
}
|
|
129750
|
-
return null;
|
|
129751
|
-
}
|
|
129752
|
-
function readWorkspaceLink(cwd) {
|
|
129753
|
-
const filePath = workspaceLinkPath(cwd);
|
|
129754
|
-
if (!existsSync31(filePath)) return null;
|
|
129755
|
-
let parsed2;
|
|
129756
|
-
try {
|
|
129757
|
-
parsed2 = JSON.parse(readFileSync32(filePath, "utf8"));
|
|
129758
|
-
} catch (err2) {
|
|
129759
|
-
const detail = err2 instanceof Error ? err2.message : String(err2);
|
|
129760
|
-
process.stderr.write(
|
|
129761
|
-
`Warning: corrupt workspace link at ${filePath}: ${detail}
|
|
129762
|
-
`
|
|
129763
|
-
);
|
|
129764
|
-
return null;
|
|
129765
|
-
}
|
|
129766
|
-
const problem = linkProblem(parsed2);
|
|
129767
|
-
if (problem !== null) {
|
|
129768
|
-
process.stderr.write(
|
|
129769
|
-
`Warning: corrupt workspace link at ${filePath}: ${problem}
|
|
129770
|
-
`
|
|
129771
|
-
);
|
|
129772
|
-
return null;
|
|
129773
|
-
}
|
|
129774
|
-
return parsed2;
|
|
129775
|
-
}
|
|
129776
|
-
function writeWorkspaceLink(cwd, link) {
|
|
129777
|
-
const filePath = workspaceLinkPath(cwd);
|
|
129778
|
-
mkdirSync15(dirname37(filePath), { recursive: true });
|
|
129779
|
-
atomicWriteFileSync(filePath, JSON.stringify(link, null, 2));
|
|
129780
|
-
}
|
|
129781
|
-
var LINK_STRING_FIELDS;
|
|
129782
|
-
var init_workspace_link = __esm({
|
|
129783
|
-
"src/commands/workspace-link.ts"() {
|
|
129784
|
-
init_paths2();
|
|
129785
|
-
init_atomic_write();
|
|
129786
|
-
LINK_STRING_FIELDS = [
|
|
129787
|
-
"orgSlug",
|
|
129788
|
-
"orgId",
|
|
129789
|
-
"orgName",
|
|
129790
|
-
"workspaceSlug",
|
|
129791
|
-
"workspaceId",
|
|
129792
|
-
"workspaceName",
|
|
129793
|
-
"linkedAt"
|
|
129794
|
-
];
|
|
129795
|
-
}
|
|
129796
|
-
});
|
|
129797
|
-
|
|
129798
129927
|
// src/commands/init.ts
|
|
129799
129928
|
var init_exports = {};
|
|
129800
129929
|
__export(init_exports, {
|
|
@@ -129937,7 +130066,7 @@ GitHub connected. Fetching repositories...
|
|
|
129937
130066
|
} catch (err2) {
|
|
129938
130067
|
process.stdout.write(
|
|
129939
130068
|
` Could not list the GitHub App's installations: ${errorMessage3(err2)}
|
|
129940
|
-
|
|
130069
|
+
Re-run \`oxagen init\` to list the repositories again.
|
|
129941
130070
|
`
|
|
129942
130071
|
);
|
|
129943
130072
|
return null;
|
|
@@ -129968,7 +130097,7 @@ GitHub connected. Fetching repositories...
|
|
|
129968
130097
|
});
|
|
129969
130098
|
if (failed5 > 0) {
|
|
129970
130099
|
process.stdout.write(
|
|
129971
|
-
`
|
|
130100
|
+
` Re-run \`oxagen init\` to list the repositories again.
|
|
129972
130101
|
`
|
|
129973
130102
|
);
|
|
129974
130103
|
return null;
|
|
@@ -129992,7 +130121,7 @@ GitHub connected. Fetching repositories...
|
|
|
129992
130121
|
}
|
|
129993
130122
|
return repos;
|
|
129994
130123
|
}
|
|
129995
|
-
async function runWorkspaceLinker(
|
|
130124
|
+
async function runWorkspaceLinker(flags) {
|
|
129996
130125
|
const token = getToken();
|
|
129997
130126
|
if (!token) {
|
|
129998
130127
|
return {
|
|
@@ -130005,25 +130134,20 @@ async function runWorkspaceLinker(root, flags) {
|
|
|
130005
130134
|
Linking workspace...
|
|
130006
130135
|
`);
|
|
130007
130136
|
let account;
|
|
130008
|
-
const
|
|
130009
|
-
const
|
|
130137
|
+
const savedOrg = getOrgId();
|
|
130138
|
+
const savedWorkspace = getWorkspaceId();
|
|
130139
|
+
const saved = savedOrg && savedWorkspace ? { orgSlug: savedOrg, workspaceSlug: savedWorkspace } : null;
|
|
130140
|
+
const namesOtherPair = saved !== null && (flags.org !== void 0 && flags.org !== saved.orgSlug || flags.workspace !== void 0 && flags.workspace !== saved.workspaceSlug);
|
|
130010
130141
|
let relinkedFrom;
|
|
130011
|
-
if (
|
|
130142
|
+
if (saved && !namesOtherPair) {
|
|
130012
130143
|
process.stdout.write(
|
|
130013
|
-
` Already linked: ${
|
|
130144
|
+
` Already linked: ${saved.orgSlug} / ${saved.workspaceSlug}
|
|
130014
130145
|
`
|
|
130015
130146
|
);
|
|
130016
|
-
account =
|
|
130017
|
-
orgId: existing.orgId,
|
|
130018
|
-
orgSlug: existing.orgSlug,
|
|
130019
|
-
orgName: existing.orgName,
|
|
130020
|
-
workspaceId: existing.workspaceId,
|
|
130021
|
-
workspaceSlug: existing.workspaceSlug,
|
|
130022
|
-
workspaceName: existing.workspaceName
|
|
130023
|
-
};
|
|
130147
|
+
account = saved;
|
|
130024
130148
|
} else {
|
|
130025
|
-
const orgSlug = flags.org ??
|
|
130026
|
-
const workspaceSlug3 = flags.workspace ?? (
|
|
130149
|
+
const orgSlug = flags.org ?? saved?.orgSlug;
|
|
130150
|
+
const workspaceSlug3 = flags.workspace ?? (saved && orgSlug === saved.orgSlug ? saved.workspaceSlug : void 0);
|
|
130027
130151
|
try {
|
|
130028
130152
|
account = await resolveLinkedAccount({ orgSlug, workspaceSlug: workspaceSlug3, isTTY });
|
|
130029
130153
|
} catch (err2) {
|
|
@@ -130032,23 +130156,14 @@ Linking workspace...
|
|
|
130032
130156
|
skippedReason: `Workspace picker failed: ${err2 instanceof Error ? err2.message : String(err2)}`
|
|
130033
130157
|
};
|
|
130034
130158
|
}
|
|
130035
|
-
|
|
130159
|
+
writeConfig({
|
|
130036
130160
|
orgSlug: account.orgSlug,
|
|
130037
|
-
|
|
130038
|
-
|
|
130039
|
-
|
|
130040
|
-
|
|
130041
|
-
workspaceName: account.workspaceName,
|
|
130042
|
-
linkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
130043
|
-
};
|
|
130044
|
-
writeWorkspaceLink(root, link);
|
|
130045
|
-
if (existing) {
|
|
130046
|
-
relinkedFrom = {
|
|
130047
|
-
orgSlug: existing.orgSlug,
|
|
130048
|
-
workspaceSlug: existing.workspaceSlug
|
|
130049
|
-
};
|
|
130161
|
+
workspaceSlug: account.workspaceSlug
|
|
130162
|
+
});
|
|
130163
|
+
if (saved) {
|
|
130164
|
+
relinkedFrom = saved;
|
|
130050
130165
|
process.stdout.write(
|
|
130051
|
-
` Relinked: ${account.orgName} / ${account.workspaceName} (was ${
|
|
130166
|
+
` Relinked: ${account.orgName} / ${account.workspaceName} (was ${saved.orgSlug} / ${saved.workspaceSlug})
|
|
130052
130167
|
`
|
|
130053
130168
|
);
|
|
130054
130169
|
} else {
|
|
@@ -130108,23 +130223,19 @@ No GitHub connection found in this workspace.
|
|
|
130108
130223
|
`
|
|
130109
130224
|
);
|
|
130110
130225
|
}
|
|
130111
|
-
const currentLink = readWorkspaceLink(root);
|
|
130112
|
-
if (currentLink && repos) {
|
|
130113
|
-
writeWorkspaceLink(root, { ...currentLink, repos });
|
|
130114
|
-
}
|
|
130115
130226
|
return {
|
|
130116
130227
|
linked: true,
|
|
130117
130228
|
orgSlug: account.orgSlug,
|
|
130118
|
-
orgName: account.orgName,
|
|
130229
|
+
...account.orgName !== void 0 ? { orgName: account.orgName } : {},
|
|
130119
130230
|
workspaceSlug: account.workspaceSlug,
|
|
130120
|
-
workspaceName: account.workspaceName,
|
|
130121
|
-
repos
|
|
130231
|
+
...account.workspaceName !== void 0 ? { workspaceName: account.workspaceName } : {},
|
|
130232
|
+
...repos ? { repos } : {},
|
|
130122
130233
|
...relinkedFrom ? { relinkedFrom } : {}
|
|
130123
130234
|
};
|
|
130124
130235
|
}
|
|
130125
130236
|
function formatInitSummary(result2) {
|
|
130126
130237
|
const lines = [];
|
|
130127
|
-
lines.push(`
|
|
130238
|
+
lines.push(`Directory: ${result2.projectRoot}`);
|
|
130128
130239
|
if (result2.workspaceLink === null) {
|
|
130129
130240
|
lines.push(" Skipped (--no-link).");
|
|
130130
130241
|
return lines.join("\n");
|
|
@@ -130136,7 +130247,7 @@ function formatInitSummary(result2) {
|
|
|
130136
130247
|
);
|
|
130137
130248
|
if (wl.relinkedFrom) {
|
|
130138
130249
|
lines.push(
|
|
130139
|
-
` Replaced
|
|
130250
|
+
` Replaced ${wl.relinkedFrom.orgSlug} / ${wl.relinkedFrom.workspaceSlug}.`
|
|
130140
130251
|
);
|
|
130141
130252
|
}
|
|
130142
130253
|
if (wl.repos && wl.repos.length > 0) {
|
|
@@ -130147,9 +130258,6 @@ function formatInitSummary(result2) {
|
|
|
130147
130258
|
} else if (result2.workspaceLink.skippedReason) {
|
|
130148
130259
|
lines.push(` ${result2.workspaceLink.skippedReason}`);
|
|
130149
130260
|
}
|
|
130150
|
-
if (result2.gitignoreUpdated) {
|
|
130151
|
-
lines.push(` Added .oxagen/workspace.json to ${result2.gitignoreUpdated}.`);
|
|
130152
|
-
}
|
|
130153
130261
|
if (result2.workingCopy && "workingCopyId" in result2.workingCopy) {
|
|
130154
130262
|
lines.push(
|
|
130155
130263
|
` Reported this directory to Oxagen (${result2.workingCopy.workingCopyId}).`
|
|
@@ -130163,48 +130271,28 @@ async function runInit(opts) {
|
|
|
130163
130271
|
await opts.onProgress?.(event);
|
|
130164
130272
|
};
|
|
130165
130273
|
let workspaceLink = null;
|
|
130166
|
-
let gitignoreUpdated = null;
|
|
130167
130274
|
let workingCopy = null;
|
|
130168
130275
|
if (!opts.noLink) {
|
|
130169
130276
|
await emit({ phase: "link", status: "start" });
|
|
130170
|
-
workspaceLink = await runWorkspaceLinker(
|
|
130277
|
+
workspaceLink = await runWorkspaceLinker({
|
|
130171
130278
|
org: opts.org,
|
|
130172
130279
|
workspace: opts.workspace
|
|
130173
130280
|
});
|
|
130174
130281
|
await emit({ phase: "link", status: "done" });
|
|
130175
130282
|
}
|
|
130176
|
-
if (workspaceLink?.linked) {
|
|
130177
|
-
|
|
130178
|
-
|
|
130179
|
-
|
|
130283
|
+
if (workspaceLink?.linked && workspaceLink.orgSlug !== void 0 && workspaceLink.workspaceSlug !== void 0) {
|
|
130284
|
+
workingCopy = await reportWorkingCopy({
|
|
130285
|
+
root,
|
|
130286
|
+
scope: { org: workspaceLink.orgSlug, ws: workspaceLink.workspaceSlug }
|
|
130287
|
+
});
|
|
130288
|
+
if ("error" in workingCopy) {
|
|
130180
130289
|
process.stderr.write(
|
|
130181
|
-
`Warning: could not
|
|
130290
|
+
`Warning: could not report this directory to Oxagen: ${workingCopy.error}
|
|
130182
130291
|
`
|
|
130183
130292
|
);
|
|
130184
130293
|
}
|
|
130185
|
-
const link = readWorkspaceLink(root);
|
|
130186
|
-
if (link) {
|
|
130187
|
-
workingCopy = await reportWorkingCopy({
|
|
130188
|
-
root,
|
|
130189
|
-
scope: { org: link.orgSlug, ws: link.workspaceSlug },
|
|
130190
|
-
event: "init",
|
|
130191
|
-
pulledCommit: link.pull?.commit ?? null
|
|
130192
|
-
});
|
|
130193
|
-
if ("error" in workingCopy) {
|
|
130194
|
-
process.stderr.write(
|
|
130195
|
-
`Warning: could not report this directory to Oxagen: ${workingCopy.error}
|
|
130196
|
-
`
|
|
130197
|
-
);
|
|
130198
|
-
}
|
|
130199
|
-
}
|
|
130200
130294
|
}
|
|
130201
|
-
return {
|
|
130202
|
-
projectRoot: root,
|
|
130203
|
-
workspaceLinkPath: workspaceLinkPath(root),
|
|
130204
|
-
workspaceLink,
|
|
130205
|
-
gitignoreUpdated,
|
|
130206
|
-
workingCopy
|
|
130207
|
-
};
|
|
130295
|
+
return { projectRoot: root, workspaceLink, workingCopy };
|
|
130208
130296
|
}
|
|
130209
130297
|
function divertStdoutToStderr() {
|
|
130210
130298
|
const original = process.stdout.write;
|
|
@@ -130258,7 +130346,6 @@ var init_init = __esm({
|
|
|
130258
130346
|
init_config();
|
|
130259
130347
|
init_linker();
|
|
130260
130348
|
init_working_copy();
|
|
130261
|
-
init_workspace_link();
|
|
130262
130349
|
init_api();
|
|
130263
130350
|
init_output();
|
|
130264
130351
|
GITHUB_POLL = {
|
|
@@ -130268,430 +130355,6 @@ var init_init = __esm({
|
|
|
130268
130355
|
}
|
|
130269
130356
|
});
|
|
130270
130357
|
|
|
130271
|
-
// src/commands/pull.ts
|
|
130272
|
-
var pull_exports = {};
|
|
130273
|
-
__export(pull_exports, {
|
|
130274
|
-
applyPlan: () => applyPlan,
|
|
130275
|
-
checkSteeringPath: () => checkSteeringPath,
|
|
130276
|
-
findLinkedRoot: () => findLinkedRoot,
|
|
130277
|
-
fsReader: () => fsReader,
|
|
130278
|
-
isPublishedSteering: () => isPublishedSteering,
|
|
130279
|
-
planPull: () => planPull,
|
|
130280
|
-
pull: () => pull,
|
|
130281
|
-
recordPull: () => recordPull,
|
|
130282
|
-
sha256: () => sha2563
|
|
130283
|
-
});
|
|
130284
|
-
import { createHash as createHash30 } from "node:crypto";
|
|
130285
|
-
import {
|
|
130286
|
-
existsSync as existsSync32,
|
|
130287
|
-
lstatSync as lstatSync14,
|
|
130288
|
-
mkdirSync as mkdirSync16,
|
|
130289
|
-
readFileSync as readFileSync33,
|
|
130290
|
-
readdirSync as readdirSync19,
|
|
130291
|
-
realpathSync as realpathSync11,
|
|
130292
|
-
rmSync as rmSync14,
|
|
130293
|
-
rmdirSync as rmdirSync7
|
|
130294
|
-
} from "node:fs";
|
|
130295
|
-
import {
|
|
130296
|
-
dirname as dirname38,
|
|
130297
|
-
isAbsolute as isAbsolute19,
|
|
130298
|
-
join as join70,
|
|
130299
|
-
parse as parsePath,
|
|
130300
|
-
posix as posix8,
|
|
130301
|
-
sep as sep13
|
|
130302
|
-
} from "node:path";
|
|
130303
|
-
function isPublishedSteering(value) {
|
|
130304
|
-
if (typeof value !== "object" || value === null) return false;
|
|
130305
|
-
const answer = value;
|
|
130306
|
-
return typeof answer.bindingId === "string" && answer.bindingId.length > 0 && typeof answer.fullName === "string" && typeof answer.productionBranch === "string" && (answer.head === null || typeof answer.head === "string") && Array.isArray(answer.files) && answer.files.every(
|
|
130307
|
-
(file) => typeof file === "object" && file !== null && typeof file.path === "string" && typeof file.content === "string"
|
|
130308
|
-
);
|
|
130309
|
-
}
|
|
130310
|
-
function checkSteeringPath(path2) {
|
|
130311
|
-
if (typeof path2 !== "string" || path2.length === 0) {
|
|
130312
|
-
return { ok: false, reason: "empty path" };
|
|
130313
|
-
}
|
|
130314
|
-
if (path2.includes("\0")) return { ok: false, reason: "contains a NUL byte" };
|
|
130315
|
-
if (path2.includes("\\")) {
|
|
130316
|
-
return { ok: false, reason: "contains a backslash" };
|
|
130317
|
-
}
|
|
130318
|
-
if (posix8.isAbsolute(path2) || isAbsolute19(path2) || /^[A-Za-z]:/.test(path2)) {
|
|
130319
|
-
return { ok: false, reason: "absolute path" };
|
|
130320
|
-
}
|
|
130321
|
-
const normalized = posix8.normalize(path2);
|
|
130322
|
-
if (normalized !== path2 || normalized.split("/").some((s2) => s2 === ".." || s2 === ".")) {
|
|
130323
|
-
return { ok: false, reason: "has a . or .. part or a double slash" };
|
|
130324
|
-
}
|
|
130325
|
-
if (!normalized.startsWith(`${OXAGEN_DIR}/`)) {
|
|
130326
|
-
return { ok: false, reason: "outside .oxagen/" };
|
|
130327
|
-
}
|
|
130328
|
-
if (normalized === LINK_PATH) {
|
|
130329
|
-
return { ok: false, reason: "the machine's own workspace link" };
|
|
130330
|
-
}
|
|
130331
|
-
return { ok: true, path: normalized };
|
|
130332
|
-
}
|
|
130333
|
-
function sha2563(content) {
|
|
130334
|
-
return createHash30("sha256").update(content).digest("hex");
|
|
130335
|
-
}
|
|
130336
|
-
function planPull(input) {
|
|
130337
|
-
const base2 = input.base ?? {};
|
|
130338
|
-
const force = input.force === true;
|
|
130339
|
-
const entries2 = [];
|
|
130340
|
-
const conflicts = [];
|
|
130341
|
-
const rejected2 = [];
|
|
130342
|
-
const writes = [];
|
|
130343
|
-
const deletes = [];
|
|
130344
|
-
const manifest = {};
|
|
130345
|
-
const published = /* @__PURE__ */ new Map();
|
|
130346
|
-
for (const file of input.published) {
|
|
130347
|
-
const checked2 = checkSteeringPath(file.path);
|
|
130348
|
-
if (!checked2.ok) {
|
|
130349
|
-
rejected2.push({ path: String(file.path), reason: checked2.reason });
|
|
130350
|
-
continue;
|
|
130351
|
-
}
|
|
130352
|
-
if (published.has(checked2.path)) {
|
|
130353
|
-
rejected2.push({ path: checked2.path, reason: "published twice" });
|
|
130354
|
-
continue;
|
|
130355
|
-
}
|
|
130356
|
-
published.set(checked2.path, file.content);
|
|
130357
|
-
}
|
|
130358
|
-
for (const [path2, content] of [...published].sort(
|
|
130359
|
-
([a], [b3]) => a < b3 ? -1 : a > b3 ? 1 : 0
|
|
130360
|
-
)) {
|
|
130361
|
-
const want = sha2563(content);
|
|
130362
|
-
manifest[path2] = want;
|
|
130363
|
-
const local = input.readLocal(path2);
|
|
130364
|
-
if (local === null) {
|
|
130365
|
-
entries2.push({ path: path2, action: "create" });
|
|
130366
|
-
writes.push({ path: path2, content });
|
|
130367
|
-
continue;
|
|
130368
|
-
}
|
|
130369
|
-
const have = sha2563(local);
|
|
130370
|
-
if (have === want) {
|
|
130371
|
-
entries2.push({ path: path2, action: "unchanged" });
|
|
130372
|
-
} else if (base2[path2] === have || force) {
|
|
130373
|
-
entries2.push({ path: path2, action: "update" });
|
|
130374
|
-
writes.push({ path: path2, content });
|
|
130375
|
-
} else {
|
|
130376
|
-
entries2.push({ path: path2, action: "conflict", wants: "update" });
|
|
130377
|
-
conflicts.push(path2);
|
|
130378
|
-
}
|
|
130379
|
-
}
|
|
130380
|
-
const gone = Object.keys(base2).filter((p) => !published.has(p)).sort();
|
|
130381
|
-
for (const path2 of gone) {
|
|
130382
|
-
if (!checkSteeringPath(path2).ok) continue;
|
|
130383
|
-
const local = input.readLocal(path2);
|
|
130384
|
-
if (local === null) continue;
|
|
130385
|
-
if (sha2563(local) === base2[path2] || force) {
|
|
130386
|
-
entries2.push({ path: path2, action: "delete" });
|
|
130387
|
-
deletes.push(path2);
|
|
130388
|
-
} else {
|
|
130389
|
-
entries2.push({ path: path2, action: "conflict", wants: "delete" });
|
|
130390
|
-
conflicts.push(path2);
|
|
130391
|
-
}
|
|
130392
|
-
}
|
|
130393
|
-
return {
|
|
130394
|
-
entries: entries2,
|
|
130395
|
-
conflicts: force ? [] : conflicts,
|
|
130396
|
-
rejected: rejected2,
|
|
130397
|
-
writes,
|
|
130398
|
-
deletes,
|
|
130399
|
-
manifest
|
|
130400
|
-
};
|
|
130401
|
-
}
|
|
130402
|
-
function findLinkedRoot(start) {
|
|
130403
|
-
let dir = start;
|
|
130404
|
-
const { root } = parsePath(start);
|
|
130405
|
-
for (; ; ) {
|
|
130406
|
-
try {
|
|
130407
|
-
if (lstatSync14(workspaceLinkPath(dir)).isFile()) return dir;
|
|
130408
|
-
} catch {
|
|
130409
|
-
}
|
|
130410
|
-
if (dir === root) return null;
|
|
130411
|
-
const parent = dirname38(dir);
|
|
130412
|
-
if (parent === dir) return null;
|
|
130413
|
-
dir = parent;
|
|
130414
|
-
}
|
|
130415
|
-
}
|
|
130416
|
-
function fsReader(root, strict = false) {
|
|
130417
|
-
return (path2) => {
|
|
130418
|
-
if (strict) assertInsideOxagen(root, path2);
|
|
130419
|
-
const abs = join70(root, ...path2.split("/"));
|
|
130420
|
-
try {
|
|
130421
|
-
const st = lstatSync14(abs);
|
|
130422
|
-
if (!st.isFile()) return Buffer.from(`\0not-a-file:${abs}`);
|
|
130423
|
-
return readFileSync33(abs);
|
|
130424
|
-
} catch (error2) {
|
|
130425
|
-
if (!strict || error2 instanceof Error && "code" in error2 && error2.code === "ENOENT")
|
|
130426
|
-
return null;
|
|
130427
|
-
throw error2;
|
|
130428
|
-
}
|
|
130429
|
-
};
|
|
130430
|
-
}
|
|
130431
|
-
function assertInsideOxagen(root, path2) {
|
|
130432
|
-
const oxagenAbs = join70(root, OXAGEN_DIR);
|
|
130433
|
-
if (existsSync32(oxagenAbs) && lstatSync14(oxagenAbs).isSymbolicLink()) {
|
|
130434
|
-
throw new Error(
|
|
130435
|
-
".oxagen is a symlink. Use a local directory for pulled steering."
|
|
130436
|
-
);
|
|
130437
|
-
}
|
|
130438
|
-
let oxagenReal;
|
|
130439
|
-
try {
|
|
130440
|
-
oxagenReal = realpathSync11(oxagenAbs);
|
|
130441
|
-
} catch {
|
|
130442
|
-
return;
|
|
130443
|
-
}
|
|
130444
|
-
const abs = join70(root, ...path2.split("/"));
|
|
130445
|
-
try {
|
|
130446
|
-
if (lstatSync14(abs).isSymbolicLink()) {
|
|
130447
|
-
throw new Error(
|
|
130448
|
-
`${path2} is a symlink, and pull does not write through one`
|
|
130449
|
-
);
|
|
130450
|
-
}
|
|
130451
|
-
} catch (err2) {
|
|
130452
|
-
if (err2.code !== "ENOENT") throw err2;
|
|
130453
|
-
}
|
|
130454
|
-
let dir = dirname38(abs);
|
|
130455
|
-
for (; ; ) {
|
|
130456
|
-
let real = null;
|
|
130457
|
-
try {
|
|
130458
|
-
real = realpathSync11(dir);
|
|
130459
|
-
} catch {
|
|
130460
|
-
real = null;
|
|
130461
|
-
}
|
|
130462
|
-
if (real !== null) {
|
|
130463
|
-
if (real !== oxagenReal && !real.startsWith(oxagenReal + sep13)) {
|
|
130464
|
-
throw new Error(`${path2} resolves outside .oxagen/`);
|
|
130465
|
-
}
|
|
130466
|
-
return;
|
|
130467
|
-
}
|
|
130468
|
-
const parent = dirname38(dir);
|
|
130469
|
-
if (parent === dir) return;
|
|
130470
|
-
dir = parent;
|
|
130471
|
-
}
|
|
130472
|
-
}
|
|
130473
|
-
function pruneEmptyDirs(root, path2) {
|
|
130474
|
-
const stop = join70(root, OXAGEN_DIR);
|
|
130475
|
-
let dir = dirname38(join70(root, ...path2.split("/")));
|
|
130476
|
-
while (dir.startsWith(stop + sep13)) {
|
|
130477
|
-
try {
|
|
130478
|
-
if (readdirSync19(dir).length > 0) return;
|
|
130479
|
-
rmdirSync7(dir);
|
|
130480
|
-
} catch {
|
|
130481
|
-
return;
|
|
130482
|
-
}
|
|
130483
|
-
dir = dirname38(dir);
|
|
130484
|
-
}
|
|
130485
|
-
}
|
|
130486
|
-
function applyPlan(root, plan, deadline) {
|
|
130487
|
-
const checkDeadline = () => {
|
|
130488
|
-
if (deadline !== void 0 && Date.now() >= deadline) {
|
|
130489
|
-
throw new Error(
|
|
130490
|
-
"The steering pull ran out of time. Run `oxagen pull` again."
|
|
130491
|
-
);
|
|
130492
|
-
}
|
|
130493
|
-
};
|
|
130494
|
-
checkDeadline();
|
|
130495
|
-
for (const w of plan.writes) assertInsideOxagen(root, w.path);
|
|
130496
|
-
for (const d of plan.deletes) assertInsideOxagen(root, d);
|
|
130497
|
-
for (const w of plan.writes) {
|
|
130498
|
-
checkDeadline();
|
|
130499
|
-
const abs = join70(root, ...w.path.split("/"));
|
|
130500
|
-
mkdirSync16(dirname38(abs), { recursive: true });
|
|
130501
|
-
atomicWriteFileSync(abs, w.content);
|
|
130502
|
-
}
|
|
130503
|
-
for (const d of plan.deletes) {
|
|
130504
|
-
checkDeadline();
|
|
130505
|
-
rmSync14(join70(root, ...d.split("/")), { force: true });
|
|
130506
|
-
pruneEmptyDirs(root, d);
|
|
130507
|
-
}
|
|
130508
|
-
}
|
|
130509
|
-
function recordPull(root, link, published, plan) {
|
|
130510
|
-
if (published.head === null)
|
|
130511
|
-
throw new Error("The steering publication has no commit.");
|
|
130512
|
-
const current = readWorkspaceLink(root);
|
|
130513
|
-
if (!current || current.orgSlug !== link.orgSlug || current.workspaceSlug !== link.workspaceSlug) {
|
|
130514
|
-
throw new Error("The workspace link changed. Run `oxagen pull` again.");
|
|
130515
|
-
}
|
|
130516
|
-
writeWorkspaceLink(root, {
|
|
130517
|
-
...current,
|
|
130518
|
-
pull: {
|
|
130519
|
-
commit: published.head,
|
|
130520
|
-
bindingId: published.bindingId,
|
|
130521
|
-
fullName: published.fullName,
|
|
130522
|
-
pulledAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
130523
|
-
files: plan.manifest
|
|
130524
|
-
}
|
|
130525
|
-
});
|
|
130526
|
-
}
|
|
130527
|
-
function short3(sha2) {
|
|
130528
|
-
return sha2.slice(0, 7);
|
|
130529
|
-
}
|
|
130530
|
-
async function pull(opts = {}, writer = stdoutWriter, cwd = process.cwd()) {
|
|
130531
|
-
const out = createOutput({ json: opts.json }, writer);
|
|
130532
|
-
if (opts.binding !== void 0 && !BINDING_ID.test(opts.binding)) {
|
|
130533
|
-
out.error(
|
|
130534
|
-
`--binding takes a repository binding id (rpb_\u2026), not "${opts.binding}".`,
|
|
130535
|
-
"bad_argument"
|
|
130536
|
-
);
|
|
130537
|
-
process.exitCode = 2;
|
|
130538
|
-
return;
|
|
130539
|
-
}
|
|
130540
|
-
const root = findLinkedRoot(cwd);
|
|
130541
|
-
const link = root ? readWorkspaceLink(root) : null;
|
|
130542
|
-
if (!root || !link?.orgSlug || !link.workspaceSlug) {
|
|
130543
|
-
out.error(NOT_LINKED, "not_linked");
|
|
130544
|
-
return;
|
|
130545
|
-
}
|
|
130546
|
-
const scope = { org: link.orgSlug, ws: link.workspaceSlug };
|
|
130547
|
-
let answer;
|
|
130548
|
-
try {
|
|
130549
|
-
answer = await apiPostOrThrow(
|
|
130550
|
-
"context/steering/published",
|
|
130551
|
-
opts.binding ? { bindingId: opts.binding } : {},
|
|
130552
|
-
scope
|
|
130553
|
-
);
|
|
130554
|
-
} catch (err2) {
|
|
130555
|
-
out.error(err2, "api_error");
|
|
130556
|
-
return;
|
|
130557
|
-
}
|
|
130558
|
-
if (!isPublishedSteering(answer)) {
|
|
130559
|
-
out.error(
|
|
130560
|
-
"Oxagen's answer for the published steering is not in the shape this CLI reads. Nothing was written. Update the CLI and pull again.",
|
|
130561
|
-
"bad_answer"
|
|
130562
|
-
);
|
|
130563
|
-
return;
|
|
130564
|
-
}
|
|
130565
|
-
const published = answer;
|
|
130566
|
-
const source = published.fullName;
|
|
130567
|
-
if (published.head === null) {
|
|
130568
|
-
out.error(
|
|
130569
|
-
`The production branch ${published.productionBranch} of ${source} is gone, so nothing is published to pull. Set the production branch on the Repositories page.`,
|
|
130570
|
-
"branch_gone"
|
|
130571
|
-
);
|
|
130572
|
-
return;
|
|
130573
|
-
}
|
|
130574
|
-
const head3 = published.head;
|
|
130575
|
-
const at2 = `${source}@${short3(head3)} (${published.productionBranch})`;
|
|
130576
|
-
const plan = planPull({
|
|
130577
|
-
published: published.files,
|
|
130578
|
-
readLocal: fsReader(root),
|
|
130579
|
-
base: link.pull?.files,
|
|
130580
|
-
force: opts.force
|
|
130581
|
-
});
|
|
130582
|
-
const created = plan.entries.filter((e) => e.action === "create").map((e) => e.path);
|
|
130583
|
-
const updated = plan.entries.filter((e) => e.action === "update").map((e) => e.path);
|
|
130584
|
-
const deleted = plan.entries.filter((e) => e.action === "delete").map((e) => e.path);
|
|
130585
|
-
const unchanged = plan.entries.filter((e) => e.action === "unchanged").length;
|
|
130586
|
-
const summary = {
|
|
130587
|
-
projectRoot: root,
|
|
130588
|
-
repository: published.fullName,
|
|
130589
|
-
bindingId: published.bindingId,
|
|
130590
|
-
productionBranch: published.productionBranch,
|
|
130591
|
-
head: head3,
|
|
130592
|
-
created,
|
|
130593
|
-
updated,
|
|
130594
|
-
deleted,
|
|
130595
|
-
unchanged,
|
|
130596
|
-
conflicts: plan.conflicts,
|
|
130597
|
-
rejected: plan.rejected
|
|
130598
|
-
};
|
|
130599
|
-
if (plan.rejected.length > 0) {
|
|
130600
|
-
const list2 = plan.rejected.map((r) => `${r.path} (${r.reason})`).join(", ");
|
|
130601
|
-
if (out.isJson) {
|
|
130602
|
-
out.data({ status: "refused", refusal: "unsafe_paths", ...summary });
|
|
130603
|
-
}
|
|
130604
|
-
out.error(
|
|
130605
|
-
`Refused: ${source} publishes paths pull will not write: ${list2}. Nothing was written.`,
|
|
130606
|
-
"unsafe_paths"
|
|
130607
|
-
);
|
|
130608
|
-
return;
|
|
130609
|
-
}
|
|
130610
|
-
if (plan.conflicts.length > 0) {
|
|
130611
|
-
if (out.isJson) {
|
|
130612
|
-
out.data({ status: "refused", refusal: "conflicts", ...summary });
|
|
130613
|
-
} else {
|
|
130614
|
-
for (const path2 of plan.conflicts) writer.write(`conflict ${path2}`);
|
|
130615
|
-
}
|
|
130616
|
-
out.error(
|
|
130617
|
-
`Refused: ${plan.conflicts.length} file${plan.conflicts.length === 1 ? " was" : "s were"} edited here and differ from ${at2}. Nothing was written. Move your edits aside, or run \`oxagen pull --force\` to overwrite them.`,
|
|
130618
|
-
"conflicts"
|
|
130619
|
-
);
|
|
130620
|
-
return;
|
|
130621
|
-
}
|
|
130622
|
-
const changes = created.length + updated.length + deleted.length;
|
|
130623
|
-
if (opts.dryRun) {
|
|
130624
|
-
if (out.isJson) {
|
|
130625
|
-
out.data({ status: "dry_run", ...summary });
|
|
130626
|
-
return;
|
|
130627
|
-
}
|
|
130628
|
-
for (const p of created) writer.write(`would create ${p}`);
|
|
130629
|
-
for (const p of updated) writer.write(`would update ${p}`);
|
|
130630
|
-
for (const p of deleted) writer.write(`would delete ${p}`);
|
|
130631
|
-
writer.write(
|
|
130632
|
-
changes === 0 ? `Dry run: already up to date with ${at2}.` : `Dry run: would pull ${plural3(created.length + updated.length, "file", "files")} and delete ${deleted.length} from ${at2}. Nothing was written.`
|
|
130633
|
-
);
|
|
130634
|
-
return;
|
|
130635
|
-
}
|
|
130636
|
-
try {
|
|
130637
|
-
applyPlan(root, plan);
|
|
130638
|
-
} catch (err2) {
|
|
130639
|
-
out.error(
|
|
130640
|
-
`Pull stopped: ${err2 instanceof Error ? err2.message : String(err2)}`,
|
|
130641
|
-
"write_failed"
|
|
130642
|
-
);
|
|
130643
|
-
return;
|
|
130644
|
-
}
|
|
130645
|
-
recordPull(root, link, published, plan);
|
|
130646
|
-
const workingCopy = await reportWorkingCopy({
|
|
130647
|
-
root,
|
|
130648
|
-
scope,
|
|
130649
|
-
event: "pull",
|
|
130650
|
-
pulledCommit: head3
|
|
130651
|
-
});
|
|
130652
|
-
if ("error" in workingCopy) {
|
|
130653
|
-
out.warn(
|
|
130654
|
-
`Warning: could not report this directory to Oxagen: ${workingCopy.error}`
|
|
130655
|
-
);
|
|
130656
|
-
}
|
|
130657
|
-
if (out.isJson) {
|
|
130658
|
-
out.data({
|
|
130659
|
-
status: changes === 0 ? "up_to_date" : "pulled",
|
|
130660
|
-
...summary,
|
|
130661
|
-
workingCopy
|
|
130662
|
-
});
|
|
130663
|
-
return;
|
|
130664
|
-
}
|
|
130665
|
-
for (const p of created) writer.write(`created ${p}`);
|
|
130666
|
-
for (const p of updated) writer.write(`updated ${p}`);
|
|
130667
|
-
for (const p of deleted) writer.write(`deleted ${p}`);
|
|
130668
|
-
if (changes === 0) {
|
|
130669
|
-
writer.write(`Already up to date with ${at2}.`);
|
|
130670
|
-
return;
|
|
130671
|
-
}
|
|
130672
|
-
const deletedNote = deleted.length > 0 ? `, deleted ${deleted.length}` : "";
|
|
130673
|
-
writer.write(
|
|
130674
|
-
`Pulled ${plural3(created.length + updated.length, "file", "files")} from ${at2}${deletedNote}.`
|
|
130675
|
-
);
|
|
130676
|
-
}
|
|
130677
|
-
var OXAGEN_DIR, LINK_PATH, NOT_LINKED, BINDING_ID;
|
|
130678
|
-
var init_pull = __esm({
|
|
130679
|
-
"src/commands/pull.ts"() {
|
|
130680
|
-
init_paths2();
|
|
130681
|
-
init_api();
|
|
130682
|
-
init_atomic_write();
|
|
130683
|
-
init_capture_writer();
|
|
130684
|
-
init_output();
|
|
130685
|
-
init_working_copy();
|
|
130686
|
-
init_workspace_link();
|
|
130687
|
-
init_steering_findings();
|
|
130688
|
-
OXAGEN_DIR = ".oxagen";
|
|
130689
|
-
LINK_PATH = WORKSPACE_LINK_PATH;
|
|
130690
|
-
NOT_LINKED = "This directory is not linked to a workspace. Run `oxagen init --org <org> --workspace <workspace>` first.";
|
|
130691
|
-
BINDING_ID = /^rpb_[0-9A-Za-z]+$/;
|
|
130692
|
-
}
|
|
130693
|
-
});
|
|
130694
|
-
|
|
130695
130358
|
// ../../packages/mcp-studio/src/not-built.ts
|
|
130696
130359
|
var NotBuiltError;
|
|
130697
130360
|
var init_not_built = __esm({
|
|
@@ -133112,7 +132775,7 @@ var init_local_discovery_envelope = __esm({
|
|
|
133112
132775
|
function messageOf5(error2) {
|
|
133113
132776
|
return error2 instanceof Error ? error2.message : String(error2);
|
|
133114
132777
|
}
|
|
133115
|
-
function
|
|
132778
|
+
function isRecord10(value) {
|
|
133116
132779
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
133117
132780
|
}
|
|
133118
132781
|
function isList(value) {
|
|
@@ -133126,7 +132789,7 @@ function jsonEqual(a, b3) {
|
|
|
133126
132789
|
if (Array.isArray(a)) {
|
|
133127
132790
|
return Array.isArray(b3) && a.length === b3.length && a.every((item, index) => jsonEqual(item, b3[index]));
|
|
133128
132791
|
}
|
|
133129
|
-
if (
|
|
132792
|
+
if (isRecord10(a) && isRecord10(b3)) {
|
|
133130
132793
|
const keys = definedKeys(a);
|
|
133131
132794
|
return keys.length === definedKeys(b3).length && keys.every((key) => Object.hasOwn(b3, key) && jsonEqual(a[key], b3[key]));
|
|
133132
132795
|
}
|
|
@@ -133138,7 +132801,7 @@ function utf8Length(text6) {
|
|
|
133138
132801
|
function valueAt2(value, path2) {
|
|
133139
132802
|
let current = value;
|
|
133140
132803
|
for (const step of path2.split(".")) {
|
|
133141
|
-
if (step.endsWith("[]") || !
|
|
132804
|
+
if (step.endsWith("[]") || !isRecord10(current) || !Object.hasOwn(current, step))
|
|
133142
132805
|
return void 0;
|
|
133143
132806
|
current = current[step];
|
|
133144
132807
|
}
|
|
@@ -133146,9 +132809,9 @@ function valueAt2(value, path2) {
|
|
|
133146
132809
|
}
|
|
133147
132810
|
function withValueAt(value, path2, replacement) {
|
|
133148
132811
|
const [step, ...rest] = path2.split(".");
|
|
133149
|
-
if (step === void 0 || !
|
|
132812
|
+
if (step === void 0 || !isRecord10(value)) return value;
|
|
133150
132813
|
const inner = Object.hasOwn(value, step) ? value[step] : void 0;
|
|
133151
|
-
if (rest.length > 0 && !
|
|
132814
|
+
if (rest.length > 0 && !isRecord10(inner)) return value;
|
|
133152
132815
|
const next = rest.length === 0 ? replacement : withValueAt(inner, rest.join("."), replacement);
|
|
133153
132816
|
return { ...value, [step]: next };
|
|
133154
132817
|
}
|
|
@@ -142180,13 +141843,13 @@ var require_path = __commonJS({
|
|
|
142180
141843
|
"../../node_modules/.pnpm/@protobufjs+path@1.1.2/node_modules/@protobufjs/path/index.js"(exports) {
|
|
142181
141844
|
"use strict";
|
|
142182
141845
|
var path2 = exports;
|
|
142183
|
-
var
|
|
141846
|
+
var isAbsolute20 = (
|
|
142184
141847
|
/**
|
|
142185
141848
|
* Tests if the specified path is absolute.
|
|
142186
141849
|
* @param {string} path Path to test
|
|
142187
141850
|
* @returns {boolean} `true` if path is absolute
|
|
142188
141851
|
*/
|
|
142189
|
-
path2.isAbsolute = function
|
|
141852
|
+
path2.isAbsolute = function isAbsolute21(path3) {
|
|
142190
141853
|
return /^(?:\/|\w+:)/.test(path3);
|
|
142191
141854
|
}
|
|
142192
141855
|
);
|
|
@@ -142198,7 +141861,7 @@ var require_path = __commonJS({
|
|
|
142198
141861
|
*/
|
|
142199
141862
|
path2.normalize = function normalize5(path3) {
|
|
142200
141863
|
path3 = path3.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
|
|
142201
|
-
var parts = path3.split("/"), absolute =
|
|
141864
|
+
var parts = path3.split("/"), absolute = isAbsolute20(path3), prefix = "";
|
|
142202
141865
|
if (absolute)
|
|
142203
141866
|
prefix = parts.shift() + "/";
|
|
142204
141867
|
for (var i2 = 0; i2 < parts.length; ) {
|
|
@@ -142220,7 +141883,7 @@ var require_path = __commonJS({
|
|
|
142220
141883
|
path2.resolve = function resolve29(originPath, includePath, alreadyNormalized) {
|
|
142221
141884
|
if (!alreadyNormalized)
|
|
142222
141885
|
includePath = normalize4(includePath);
|
|
142223
|
-
if (
|
|
141886
|
+
if (isAbsolute20(includePath))
|
|
142224
141887
|
return includePath;
|
|
142225
141888
|
if (!alreadyNormalized)
|
|
142226
141889
|
originPath = normalize4(originPath);
|
|
@@ -146548,8 +146211,8 @@ function doubleText(value) {
|
|
|
146548
146211
|
if (value === Infinity) return "inf";
|
|
146549
146212
|
if (value === -Infinity) return "-inf";
|
|
146550
146213
|
if (Object.is(value, -0)) return "-0";
|
|
146551
|
-
const
|
|
146552
|
-
return Number(
|
|
146214
|
+
const short4 = formatG(value, 15);
|
|
146215
|
+
return Number(short4) === value ? short4 : formatG(value, 17);
|
|
146553
146216
|
}
|
|
146554
146217
|
function floatText(value) {
|
|
146555
146218
|
const float = toFloat32(value);
|
|
@@ -146557,8 +146220,8 @@ function floatText(value) {
|
|
|
146557
146220
|
if (float === Infinity) return "inf";
|
|
146558
146221
|
if (float === -Infinity) return "-inf";
|
|
146559
146222
|
if (Object.is(float, -0)) return "-0";
|
|
146560
|
-
const
|
|
146561
|
-
return Math.fround(Number(
|
|
146223
|
+
const short4 = formatG(float, 6);
|
|
146224
|
+
return Math.fround(Number(short4)) === float ? short4 : formatG(float, 9);
|
|
146562
146225
|
}
|
|
146563
146226
|
function toFloat32(value) {
|
|
146564
146227
|
if (value > FLOAT_MAX) {
|
|
@@ -149023,7 +148686,7 @@ var init_lock2 = __esm({
|
|
|
149023
148686
|
|
|
149024
148687
|
// ../../packages/mcp-studio/src/compile/json-schema.ts
|
|
149025
148688
|
function propertiesOf(schema) {
|
|
149026
|
-
return
|
|
148689
|
+
return isRecord10(schema.properties) ? schema.properties : {};
|
|
149027
148690
|
}
|
|
149028
148691
|
function requiredOf(schema) {
|
|
149029
148692
|
if (!Array.isArray(schema.required)) return [];
|
|
@@ -149184,7 +148847,7 @@ function shapeInput(key, entry2, upstream, supplied, issues) {
|
|
|
149184
148847
|
for (const [name2, value] of defaults) {
|
|
149185
148848
|
if (!usable("defaults", name2)) continue;
|
|
149186
148849
|
const property = shaped[name2];
|
|
149187
|
-
shaped[name2] = { ...
|
|
148850
|
+
shaped[name2] = { ...isRecord10(property) ? property : {}, default: value };
|
|
149188
148851
|
required2 = required2.filter((other) => other !== name2);
|
|
149189
148852
|
}
|
|
149190
148853
|
const renamed = /* @__PURE__ */ new Map();
|
|
@@ -149237,7 +148900,7 @@ function selectTree(paths) {
|
|
|
149237
148900
|
return root;
|
|
149238
148901
|
}
|
|
149239
148902
|
function trimObject(schema, children) {
|
|
149240
|
-
if (!
|
|
148903
|
+
if (!isRecord10(schema.properties)) return schema;
|
|
149241
148904
|
const properties = schema.properties;
|
|
149242
148905
|
const kept = {};
|
|
149243
148906
|
for (const [name2, node2] of children) {
|
|
@@ -149252,9 +148915,9 @@ function trimObject(schema, children) {
|
|
|
149252
148915
|
return out;
|
|
149253
148916
|
}
|
|
149254
148917
|
function trimNode(schema, node2) {
|
|
149255
|
-
if (node2.whole || !
|
|
148918
|
+
if (node2.whole || !isRecord10(schema)) return schema;
|
|
149256
148919
|
if (!node2.array) return trimObject(schema, node2.children);
|
|
149257
|
-
return
|
|
148920
|
+
return isRecord10(schema.items) ? { ...schema, items: trimObject(schema.items, node2.children) } : schema;
|
|
149258
148921
|
}
|
|
149259
148922
|
function selectOutput(outputSchema, select) {
|
|
149260
148923
|
if (select.length === 0) return outputSchema;
|
|
@@ -150068,12 +149731,12 @@ function walkSchemas(root, at2, visit2) {
|
|
|
150068
149731
|
node2.forEach((item, index) => walk2(item, `${path2}[${index}]`, depth + 1));
|
|
150069
149732
|
return;
|
|
150070
149733
|
}
|
|
150071
|
-
if (!
|
|
149734
|
+
if (!isRecord10(node2) || above.has(node2)) return;
|
|
150072
149735
|
visit2(node2, path2);
|
|
150073
149736
|
above.add(node2);
|
|
150074
149737
|
for (const [key, value] of Object.entries(node2)) {
|
|
150075
149738
|
if (DATA.has(key)) continue;
|
|
150076
|
-
if (SCHEMA_MAPS.has(key) &&
|
|
149739
|
+
if (SCHEMA_MAPS.has(key) && isRecord10(value)) {
|
|
150077
149740
|
for (const [name2, child] of Object.entries(value))
|
|
150078
149741
|
walk2(child, `${path2}.${key}.${name2}`, depth + 1);
|
|
150079
149742
|
} else {
|
|
@@ -150085,7 +149748,7 @@ function walkSchemas(root, at2, visit2) {
|
|
|
150085
149748
|
walk2(root, at2, 0);
|
|
150086
149749
|
}
|
|
150087
149750
|
function tagOf(schema) {
|
|
150088
|
-
if (!
|
|
149751
|
+
if (!isRecord10(schema)) return void 0;
|
|
150089
149752
|
if (Object.hasOwn(schema, "const")) return JSON.stringify(schema.const);
|
|
150090
149753
|
if (Array.isArray(schema.enum) && schema.enum.length === 1)
|
|
150091
149754
|
return JSON.stringify(schema.enum[0]);
|
|
@@ -150093,7 +149756,7 @@ function tagOf(schema) {
|
|
|
150093
149756
|
}
|
|
150094
149757
|
function distinguishable(branches) {
|
|
150095
149758
|
if (branches.length < 2) return true;
|
|
150096
|
-
const records = branches.filter(
|
|
149759
|
+
const records = branches.filter(isRecord10);
|
|
150097
149760
|
const [first] = records;
|
|
150098
149761
|
if (first === void 0 || records.length < branches.length) return false;
|
|
150099
149762
|
const types = records.map((branch) => branch.type);
|
|
@@ -150203,11 +149866,11 @@ function quoted2(values) {
|
|
|
150203
149866
|
return orList2(values.map((value) => JSON.stringify(value)));
|
|
150204
149867
|
}
|
|
150205
149868
|
function isArraySchema(schema) {
|
|
150206
|
-
if (!
|
|
149869
|
+
if (!isRecord10(schema)) return false;
|
|
150207
149870
|
return schema.type === "array" || Array.isArray(schema.type) && schema.type.includes("array");
|
|
150208
149871
|
}
|
|
150209
149872
|
function hasDescription(schema) {
|
|
150210
|
-
return
|
|
149873
|
+
return isRecord10(schema) && typeof schema.description === "string" && schema.description.trim() !== "";
|
|
150211
149874
|
}
|
|
150212
149875
|
function refTarget(root, ref) {
|
|
150213
149876
|
if (ref === "#") return root;
|
|
@@ -150220,7 +149883,7 @@ function refTarget(root, ref) {
|
|
|
150220
149883
|
} catch {
|
|
150221
149884
|
return void 0;
|
|
150222
149885
|
}
|
|
150223
|
-
if (!
|
|
149886
|
+
if (!isRecord10(node2) || !Object.hasOwn(node2, name2)) return void 0;
|
|
150224
149887
|
node2 = node2[name2];
|
|
150225
149888
|
}
|
|
150226
149889
|
return node2;
|
|
@@ -150229,7 +149892,7 @@ function isDescribed(schema, root) {
|
|
|
150229
149892
|
const seen = /* @__PURE__ */ new Set();
|
|
150230
149893
|
let node2 = schema;
|
|
150231
149894
|
while (!hasDescription(node2)) {
|
|
150232
|
-
const ref =
|
|
149895
|
+
const ref = isRecord10(node2) ? node2.$ref : void 0;
|
|
150233
149896
|
if (typeof ref !== "string") return false;
|
|
150234
149897
|
if (seen.has(ref)) return true;
|
|
150235
149898
|
seen.add(ref);
|
|
@@ -150495,7 +150158,7 @@ function lintUpstream(folder, context, key, entry2, upstream, apply, report) {
|
|
|
150495
150158
|
});
|
|
150496
150159
|
}
|
|
150497
150160
|
const oneOf4 = (node2, at2) => {
|
|
150498
|
-
if (!Array.isArray(node2.oneOf) ||
|
|
150161
|
+
if (!Array.isArray(node2.oneOf) || isRecord10(node2.discriminator) || distinguishable(node2.oneOf))
|
|
150499
150162
|
return;
|
|
150500
150163
|
report("undiscriminated_one_of", {
|
|
150501
150164
|
tool: key,
|
|
@@ -151342,7 +151005,7 @@ function upstreamError(response, bytes) {
|
|
|
151342
151005
|
let problem;
|
|
151343
151006
|
if (text6 !== "" && isJsonMediaType(headerValue(response.headers, "content-type"))) {
|
|
151344
151007
|
const parsed2 = parseJson4(text6);
|
|
151345
|
-
if (parsed2.ok &&
|
|
151008
|
+
if (parsed2.ok && isRecord10(parsed2.value)) problem = parsed2.value;
|
|
151346
151009
|
}
|
|
151347
151010
|
const title = problem === void 0 ? void 0 : firstText(problem, ["title"]);
|
|
151348
151011
|
const detail = problem === void 0 ? text6.trim() === "" ? void 0 : text6 : firstText(problem, ["detail", "message", "error_description", "error"]);
|
|
@@ -151477,13 +151140,13 @@ var init_http_call = __esm({
|
|
|
151477
151140
|
|
|
151478
151141
|
// ../../packages/mcp-studio/src/execute/mcp.ts
|
|
151479
151142
|
function toolResult(value) {
|
|
151480
|
-
if (!
|
|
151143
|
+
if (!isRecord10(value))
|
|
151481
151144
|
return { ok: false, detail: "The tools/call result is not an object." };
|
|
151482
151145
|
if (!isList(value.content))
|
|
151483
151146
|
return { ok: false, detail: "The tools/call result has no content list." };
|
|
151484
151147
|
const content = [];
|
|
151485
151148
|
for (const [index, item] of value.content.entries()) {
|
|
151486
|
-
if (!
|
|
151149
|
+
if (!isRecord10(item) || typeof item.type !== "string") {
|
|
151487
151150
|
return {
|
|
151488
151151
|
ok: false,
|
|
151489
151152
|
detail: `Content item ${index} is not an object with a string type.`
|
|
@@ -151494,7 +151157,7 @@ function toolResult(value) {
|
|
|
151494
151157
|
const result2 = { content };
|
|
151495
151158
|
const structured = value.structuredContent;
|
|
151496
151159
|
if (structured !== void 0 && structured !== null) {
|
|
151497
|
-
if (!
|
|
151160
|
+
if (!isRecord10(structured))
|
|
151498
151161
|
return {
|
|
151499
151162
|
ok: false,
|
|
151500
151163
|
detail: "The tools/call result's structuredContent is not an object."
|
|
@@ -151639,7 +151302,7 @@ function rejectedAttempt(response, failure4) {
|
|
|
151639
151302
|
function findResponse(value, id2) {
|
|
151640
151303
|
const messages = isList(value) ? value : [value];
|
|
151641
151304
|
for (const message2 of messages) {
|
|
151642
|
-
if (
|
|
151305
|
+
if (isRecord10(message2) && message2.id === id2 && !Object.hasOwn(message2, "method"))
|
|
151643
151306
|
return message2;
|
|
151644
151307
|
}
|
|
151645
151308
|
return void 0;
|
|
@@ -151712,8 +151375,8 @@ async function readReply(session, response, id2, what) {
|
|
|
151712
151375
|
return { ok: true, value: message2 };
|
|
151713
151376
|
}
|
|
151714
151377
|
function rpcError2(error2) {
|
|
151715
|
-
const message2 =
|
|
151716
|
-
const code =
|
|
151378
|
+
const message2 = isRecord10(error2) && typeof error2.message === "string" ? error2.message : JSON.stringify(error2);
|
|
151379
|
+
const code = isRecord10(error2) && typeof error2.code === "number" ? ` (code ${error2.code})` : "";
|
|
151717
151380
|
return {
|
|
151718
151381
|
title: "MCP error",
|
|
151719
151382
|
detail: cutDetail(`${message2}${code}`),
|
|
@@ -151752,7 +151415,7 @@ async function initialize(session) {
|
|
|
151752
151415
|
if (Object.hasOwn(reply3.value, "error"))
|
|
151753
151416
|
return { ok: false, error: rpcError2(reply3.value.error) };
|
|
151754
151417
|
const result2 = reply3.value.result;
|
|
151755
|
-
if (!
|
|
151418
|
+
if (!isRecord10(result2))
|
|
151756
151419
|
return invalidResponse(
|
|
151757
151420
|
"The MCP server's initialize result is not an object.",
|
|
151758
151421
|
response.status
|
|
@@ -152010,8 +151673,8 @@ function firstPosition(paging, args, options) {
|
|
|
152010
151673
|
if (paging.style === "offset") return 0;
|
|
152011
151674
|
const properties = options.inputSchema.properties;
|
|
152012
151675
|
const name2 = options.agentName(paging.input);
|
|
152013
|
-
const property =
|
|
152014
|
-
if (
|
|
151676
|
+
const property = isRecord10(properties) && Object.hasOwn(properties, name2) ? properties[name2] : void 0;
|
|
151677
|
+
if (isRecord10(property)) {
|
|
152015
151678
|
const fallback = wholeNumber(property.default) ?? wholeNumber(property.minimum);
|
|
152016
151679
|
if (fallback !== void 0) return fallback;
|
|
152017
151680
|
}
|
|
@@ -152194,7 +151857,7 @@ function graphqlDocument(template, args) {
|
|
|
152194
151857
|
}
|
|
152195
151858
|
function errorMessages(errors) {
|
|
152196
151859
|
return errors.map(
|
|
152197
|
-
(entry2) =>
|
|
151860
|
+
(entry2) => isRecord10(entry2) && typeof entry2.message === "string" ? entry2.message : JSON.stringify(entry2)
|
|
152198
151861
|
).join("; ");
|
|
152199
151862
|
}
|
|
152200
151863
|
function invalidResponse2(detail, status2) {
|
|
@@ -152206,7 +151869,7 @@ function interpret(template) {
|
|
|
152206
151869
|
const status2 = response.status;
|
|
152207
151870
|
const parsed2 = bytes.byteLength === 0 ? void 0 : parseJson4(decodeText2(bytes));
|
|
152208
151871
|
const body2 = parsed2?.ok === true ? parsed2.value : void 0;
|
|
152209
|
-
if (
|
|
151872
|
+
if (isRecord10(body2) && isList(body2.errors) && body2.errors.length > 0) {
|
|
152210
151873
|
return {
|
|
152211
151874
|
ok: false,
|
|
152212
151875
|
error: {
|
|
@@ -152228,8 +151891,8 @@ function interpret(template) {
|
|
|
152228
151891
|
`The upstream answered ${status2} with JSON that does not parse: ${parsed2.message}`,
|
|
152229
151892
|
status2
|
|
152230
151893
|
);
|
|
152231
|
-
const data =
|
|
152232
|
-
if (!
|
|
151894
|
+
const data = isRecord10(body2) ? body2.data : void 0;
|
|
151895
|
+
if (!isRecord10(data))
|
|
152233
151896
|
return invalidResponse2(
|
|
152234
151897
|
`The upstream answered ${status2} with no data object.`,
|
|
152235
151898
|
status2
|
|
@@ -152902,7 +152565,7 @@ function exchangesFor(call2, ending) {
|
|
|
152902
152565
|
];
|
|
152903
152566
|
}
|
|
152904
152567
|
function isJsonObject(value) {
|
|
152905
|
-
return
|
|
152568
|
+
return isRecord10(value);
|
|
152906
152569
|
}
|
|
152907
152570
|
var DEFAULT_MAX_STREAM_BYTES, RETRIED_LEVELS, CANCELLED2, grpcSender, TRANSPORT_TITLES2;
|
|
152908
152571
|
var init_sender = __esm({
|
|
@@ -152966,7 +152629,7 @@ function scalarText(value, name2) {
|
|
|
152966
152629
|
function shapeOf(value, name2) {
|
|
152967
152630
|
if (isList(value))
|
|
152968
152631
|
return { kind: "list", items: value.map((item) => scalarText(item, name2)) };
|
|
152969
|
-
if (
|
|
152632
|
+
if (isRecord10(value)) {
|
|
152970
152633
|
return {
|
|
152971
152634
|
kind: "object",
|
|
152972
152635
|
entries: Object.entries(value).filter(([, item]) => item !== void 0).map(([key, item]) => [key, scalarText(item, name2)])
|
|
@@ -153159,7 +152822,7 @@ function formText(value) {
|
|
|
153159
152822
|
throw invalidArguments(`A form body cannot carry a ${typeof value} value.`);
|
|
153160
152823
|
}
|
|
153161
152824
|
function formBody(value) {
|
|
153162
|
-
if (!
|
|
152825
|
+
if (!isRecord10(value)) throw invalidArguments("A form body takes an object.");
|
|
153163
152826
|
const form = new URLSearchParams();
|
|
153164
152827
|
for (const [key, item] of Object.entries(value)) {
|
|
153165
152828
|
const items = (isList(item) ? item : [item]).filter(
|
|
@@ -153427,7 +153090,7 @@ function project(value, at2) {
|
|
|
153427
153090
|
const each = at2.each;
|
|
153428
153091
|
return value.map((item) => project(item, each)).filter((item) => item !== ABSENT);
|
|
153429
153092
|
}
|
|
153430
|
-
if (
|
|
153093
|
+
if (isRecord10(value) && at2.fields.size > 0) {
|
|
153431
153094
|
const kept = [];
|
|
153432
153095
|
for (const [name2, child] of at2.fields) {
|
|
153433
153096
|
if (!Object.hasOwn(value, name2)) continue;
|
|
@@ -153444,7 +153107,7 @@ function remove(value, at2) {
|
|
|
153444
153107
|
const each = at2.each;
|
|
153445
153108
|
return value.map((item) => remove(item, each)).filter((item) => item !== ABSENT);
|
|
153446
153109
|
}
|
|
153447
|
-
if (
|
|
153110
|
+
if (isRecord10(value) && at2.fields.size > 0) {
|
|
153448
153111
|
const kept = [];
|
|
153449
153112
|
for (const [name2, item] of Object.entries(value)) {
|
|
153450
153113
|
const child = at2.fields.get(name2);
|
|
@@ -153480,14 +153143,14 @@ function shapeRecord(value, rules, isError) {
|
|
|
153480
153143
|
let out = value;
|
|
153481
153144
|
if (rules.select !== void 0 && !isError) out = project(out, rules.select);
|
|
153482
153145
|
if (rules.redact !== void 0) out = remove(out, rules.redact);
|
|
153483
|
-
return
|
|
153146
|
+
return isRecord10(out) ? out : {};
|
|
153484
153147
|
}
|
|
153485
153148
|
function redactReachesList(redact) {
|
|
153486
153149
|
const items = redact.fields.get(LIST_FIELD);
|
|
153487
153150
|
return items !== void 0 && (items.end || items.each !== void 0);
|
|
153488
153151
|
}
|
|
153489
153152
|
function shapeAny(value, rules) {
|
|
153490
|
-
if (
|
|
153153
|
+
if (isRecord10(value)) return shapeRecord(value, rules, false);
|
|
153491
153154
|
if (!isList(value)) return value;
|
|
153492
153155
|
if (rules.redact !== void 0 && !redactReachesList(rules.redact))
|
|
153493
153156
|
return WITHHELD;
|
|
@@ -153520,12 +153183,12 @@ function resultBytes(content, structured) {
|
|
|
153520
153183
|
}
|
|
153521
153184
|
function jsonResult(value, text6) {
|
|
153522
153185
|
const result2 = { content: [textItem(text6)] };
|
|
153523
|
-
if (
|
|
153186
|
+
if (isRecord10(value)) result2.structuredContent = value;
|
|
153524
153187
|
return result2;
|
|
153525
153188
|
}
|
|
153526
153189
|
function jsonResultBytes(value, text6) {
|
|
153527
153190
|
const bytes = utf8Length(text6);
|
|
153528
|
-
return
|
|
153191
|
+
return isRecord10(value) ? 2 * bytes : bytes;
|
|
153529
153192
|
}
|
|
153530
153193
|
function cutList(value, rules) {
|
|
153531
153194
|
const list2 = valueAt2(value, rules.list);
|
|
@@ -153590,7 +153253,7 @@ function shapeText(text6, rules, isError, structured) {
|
|
|
153590
153253
|
if (typeof text6 !== "string") return void 0;
|
|
153591
153254
|
const parsed2 = parseJson4(text6);
|
|
153592
153255
|
if (!parsed2.ok) return void 0;
|
|
153593
|
-
if (
|
|
153256
|
+
if (isRecord10(parsed2.value))
|
|
153594
153257
|
return JSON.stringify(shapeRecord(parsed2.value, rules, isError));
|
|
153595
153258
|
if (!isList(parsed2.value) || rules.redact === void 0) return void 0;
|
|
153596
153259
|
if (redactReachesList(rules.redact)) {
|
|
@@ -153604,7 +153267,7 @@ function shapeItem(item, rules, isError, structured) {
|
|
|
153604
153267
|
const text6 = shapeText(item.text, rules, isError, structured);
|
|
153605
153268
|
return text6 === void 0 ? item : { ...item, text: text6 };
|
|
153606
153269
|
}
|
|
153607
|
-
if (item.type === "resource" &&
|
|
153270
|
+
if (item.type === "resource" && isRecord10(item.resource)) {
|
|
153608
153271
|
const text6 = shapeText(item.resource.text, rules, isError, structured);
|
|
153609
153272
|
return text6 === void 0 ? item : { ...item, resource: { ...item.resource, text: text6 } };
|
|
153610
153273
|
}
|
|
@@ -153692,7 +153355,7 @@ function hasType(type, value) {
|
|
|
153692
153355
|
case "boolean":
|
|
153693
153356
|
return typeof value === "boolean";
|
|
153694
153357
|
case "object":
|
|
153695
|
-
return
|
|
153358
|
+
return isRecord10(value);
|
|
153696
153359
|
case "array":
|
|
153697
153360
|
return isList(value);
|
|
153698
153361
|
default:
|
|
@@ -153756,7 +153419,7 @@ function resolveRef(root, ref) {
|
|
|
153756
153419
|
if (!Number.isInteger(index) || index < 0 || index >= current.length)
|
|
153757
153420
|
return void 0;
|
|
153758
153421
|
current = current[index];
|
|
153759
|
-
} else if (
|
|
153422
|
+
} else if (isRecord10(current) && Object.hasOwn(current, token)) {
|
|
153760
153423
|
current = current[token];
|
|
153761
153424
|
} else {
|
|
153762
153425
|
return void 0;
|
|
@@ -153766,7 +153429,7 @@ function resolveRef(root, ref) {
|
|
|
153766
153429
|
}
|
|
153767
153430
|
function canonical2(value) {
|
|
153768
153431
|
if (isList(value)) return `[${value.map(canonical2).join(",")}]`;
|
|
153769
|
-
if (
|
|
153432
|
+
if (isRecord10(value)) {
|
|
153770
153433
|
const keys = Object.keys(value).sort();
|
|
153771
153434
|
return `{${keys.map((key) => `${JSON.stringify(key)}:${canonical2(value[key])}`).join(",")}}`;
|
|
153772
153435
|
}
|
|
@@ -153819,7 +153482,7 @@ var init_validate = __esm({
|
|
|
153819
153482
|
return [];
|
|
153820
153483
|
}
|
|
153821
153484
|
if (schema === false) return [`${path2} is not allowed.`];
|
|
153822
|
-
if (!
|
|
153485
|
+
if (!isRecord10(schema)) return [];
|
|
153823
153486
|
if (value === null && schema.nullable === true) return [];
|
|
153824
153487
|
const issues = [];
|
|
153825
153488
|
if (typeof schema.$ref === "string") {
|
|
@@ -153841,7 +153504,7 @@ var init_validate = __esm({
|
|
|
153841
153504
|
issues.push(...checkNumber2(schema, value, path2));
|
|
153842
153505
|
else if (isList(value))
|
|
153843
153506
|
issues.push(...this.checkArray(schema, value, path2, depth));
|
|
153844
|
-
else if (
|
|
153507
|
+
else if (isRecord10(value))
|
|
153845
153508
|
issues.push(...this.checkObject(schema, value, path2, depth));
|
|
153846
153509
|
issues.push(...this.checkCombinators(schema, value, path2, depth));
|
|
153847
153510
|
return issues;
|
|
@@ -153953,8 +153616,8 @@ var init_validate = __esm({
|
|
|
153953
153616
|
`${path2} must have at most ${schema.maxProperties} ${plural8(schema.maxProperties, "property", "properties")}.`
|
|
153954
153617
|
);
|
|
153955
153618
|
}
|
|
153956
|
-
const properties =
|
|
153957
|
-
const patterns =
|
|
153619
|
+
const properties = isRecord10(schema.properties) ? schema.properties : {};
|
|
153620
|
+
const patterns = isRecord10(schema.patternProperties) ? Object.entries(schema.patternProperties) : [];
|
|
153958
153621
|
for (const key of present) {
|
|
153959
153622
|
const at2 = propertyPath(path2, key);
|
|
153960
153623
|
let known = false;
|
|
@@ -172237,7 +171900,7 @@ function differenceAt(path2, expected, actual) {
|
|
|
172237
171900
|
actual: actual[shared]
|
|
172238
171901
|
};
|
|
172239
171902
|
}
|
|
172240
|
-
if (
|
|
171903
|
+
if (isRecord10(expected) && isRecord10(actual)) {
|
|
172241
171904
|
for (const key of Object.keys(expected)) {
|
|
172242
171905
|
const found = differenceAt(
|
|
172243
171906
|
keyPath(path2, key),
|
|
@@ -172332,7 +171995,7 @@ function rpcMessage(request3) {
|
|
|
172332
171995
|
const parsed2 = parseJson4(decodeText2(request3.body));
|
|
172333
171996
|
if (!parsed2.ok) return void 0;
|
|
172334
171997
|
const value = isList(parsed2.value) ? parsed2.value[0] : parsed2.value;
|
|
172335
|
-
return
|
|
171998
|
+
return isRecord10(value) ? value : void 0;
|
|
172336
171999
|
}
|
|
172337
172000
|
function replayTransport(exchanges, route) {
|
|
172338
172001
|
let next = 0;
|
|
@@ -174587,10 +174250,12 @@ var init_src8 = __esm({
|
|
|
174587
174250
|
});
|
|
174588
174251
|
|
|
174589
174252
|
// ../../packages/steering-bundle/src/tree.ts
|
|
174590
|
-
import { createHash as
|
|
174253
|
+
import { createHash as createHash30 } from "node:crypto";
|
|
174591
174254
|
function gitBlobId(text6) {
|
|
174592
|
-
|
|
174593
|
-
|
|
174255
|
+
return gitBlobIdOfBytes(Buffer.from(text6, "utf8"));
|
|
174256
|
+
}
|
|
174257
|
+
function gitBlobIdOfBytes(bytes) {
|
|
174258
|
+
return createHash30("sha1").update(`blob ${bytes.length}\0`).update(bytes).digest("hex");
|
|
174594
174259
|
}
|
|
174595
174260
|
function treeFromFiles(files2) {
|
|
174596
174261
|
return {
|
|
@@ -174650,6 +174315,10 @@ var init_tree = __esm({
|
|
|
174650
174315
|
texts = /* @__PURE__ */ new Map();
|
|
174651
174316
|
/** Reads in flight, so two callers of one path share one fetch. */
|
|
174652
174317
|
pending = /* @__PURE__ */ new Map();
|
|
174318
|
+
/** Texts decoded from the tree's bytes, by blob id, or by path for a file listed without one. */
|
|
174319
|
+
decoded = /* @__PURE__ */ new Map();
|
|
174320
|
+
/** Byte reads in flight, keyed as `decoded` is. */
|
|
174321
|
+
decoding = /* @__PURE__ */ new Map();
|
|
174653
174322
|
blobs = /* @__PURE__ */ new Map();
|
|
174654
174323
|
listed;
|
|
174655
174324
|
/** How many files this reader fetched from the host. */
|
|
@@ -174676,6 +174345,35 @@ var init_tree = __esm({
|
|
|
174676
174345
|
const text6 = await this.read(path2);
|
|
174677
174346
|
return this.blobs.get(path2) ?? gitBlobId(text6);
|
|
174678
174347
|
}
|
|
174348
|
+
/**
|
|
174349
|
+
* The file's text as `read_steering` serves it, for any file, an image
|
|
174350
|
+
* included. With the tree's bytes, they are decoded as UTF-8: a byte that
|
|
174351
|
+
* is not UTF-8 becomes U+FFFD, and a NUL byte stays as U+0000. Without
|
|
174352
|
+
* them, the text `read` returns. Paths that share a listed blob share one
|
|
174353
|
+
* fetch, and a fetch that fails is not kept.
|
|
174354
|
+
*/
|
|
174355
|
+
async text(path2) {
|
|
174356
|
+
if (this.tree.readBytes === void 0) return this.read(path2);
|
|
174357
|
+
const listed = this.blobs.get(path2);
|
|
174358
|
+
const key = listed === void 0 ? `path:${path2}` : `blob:${listed}`;
|
|
174359
|
+
const held = this.decoded.get(key);
|
|
174360
|
+
if (held !== void 0) return held;
|
|
174361
|
+
const inFlight = this.decoding.get(key);
|
|
174362
|
+
if (inFlight !== void 0) return inFlight;
|
|
174363
|
+
const reading = this.decode(path2, key).finally(
|
|
174364
|
+
() => this.decoding.delete(key)
|
|
174365
|
+
);
|
|
174366
|
+
this.decoding.set(key, reading);
|
|
174367
|
+
return reading;
|
|
174368
|
+
}
|
|
174369
|
+
async decode(path2, key) {
|
|
174370
|
+
if (this.tree.readBytes === void 0) return this.read(path2);
|
|
174371
|
+
const bytes = await this.tree.readBytes(path2);
|
|
174372
|
+
this.reads += 1;
|
|
174373
|
+
const text6 = new TextDecoder("utf-8").decode(bytes);
|
|
174374
|
+
this.decoded.set(key, text6);
|
|
174375
|
+
return text6;
|
|
174376
|
+
}
|
|
174679
174377
|
/** The file's text, from this reader, the cache, or the host. */
|
|
174680
174378
|
async read(path2) {
|
|
174681
174379
|
const held = this.texts.get(path2);
|
|
@@ -175076,15 +174774,15 @@ __export(check_exports, {
|
|
|
175076
174774
|
readHead: () => readHead2
|
|
175077
174775
|
});
|
|
175078
174776
|
import { execFileSync } from "node:child_process";
|
|
175079
|
-
import { createHash as
|
|
174777
|
+
import { createHash as createHash31 } from "node:crypto";
|
|
175080
174778
|
import {
|
|
175081
|
-
lstatSync as
|
|
175082
|
-
mkdirSync as
|
|
175083
|
-
readFileSync as
|
|
174779
|
+
lstatSync as lstatSync14,
|
|
174780
|
+
mkdirSync as mkdirSync15,
|
|
174781
|
+
readFileSync as readFileSync32,
|
|
175084
174782
|
readlinkSync as readlinkSync4,
|
|
175085
174783
|
statSync as statSync21
|
|
175086
174784
|
} from "node:fs";
|
|
175087
|
-
import { dirname as
|
|
174785
|
+
import { dirname as dirname37, isAbsolute as isAbsolute19, join as join69, relative as relative10, resolve as resolve28, sep as sep13 } from "node:path";
|
|
175088
174786
|
function cloneRepoKind(root) {
|
|
175089
174787
|
const out = git4(root, ["remote", "get-url", "origin"]);
|
|
175090
174788
|
const url2 = out?.toString("utf8").trim() ?? "";
|
|
@@ -175124,11 +174822,11 @@ function commitOf(root, ref) {
|
|
|
175124
174822
|
return sha2.length > 0 ? sha2 : null;
|
|
175125
174823
|
}
|
|
175126
174824
|
function readWorkingFile(root, path2) {
|
|
175127
|
-
const abs =
|
|
174825
|
+
const abs = join69(root, ...path2.split("/"));
|
|
175128
174826
|
try {
|
|
175129
|
-
const stat7 =
|
|
174827
|
+
const stat7 = lstatSync14(abs);
|
|
175130
174828
|
if (stat7.isSymbolicLink()) return readlinkSync4(abs, "utf8");
|
|
175131
|
-
return stat7.isFile() ?
|
|
174829
|
+
return stat7.isFile() ? readFileSync32(abs, "utf8") : null;
|
|
175132
174830
|
} catch {
|
|
175133
174831
|
return null;
|
|
175134
174832
|
}
|
|
@@ -175218,10 +174916,10 @@ function isDir(path2) {
|
|
|
175218
174916
|
function findSteeringRoot(start) {
|
|
175219
174917
|
let dir = resolve28(start);
|
|
175220
174918
|
for (; ; ) {
|
|
175221
|
-
if (isFile(
|
|
174919
|
+
if (isFile(join69(dir, WORKSPACE_TOML_PATH)) || isFile(join69(dir, AGENTS_MD_PATH)) && isDir(join69(dir, STEERING_DIR))) {
|
|
175222
174920
|
return dir;
|
|
175223
174921
|
}
|
|
175224
|
-
const parent =
|
|
174922
|
+
const parent = dirname37(dir);
|
|
175225
174923
|
if (parent === dir) return null;
|
|
175226
174924
|
dir = parent;
|
|
175227
174925
|
}
|
|
@@ -175232,11 +174930,11 @@ function within3(path2, scope) {
|
|
|
175232
174930
|
function scopesFor(root, cwd, paths, trees) {
|
|
175233
174931
|
const scopes = [];
|
|
175234
174932
|
for (const path2 of paths) {
|
|
175235
|
-
const rel =
|
|
175236
|
-
if (rel === ".." || rel.startsWith(`..${
|
|
174933
|
+
const rel = relative10(root, resolve28(cwd, path2));
|
|
174934
|
+
if (rel === ".." || rel.startsWith(`..${sep13}`) || isAbsolute19(rel)) {
|
|
175237
174935
|
return { error: `${path2} is outside the steering repo at ${root}.` };
|
|
175238
174936
|
}
|
|
175239
|
-
const scope = rel.split(
|
|
174937
|
+
const scope = rel.split(sep13).join("/");
|
|
175240
174938
|
const known = trees.some(
|
|
175241
174939
|
(tree) => tree !== null && [...tree.keys()].some((file) => within3(file, scope))
|
|
175242
174940
|
);
|
|
@@ -175295,15 +174993,15 @@ function cacheFile(cacheDir, root) {
|
|
|
175295
174993
|
const identity = {
|
|
175296
174994
|
api: getApiUrl(),
|
|
175297
174995
|
...targetOf(root),
|
|
175298
|
-
key: token === void 0 ? null :
|
|
174996
|
+
key: token === void 0 ? null : createHash31("sha256").update(token).digest("hex").slice(0, 16)
|
|
175299
174997
|
};
|
|
175300
|
-
const key =
|
|
175301
|
-
return
|
|
174998
|
+
const key = createHash31("sha256").update(JSON.stringify([root, identity])).digest("hex").slice(0, 32);
|
|
174999
|
+
return join69(cacheDir, `${key}.json`);
|
|
175302
175000
|
}
|
|
175303
175001
|
function readCache(file, now) {
|
|
175304
175002
|
let entry2;
|
|
175305
175003
|
try {
|
|
175306
|
-
entry2 = JSON.parse(
|
|
175004
|
+
entry2 = JSON.parse(readFileSync32(file, "utf8"));
|
|
175307
175005
|
} catch {
|
|
175308
175006
|
return null;
|
|
175309
175007
|
}
|
|
@@ -175326,7 +175024,7 @@ async function publishedInputs(root, deps, refresh, out) {
|
|
|
175326
175024
|
}
|
|
175327
175025
|
if (file !== null) {
|
|
175328
175026
|
try {
|
|
175329
|
-
|
|
175027
|
+
mkdirSync15(dirname37(file), { recursive: true });
|
|
175330
175028
|
atomicWriteFileSync(
|
|
175331
175029
|
file,
|
|
175332
175030
|
JSON.stringify({
|
|
@@ -175412,7 +175110,7 @@ function defaultDeps2() {
|
|
|
175412
175110
|
return {
|
|
175413
175111
|
fetchPublished: fetchSteeringIndex,
|
|
175414
175112
|
cedar: cedarHooks,
|
|
175415
|
-
cacheDir:
|
|
175113
|
+
cacheDir: join69(getConfigDir(), "cache", "steering-check"),
|
|
175416
175114
|
now: () => Date.now()
|
|
175417
175115
|
};
|
|
175418
175116
|
}
|
|
@@ -175987,12 +175685,12 @@ var init_telemetry = __esm({
|
|
|
175987
175685
|
});
|
|
175988
175686
|
|
|
175989
175687
|
// src/auth/pkce.ts
|
|
175990
|
-
import { createHash as
|
|
175688
|
+
import { createHash as createHash32, randomBytes as randomBytes15 } from "node:crypto";
|
|
175991
175689
|
function generateCodeVerifier() {
|
|
175992
175690
|
return randomBytes15(32).toString("base64url");
|
|
175993
175691
|
}
|
|
175994
175692
|
function codeChallengeS256(codeVerifier) {
|
|
175995
|
-
return
|
|
175693
|
+
return createHash32("sha256").update(codeVerifier, "ascii").digest("base64url");
|
|
175996
175694
|
}
|
|
175997
175695
|
function generateState() {
|
|
175998
175696
|
return randomBytes15(16).toString("base64url");
|
|
@@ -176609,10 +176307,6 @@ async function handleLogout() {
|
|
|
176609
176307
|
`
|
|
176610
176308
|
);
|
|
176611
176309
|
}
|
|
176612
|
-
process.stdout.write(
|
|
176613
|
-
`Note: per-project links (.oxagen/workspace.json) are left intact.
|
|
176614
|
-
`
|
|
176615
|
-
);
|
|
176616
176310
|
}
|
|
176617
176311
|
var WHOAMI_TIMEOUT_MS, LOGOUT_TIMEOUT_MS;
|
|
176618
176312
|
var init_auth4 = __esm({
|
|
@@ -176874,7 +176568,7 @@ async function routerPreview(prompt, opts = {}, writer = stdoutWriter) {
|
|
|
176874
176568
|
writer.write(
|
|
176875
176569
|
`Task class: ${result2.taskClass} \xB7 decision: ${result2.source}`
|
|
176876
176570
|
);
|
|
176877
|
-
writer.write(`\u2192 ${
|
|
176571
|
+
writer.write(`\u2192 ${short3(result2.model)} (${result2.tier})`);
|
|
176878
176572
|
writer.write(` ${result2.rationale}`);
|
|
176879
176573
|
writer.write("");
|
|
176880
176574
|
if (result2.candidates.length === 0) {
|
|
@@ -176886,7 +176580,7 @@ async function routerPreview(prompt, opts = {}, writer = stdoutWriter) {
|
|
|
176886
176580
|
printTable(
|
|
176887
176581
|
["MODEL", "VERIFIED", "N", "AVG COST", "ELIGIBLE", "WHY"],
|
|
176888
176582
|
result2.candidates.map((c) => [
|
|
176889
|
-
|
|
176583
|
+
short3(c.model),
|
|
176890
176584
|
pct2(c.verifiedRate),
|
|
176891
176585
|
String(c.samples),
|
|
176892
176586
|
usd(c.avgCostUsdMicros),
|
|
@@ -176974,7 +176668,7 @@ async function routerPolicySet(opts = {}, writer = stdoutWriter) {
|
|
|
176974
176668
|
renderPolicy(result2, writer);
|
|
176975
176669
|
renderKindRules(result2.kindRules, { withSource: false }, writer);
|
|
176976
176670
|
}
|
|
176977
|
-
var pct2, usd,
|
|
176671
|
+
var pct2, usd, short3;
|
|
176978
176672
|
var init_router = __esm({
|
|
176979
176673
|
"src/commands/router.ts"() {
|
|
176980
176674
|
init_api();
|
|
@@ -176983,7 +176677,7 @@ var init_router = __esm({
|
|
|
176983
176677
|
init_capture_writer();
|
|
176984
176678
|
pct2 = (r) => `${(r * 100).toFixed(1)}%`;
|
|
176985
176679
|
usd = (micros2) => formatUsd(micros2 / 1e6);
|
|
176986
|
-
|
|
176680
|
+
short3 = (model) => model.split("/").pop() ?? model;
|
|
176987
176681
|
}
|
|
176988
176682
|
});
|
|
176989
176683
|
|
|
@@ -177048,7 +176742,7 @@ __export(secret_exports, {
|
|
|
177048
176742
|
handleSecretReveal: () => handleSecretReveal,
|
|
177049
176743
|
handleSecretSet: () => handleSecretSet
|
|
177050
176744
|
});
|
|
177051
|
-
import { readFileSync as
|
|
176745
|
+
import { readFileSync as readFileSync33, writeFileSync as writeFileSync12 } from "fs";
|
|
177052
176746
|
async function readStdin2() {
|
|
177053
176747
|
const chunks = [];
|
|
177054
176748
|
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
@@ -177161,7 +176855,7 @@ async function handleSecretReveal(key, opts, writer = stdoutWriter) {
|
|
|
177161
176855
|
async function handleSecretImport(opts, writer = stdoutWriter) {
|
|
177162
176856
|
const out = createOutput({}, writer);
|
|
177163
176857
|
try {
|
|
177164
|
-
const text6 = opts.file ?
|
|
176858
|
+
const text6 = opts.file ? readFileSync33(opts.file, "utf8") : await readStdin2();
|
|
177165
176859
|
const environmentId = opts.env ? await resolveEnvironmentId(opts.env) : null;
|
|
177166
176860
|
const { rows, committed } = await apiPostOrThrow("secret/import-env", { text: text6, environmentId, commit: !!opts.yes });
|
|
177167
176861
|
const newCount = rows.filter((r) => r.isNewKey).length;
|
|
@@ -177538,6 +177232,12 @@ function withTemplateFlags(command2) {
|
|
|
177538
177232
|
"--service <name>",
|
|
177539
177233
|
"A service the template starts before the harness, such as postgres. Repeat for each one",
|
|
177540
177234
|
collectLines
|
|
177235
|
+
).option(
|
|
177236
|
+
"--setup-command <command>",
|
|
177237
|
+
"A command the image build runs once as root, such as 'apt-get install -y libpq-dev'"
|
|
177238
|
+
).option(
|
|
177239
|
+
"--setup-dir <folder>",
|
|
177240
|
+
"The folder the setup command runs in, such as /opt/setup (default: /)"
|
|
177541
177241
|
);
|
|
177542
177242
|
}
|
|
177543
177243
|
function addSandboxRunsAndRuntimes(sandbox) {
|
|
@@ -178078,10 +177778,10 @@ function buildProgram() {
|
|
|
178078
177778
|
await repoUnlink2(bindingId, opts);
|
|
178079
177779
|
});
|
|
178080
177780
|
repoCmd.command("tree").description(
|
|
178081
|
-
"What
|
|
178082
|
-
).
|
|
177781
|
+
"What the workspace's steering repository holds on its production branch, read from GitHub now"
|
|
177782
|
+
).option("--json", "Output JSON").action(async (opts) => {
|
|
178083
177783
|
const { repoTree: repoTree2 } = await Promise.resolve().then(() => (init_repo(), repo_exports));
|
|
178084
|
-
await repoTree2(
|
|
177784
|
+
await repoTree2(opts);
|
|
178085
177785
|
});
|
|
178086
177786
|
repoCmd.command("branch").description(
|
|
178087
177787
|
"Confirm or change a repository's production branch; the branch must exist on GitHub"
|
|
@@ -178091,20 +177791,6 @@ function buildProgram() {
|
|
|
178091
177791
|
await repoBranch2(bindingId, branch, opts);
|
|
178092
177792
|
}
|
|
178093
177793
|
);
|
|
178094
|
-
repoCmd.command("init").description(
|
|
178095
|
-
"Open the pull request that adds .oxagen/ to a repository; it never writes to the production branch"
|
|
178096
|
-
).argument("<bindingId>", "The rpb_\u2026 binding id `oxagen repo list` shows").requiredOption(
|
|
178097
|
-
"--workspace-toml <file>",
|
|
178098
|
-
"The .oxagen/workspace.toml to propose"
|
|
178099
|
-
).option("--mode <mode>", "solo | team | regulated", "team").option(
|
|
178100
|
-
"--governance-toml <file>",
|
|
178101
|
-
"The .oxagen/rules/governance.toml to propose; drafted from --mode when omitted"
|
|
178102
|
-
).option("--json", "Output JSON").action(
|
|
178103
|
-
async (bindingId, opts) => {
|
|
178104
|
-
const { repoInit: repoInit2 } = await Promise.resolve().then(() => (init_repo(), repo_exports));
|
|
178105
|
-
await repoInit2(bindingId, opts);
|
|
178106
|
-
}
|
|
178107
|
-
);
|
|
178108
177794
|
repoCmd.command("governance").description(
|
|
178109
177795
|
"Set the steering governance mode: who may merge a steering PR in this workspace"
|
|
178110
177796
|
).requiredOption("--mode <mode>", "solo | team | regulated").option(
|
|
@@ -178414,6 +178100,12 @@ function buildProgram() {
|
|
|
178414
178100
|
).option("--prompt <text>", "The task for the agent").option("--prompt-file <path>", "Read the task for the agent from a file").option(
|
|
178415
178101
|
"--work-order <id>",
|
|
178416
178102
|
"Run this work order (wo_\u2026) instead of naming a repo"
|
|
178103
|
+
).option(
|
|
178104
|
+
"--account-source <source>",
|
|
178105
|
+
"Whose model accounts the run bills: operator, workspace, or operator_then_workspace (default: the agent's)"
|
|
178106
|
+
).option(
|
|
178107
|
+
"--confirm-workspace-billing",
|
|
178108
|
+
"Confirm that the run may bill the workspace's model accounts"
|
|
178417
178109
|
).option("--json", "Output the run as JSON and do not attach").action(
|
|
178418
178110
|
async (opts) => (await Promise.resolve().then(() => (init_sandbox_run(), sandbox_run_exports))).sandboxRun(opts)
|
|
178419
178111
|
);
|
|
@@ -178461,6 +178153,18 @@ function buildProgram() {
|
|
|
178461
178153
|
opts
|
|
178462
178154
|
)
|
|
178463
178155
|
);
|
|
178156
|
+
sandboxTemplateCmd.command("log").description(
|
|
178157
|
+
"Print the stored log of one template build of a sandbox runtime, with credentials redacted. Org Owner, or workspace Admin"
|
|
178158
|
+
).argument("<runtime>", "The sandbox runtime's id (rtm_\u2026)").argument("<build>", "The template build's id (rtp_\u2026)").option(
|
|
178159
|
+
"--workspace-slug <slug>",
|
|
178160
|
+
"The workspace the runtime belongs to (or OXAGEN_WORKSPACE)"
|
|
178161
|
+
).option("--json", "Output the log as JSON").action(
|
|
178162
|
+
async (runtime, build, opts) => (await Promise.resolve().then(() => (init_sandbox_template(), sandbox_template_exports))).sandboxTemplateLog(
|
|
178163
|
+
runtime,
|
|
178164
|
+
build,
|
|
178165
|
+
opts
|
|
178166
|
+
)
|
|
178167
|
+
);
|
|
178464
178168
|
sandboxCmd.command("pin-hooks", { hidden: true }).description(
|
|
178465
178169
|
"Write the sandbox's hook files as the launcher does, and print their hash"
|
|
178466
178170
|
).helpOption(false).allowUnknownOption().allowExcessArguments().action(async () => {
|
|
@@ -178488,18 +178192,27 @@ function buildProgram() {
|
|
|
178488
178192
|
).option(
|
|
178489
178193
|
"--workspace-slug <slug>",
|
|
178490
178194
|
"The workspace to address (or OXAGEN_WORKSPACE)"
|
|
178195
|
+
).option(
|
|
178196
|
+
"--shared",
|
|
178197
|
+
"Act on this workspace's accounts instead of your own. Changing one needs a workspace Admin or an organization Owner"
|
|
178491
178198
|
).option("--json", "Output JSON").action(
|
|
178492
178199
|
async (opts) => (await Promise.resolve().then(() => (init_credentials(), credentials_exports))).credentialsAdd(opts)
|
|
178493
178200
|
);
|
|
178494
178201
|
credentialsCmd.command("list").description("List your credentials in the order the gateway uses them").option(
|
|
178495
178202
|
"--workspace-slug <slug>",
|
|
178496
178203
|
"The workspace to address (or OXAGEN_WORKSPACE)"
|
|
178204
|
+
).option(
|
|
178205
|
+
"--shared",
|
|
178206
|
+
"Act on this workspace's accounts instead of your own. Changing one needs a workspace Admin or an organization Owner"
|
|
178497
178207
|
).option("--json", "Output JSON").action(
|
|
178498
178208
|
async (opts) => (await Promise.resolve().then(() => (init_credentials(), credentials_exports))).credentialsList(opts)
|
|
178499
178209
|
);
|
|
178500
178210
|
credentialsCmd.command("update").description("Rename, pause, or resume one of your credentials").argument("<credential>", "The credential's id (vlt_\u2026)").option("--label <name>", "A new name").option("--pause", "Make the gateway skip it").option("--resume", "Make the gateway use it again").option(
|
|
178501
178211
|
"--workspace-slug <slug>",
|
|
178502
178212
|
"The workspace to address (or OXAGEN_WORKSPACE)"
|
|
178213
|
+
).option(
|
|
178214
|
+
"--shared",
|
|
178215
|
+
"Act on this workspace's accounts instead of your own. Changing one needs a workspace Admin or an organization Owner"
|
|
178503
178216
|
).option("--json", "Output JSON").action(
|
|
178504
178217
|
async (credential, opts) => (await Promise.resolve().then(() => (init_credentials(), credentials_exports))).credentialsUpdate(
|
|
178505
178218
|
credential,
|
|
@@ -178514,6 +178227,9 @@ function buildProgram() {
|
|
|
178514
178227
|
).option(
|
|
178515
178228
|
"--workspace-slug <slug>",
|
|
178516
178229
|
"The workspace to address (or OXAGEN_WORKSPACE)"
|
|
178230
|
+
).option(
|
|
178231
|
+
"--shared",
|
|
178232
|
+
"Act on this workspace's accounts instead of your own. Changing one needs a workspace Admin or an organization Owner"
|
|
178517
178233
|
).option("--json", "Output JSON").action(
|
|
178518
178234
|
async (credential, opts) => (await Promise.resolve().then(() => (init_credentials(), credentials_exports))).credentialsRotate(
|
|
178519
178235
|
credential,
|
|
@@ -178523,6 +178239,9 @@ function buildProgram() {
|
|
|
178523
178239
|
credentialsCmd.command("remove").description("Remove one of your credentials").argument("<credential>", "The credential's id (vlt_\u2026)").option(
|
|
178524
178240
|
"--workspace-slug <slug>",
|
|
178525
178241
|
"The workspace to address (or OXAGEN_WORKSPACE)"
|
|
178242
|
+
).option(
|
|
178243
|
+
"--shared",
|
|
178244
|
+
"Act on this workspace's accounts instead of your own. Changing one needs a workspace Admin or an organization Owner"
|
|
178526
178245
|
).option("--json", "Output JSON").action(
|
|
178527
178246
|
async (credential, opts) => (await Promise.resolve().then(() => (init_credentials(), credentials_exports))).credentialsRemove(
|
|
178528
178247
|
credential,
|
|
@@ -178805,13 +178524,13 @@ function buildProgram() {
|
|
|
178805
178524
|
}
|
|
178806
178525
|
);
|
|
178807
178526
|
program2.command("init").description(
|
|
178808
|
-
"
|
|
178527
|
+
"Pick the Oxagen org + workspace the CLI works in, and report this directory to it. Writes no file here"
|
|
178809
178528
|
).option(
|
|
178810
178529
|
"--org <slug>",
|
|
178811
178530
|
"Link this organization instead of choosing one; works without a terminal"
|
|
178812
178531
|
).option(
|
|
178813
178532
|
"--workspace <slug>",
|
|
178814
|
-
"Link this workspace instead of choosing one; relinks when
|
|
178533
|
+
"Link this workspace instead of choosing one; relinks when another one is saved"
|
|
178815
178534
|
).option("--json", "Output JSON instead of human-readable text").option("--no-link", "Skip the workspace linker step entirely").action(
|
|
178816
178535
|
async (opts) => {
|
|
178817
178536
|
const { handleInit: handleInit2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
@@ -178823,17 +178542,6 @@ function buildProgram() {
|
|
|
178823
178542
|
});
|
|
178824
178543
|
}
|
|
178825
178544
|
);
|
|
178826
|
-
program2.command("pull").description(
|
|
178827
|
-
"Write the steering published in this workspace into this directory's .oxagen/"
|
|
178828
|
-
).option(
|
|
178829
|
-
"--binding <rpb_id>",
|
|
178830
|
-
"Pull from this repository binding instead of the workspace's main repository"
|
|
178831
|
-
).option("--force", "Overwrite files edited here").option("--dry-run", "Show what would change, and write nothing").option("--json", "Output JSON").action(
|
|
178832
|
-
async (opts) => {
|
|
178833
|
-
const { pull: pull2 } = await Promise.resolve().then(() => (init_pull(), pull_exports));
|
|
178834
|
-
await pull2(opts);
|
|
178835
|
-
}
|
|
178836
|
-
);
|
|
178837
178545
|
program2.command("check").argument(
|
|
178838
178546
|
"[paths...]",
|
|
178839
178547
|
"Report only the findings in these files and folders"
|