@oxagen/cli 3.0.1-793 → 3.0.1-802
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 +684 -998
- 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-802";
|
|
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
|
|
@@ -60509,10 +60632,10 @@ function toolContext(body2) {
|
|
|
60509
60632
|
continue;
|
|
60510
60633
|
if (path2.startsWith("/") || /^[A-Za-z]:/.test(path2) || path2.includes("\\"))
|
|
60511
60634
|
continue;
|
|
60512
|
-
const
|
|
60513
|
-
if (
|
|
60514
|
-
files2.delete(
|
|
60515
|
-
files2.add(
|
|
60635
|
+
const relative11 = path2.replace(/^\.\//, "");
|
|
60636
|
+
if (relative11.length === 0 || relative11.split("/").includes("..")) continue;
|
|
60637
|
+
files2.delete(relative11);
|
|
60638
|
+
files2.add(relative11);
|
|
60516
60639
|
if (files2.size > 64) files2.delete(files2.values().next().value ?? "");
|
|
60517
60640
|
}
|
|
60518
60641
|
if (name2 === "Skill" && typeof args["skill"] === "string" && args["skill"].length <= 256)
|
|
@@ -66608,6 +66731,12 @@ async function launchSandboxFromEnv(deps) {
|
|
|
66608
66731
|
repository: launch.repositoryFullName,
|
|
66609
66732
|
...launch.gitlab !== void 0 ? { gitlab: launch.gitlab } : {},
|
|
66610
66733
|
branch: launch.branch,
|
|
66734
|
+
...launch.repositories !== void 0 ? {
|
|
66735
|
+
repositories: launch.repositories.map((included) => ({
|
|
66736
|
+
repository: included.repositoryFullName,
|
|
66737
|
+
...included.gitlab !== void 0 ? { gitlab: included.gitlab } : {}
|
|
66738
|
+
}))
|
|
66739
|
+
} : {},
|
|
66611
66740
|
workOrderId: launch.workOrderId,
|
|
66612
66741
|
environment,
|
|
66613
66742
|
resume: launch.resume,
|
|
@@ -67052,16 +67181,16 @@ function gitHeadIn(cwd) {
|
|
|
67052
67181
|
}
|
|
67053
67182
|
function claimRefusalMessage(error2, criterionId, head3) {
|
|
67054
67183
|
const said = controlErrorMessage(error2);
|
|
67055
|
-
const
|
|
67184
|
+
const short4 = head3.slice(0, 7);
|
|
67056
67185
|
if (controlErrorReason(error2) === "stale_head")
|
|
67057
|
-
return `Oxagen refused the claim on ${criterionId} at commit ${
|
|
67186
|
+
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
67187
|
if (error2.status === 400)
|
|
67059
67188
|
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
67189
|
return `Oxagen refused the claim on ${criterionId}, so nothing was recorded. ${said}`;
|
|
67061
67190
|
}
|
|
67062
67191
|
function claimAnswerMessage(answer, criterionId, workOrderId, head3) {
|
|
67063
|
-
const
|
|
67064
|
-
return answer.repeat ? `Oxagen already had this claim on ${criterionId} at commit ${
|
|
67192
|
+
const short4 = head3.slice(0, 7);
|
|
67193
|
+
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
67194
|
}
|
|
67066
67195
|
async function workClaim(criterionId, options, deps) {
|
|
67067
67196
|
if (!WORK_CRITERION_ID_PATTERN.test(criterionId)) {
|
|
@@ -71180,7 +71309,7 @@ import {
|
|
|
71180
71309
|
writeFileSync as writeFileSync7
|
|
71181
71310
|
} from "node:fs";
|
|
71182
71311
|
import { dirname as dirname32, join as join57, resolve as resolve22 } from "node:path";
|
|
71183
|
-
function bundlePath(root,
|
|
71312
|
+
function bundlePath(root, relative11, create2 = false) {
|
|
71184
71313
|
const absolute = resolve22(root);
|
|
71185
71314
|
if (create2) mkdirSync10(absolute, { recursive: true, mode: 448 });
|
|
71186
71315
|
if (lstatSync11(absolute).isSymbolicLink() || !lstatSync11(absolute).isDirectory()) {
|
|
@@ -71188,14 +71317,14 @@ function bundlePath(root, relative12, create2 = false) {
|
|
|
71188
71317
|
}
|
|
71189
71318
|
const base2 = realpathSync8(absolute);
|
|
71190
71319
|
let current = base2;
|
|
71191
|
-
const parts =
|
|
71320
|
+
const parts = relative11.split("/");
|
|
71192
71321
|
for (let i2 = 0; i2 < parts.length; i2++) {
|
|
71193
71322
|
current = join57(current, parts[i2]);
|
|
71194
71323
|
try {
|
|
71195
71324
|
const stat7 = lstatSync11(current);
|
|
71196
71325
|
if (stat7.isSymbolicLink() || i2 < parts.length - 1 && !stat7.isDirectory()) {
|
|
71197
71326
|
arpFail(
|
|
71198
|
-
`The bundle path ${
|
|
71327
|
+
`The bundle path ${relative11} passes through a symlink or a file where a directory belongs.`
|
|
71199
71328
|
);
|
|
71200
71329
|
}
|
|
71201
71330
|
} catch (error2) {
|
|
@@ -71205,36 +71334,36 @@ function bundlePath(root, relative12, create2 = false) {
|
|
|
71205
71334
|
}
|
|
71206
71335
|
}
|
|
71207
71336
|
if (realpathSync8(dirname32(current)) !== dirname32(current)) {
|
|
71208
|
-
arpFail(`The bundle directory changed while ${
|
|
71337
|
+
arpFail(`The bundle directory changed while ${relative11} was read.`);
|
|
71209
71338
|
}
|
|
71210
71339
|
return current;
|
|
71211
71340
|
}
|
|
71212
|
-
function readBounded(root,
|
|
71213
|
-
const path2 = bundlePath(root,
|
|
71341
|
+
function readBounded(root, relative11, limit = ARP_MAX_BLOB_BYTES) {
|
|
71342
|
+
const path2 = bundlePath(root, relative11);
|
|
71214
71343
|
const fd2 = openSync9(path2, constants7.O_RDONLY | constants7.O_NOFOLLOW);
|
|
71215
71344
|
try {
|
|
71216
71345
|
const stat7 = fstatSync2(fd2);
|
|
71217
71346
|
if (!stat7.isFile() || stat7.size > limit)
|
|
71218
71347
|
arpFail(
|
|
71219
|
-
`The bundle file ${
|
|
71348
|
+
`The bundle file ${relative11} is not a regular file of at most ${limit} bytes.`
|
|
71220
71349
|
);
|
|
71221
71350
|
const bytes = Buffer.alloc(stat7.size);
|
|
71222
71351
|
let offset = 0;
|
|
71223
71352
|
while (offset < bytes.length) {
|
|
71224
71353
|
const count13 = readSync5(fd2, bytes, offset, bytes.length - offset, offset);
|
|
71225
71354
|
if (!count13)
|
|
71226
|
-
arpFail(`The bundle file ${
|
|
71355
|
+
arpFail(`The bundle file ${relative11} changed while it was read.`);
|
|
71227
71356
|
offset += count13;
|
|
71228
71357
|
}
|
|
71229
71358
|
if (readSync5(fd2, Buffer.alloc(1), 0, 1, offset) !== 0)
|
|
71230
|
-
arpFail(`The bundle file ${
|
|
71359
|
+
arpFail(`The bundle file ${relative11} changed while it was read.`);
|
|
71231
71360
|
return bytes;
|
|
71232
71361
|
} finally {
|
|
71233
71362
|
closeSync9(fd2);
|
|
71234
71363
|
}
|
|
71235
71364
|
}
|
|
71236
|
-
function writeNew2(root,
|
|
71237
|
-
const path2 = bundlePath(root,
|
|
71365
|
+
function writeNew2(root, relative11, bytes) {
|
|
71366
|
+
const path2 = bundlePath(root, relative11, true);
|
|
71238
71367
|
const fd2 = openSync9(
|
|
71239
71368
|
path2,
|
|
71240
71369
|
constants7.O_WRONLY | constants7.O_CREAT | constants7.O_EXCL | constants7.O_NOFOLLOW,
|
|
@@ -73211,7 +73340,7 @@ function buildTachoProgram(options = {}) {
|
|
|
73211
73340
|
"The launcher inside a sandbox the control plane started (not meant to be run by hand)"
|
|
73212
73341
|
);
|
|
73213
73342
|
sandbox.command("launch").description(
|
|
73214
|
-
|
|
73343
|
+
`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
73344
|
).requiredOption(
|
|
73216
73345
|
"--from-env",
|
|
73217
73346
|
"Read the launch and the run token from OXAGEN_SANDBOX_LAUNCH and OXAGEN_SANDBOX_RUN_TOKEN"
|
|
@@ -73272,6 +73401,7 @@ var init_main = __esm({
|
|
|
73272
73401
|
init_enroll();
|
|
73273
73402
|
init_export();
|
|
73274
73403
|
init_legacy_name();
|
|
73404
|
+
init_profile();
|
|
73275
73405
|
init_mcp_stdio();
|
|
73276
73406
|
init_reassign();
|
|
73277
73407
|
init_run();
|
|
@@ -73315,7 +73445,7 @@ var init_package = __esm({
|
|
|
73315
73445
|
"package.json"() {
|
|
73316
73446
|
package_default = {
|
|
73317
73447
|
name: "@oxagen/cli",
|
|
73318
|
-
version: "3.0.1-
|
|
73448
|
+
version: "3.0.1-802",
|
|
73319
73449
|
description: "Oxagen governance CLI: spend, source tracking, grounding, credentials, and audit (agentic coding lives in the stella CLI)",
|
|
73320
73450
|
type: "module",
|
|
73321
73451
|
main: "./dist/index.js",
|
|
@@ -82102,10 +82232,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
82102
82232
|
let offset = bm.offset;
|
|
82103
82233
|
let commentEnd = null;
|
|
82104
82234
|
for (const collItem of bm.items) {
|
|
82105
|
-
const { start, key, sep:
|
|
82235
|
+
const { start, key, sep: sep14, value } = collItem;
|
|
82106
82236
|
const keyProps = resolveProps.resolveProps(start, {
|
|
82107
82237
|
indicator: "explicit-key-ind",
|
|
82108
|
-
next: key ??
|
|
82238
|
+
next: key ?? sep14?.[0],
|
|
82109
82239
|
offset,
|
|
82110
82240
|
onError,
|
|
82111
82241
|
parentIndent: bm.indent,
|
|
@@ -82119,7 +82249,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
82119
82249
|
else if ("indent" in key && key.indent !== bm.indent)
|
|
82120
82250
|
onError(offset, "BAD_INDENT", startColMsg);
|
|
82121
82251
|
}
|
|
82122
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
82252
|
+
if (!keyProps.anchor && !keyProps.tag && !sep14) {
|
|
82123
82253
|
commentEnd = keyProps.end;
|
|
82124
82254
|
if (keyProps.comment) {
|
|
82125
82255
|
if (map.comment)
|
|
@@ -82143,7 +82273,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
82143
82273
|
ctx2.atKey = false;
|
|
82144
82274
|
if (utilMapIncludes.mapIncludes(ctx2, map.items, keyNode))
|
|
82145
82275
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
82146
|
-
const valueProps = resolveProps.resolveProps(
|
|
82276
|
+
const valueProps = resolveProps.resolveProps(sep14 ?? [], {
|
|
82147
82277
|
indicator: "map-value-ind",
|
|
82148
82278
|
next: value,
|
|
82149
82279
|
offset: keyNode.range[2],
|
|
@@ -82159,7 +82289,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
82159
82289
|
if (ctx2.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
82160
82290
|
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
82291
|
}
|
|
82162
|
-
const valueNode = value ? composeNode(ctx2, value, valueProps, onError) : composeEmptyNode(ctx2, offset,
|
|
82292
|
+
const valueNode = value ? composeNode(ctx2, value, valueProps, onError) : composeEmptyNode(ctx2, offset, sep14, null, valueProps, onError);
|
|
82163
82293
|
if (ctx2.schema.compat)
|
|
82164
82294
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
82165
82295
|
offset = valueNode.range[2];
|
|
@@ -82250,7 +82380,7 @@ var require_resolve_end = __commonJS({
|
|
|
82250
82380
|
let comment = "";
|
|
82251
82381
|
if (end) {
|
|
82252
82382
|
let hasSpace = false;
|
|
82253
|
-
let
|
|
82383
|
+
let sep14 = "";
|
|
82254
82384
|
for (const token of end) {
|
|
82255
82385
|
const { source, type } = token;
|
|
82256
82386
|
switch (type) {
|
|
@@ -82264,13 +82394,13 @@ var require_resolve_end = __commonJS({
|
|
|
82264
82394
|
if (!comment)
|
|
82265
82395
|
comment = cb;
|
|
82266
82396
|
else
|
|
82267
|
-
comment +=
|
|
82268
|
-
|
|
82397
|
+
comment += sep14 + cb;
|
|
82398
|
+
sep14 = "";
|
|
82269
82399
|
break;
|
|
82270
82400
|
}
|
|
82271
82401
|
case "newline":
|
|
82272
82402
|
if (comment)
|
|
82273
|
-
|
|
82403
|
+
sep14 += source;
|
|
82274
82404
|
hasSpace = true;
|
|
82275
82405
|
break;
|
|
82276
82406
|
default:
|
|
@@ -82313,18 +82443,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
82313
82443
|
let offset = fc.offset + fc.start.source.length;
|
|
82314
82444
|
for (let i2 = 0; i2 < fc.items.length; ++i2) {
|
|
82315
82445
|
const collItem = fc.items[i2];
|
|
82316
|
-
const { start, key, sep:
|
|
82446
|
+
const { start, key, sep: sep14, value } = collItem;
|
|
82317
82447
|
const props = resolveProps.resolveProps(start, {
|
|
82318
82448
|
flow: fcName,
|
|
82319
82449
|
indicator: "explicit-key-ind",
|
|
82320
|
-
next: key ??
|
|
82450
|
+
next: key ?? sep14?.[0],
|
|
82321
82451
|
offset,
|
|
82322
82452
|
onError,
|
|
82323
82453
|
parentIndent: fc.indent,
|
|
82324
82454
|
startOnNewline: false
|
|
82325
82455
|
});
|
|
82326
82456
|
if (!props.found) {
|
|
82327
|
-
if (!props.anchor && !props.tag && !
|
|
82457
|
+
if (!props.anchor && !props.tag && !sep14 && !value) {
|
|
82328
82458
|
if (i2 === 0 && props.comma)
|
|
82329
82459
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
82330
82460
|
else if (i2 < fc.items.length - 1)
|
|
@@ -82378,8 +82508,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
82378
82508
|
}
|
|
82379
82509
|
}
|
|
82380
82510
|
}
|
|
82381
|
-
if (!isMap3 && !
|
|
82382
|
-
const valueNode = value ? composeNode(ctx2, value, props, onError) : composeEmptyNode(ctx2, props.end,
|
|
82511
|
+
if (!isMap3 && !sep14 && !props.found) {
|
|
82512
|
+
const valueNode = value ? composeNode(ctx2, value, props, onError) : composeEmptyNode(ctx2, props.end, sep14, null, props, onError);
|
|
82383
82513
|
coll.items.push(valueNode);
|
|
82384
82514
|
offset = valueNode.range[2];
|
|
82385
82515
|
if (isBlock(value))
|
|
@@ -82391,7 +82521,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
82391
82521
|
if (isBlock(key))
|
|
82392
82522
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
82393
82523
|
ctx2.atKey = false;
|
|
82394
|
-
const valueProps = resolveProps.resolveProps(
|
|
82524
|
+
const valueProps = resolveProps.resolveProps(sep14 ?? [], {
|
|
82395
82525
|
flow: fcName,
|
|
82396
82526
|
indicator: "map-value-ind",
|
|
82397
82527
|
next: value,
|
|
@@ -82402,8 +82532,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
82402
82532
|
});
|
|
82403
82533
|
if (valueProps.found) {
|
|
82404
82534
|
if (!isMap3 && !props.found && ctx2.options.strict) {
|
|
82405
|
-
if (
|
|
82406
|
-
for (const st of
|
|
82535
|
+
if (sep14)
|
|
82536
|
+
for (const st of sep14) {
|
|
82407
82537
|
if (st === valueProps.found)
|
|
82408
82538
|
break;
|
|
82409
82539
|
if (st.type === "newline") {
|
|
@@ -82420,7 +82550,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
82420
82550
|
else
|
|
82421
82551
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
82422
82552
|
}
|
|
82423
|
-
const valueNode = value ? composeNode(ctx2, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx2, valueProps.end,
|
|
82553
|
+
const valueNode = value ? composeNode(ctx2, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx2, valueProps.end, sep14, null, valueProps, onError) : null;
|
|
82424
82554
|
if (valueNode) {
|
|
82425
82555
|
if (isBlock(value))
|
|
82426
82556
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -82600,7 +82730,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
82600
82730
|
chompStart = i2 + 1;
|
|
82601
82731
|
}
|
|
82602
82732
|
let value = "";
|
|
82603
|
-
let
|
|
82733
|
+
let sep14 = "";
|
|
82604
82734
|
let prevMoreIndented = false;
|
|
82605
82735
|
for (let i2 = 0; i2 < contentStart; ++i2)
|
|
82606
82736
|
value += lines[i2][0].slice(trimIndent) + "\n";
|
|
@@ -82617,24 +82747,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
82617
82747
|
indent = "";
|
|
82618
82748
|
}
|
|
82619
82749
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
82620
|
-
value +=
|
|
82621
|
-
|
|
82750
|
+
value += sep14 + indent.slice(trimIndent) + content;
|
|
82751
|
+
sep14 = "\n";
|
|
82622
82752
|
} else if (indent.length > trimIndent || content[0] === " ") {
|
|
82623
|
-
if (
|
|
82624
|
-
|
|
82625
|
-
else if (!prevMoreIndented &&
|
|
82626
|
-
|
|
82627
|
-
value +=
|
|
82628
|
-
|
|
82753
|
+
if (sep14 === " ")
|
|
82754
|
+
sep14 = "\n";
|
|
82755
|
+
else if (!prevMoreIndented && sep14 === "\n")
|
|
82756
|
+
sep14 = "\n\n";
|
|
82757
|
+
value += sep14 + indent.slice(trimIndent) + content;
|
|
82758
|
+
sep14 = "\n";
|
|
82629
82759
|
prevMoreIndented = true;
|
|
82630
82760
|
} else if (content === "") {
|
|
82631
|
-
if (
|
|
82761
|
+
if (sep14 === "\n")
|
|
82632
82762
|
value += "\n";
|
|
82633
82763
|
else
|
|
82634
|
-
|
|
82764
|
+
sep14 = "\n";
|
|
82635
82765
|
} else {
|
|
82636
|
-
value +=
|
|
82637
|
-
|
|
82766
|
+
value += sep14 + content;
|
|
82767
|
+
sep14 = " ";
|
|
82638
82768
|
prevMoreIndented = false;
|
|
82639
82769
|
}
|
|
82640
82770
|
}
|
|
@@ -82817,25 +82947,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
82817
82947
|
trimBoth = /^[ \t]+|[ \t]+$/g;
|
|
82818
82948
|
}
|
|
82819
82949
|
let res = match[1].replace(trimEnd, "");
|
|
82820
|
-
let
|
|
82950
|
+
let sep14 = " ";
|
|
82821
82951
|
let pos = line.lastIndex;
|
|
82822
82952
|
while (match = line.exec(source)) {
|
|
82823
82953
|
const lm = match[1].replace(trimBoth, "");
|
|
82824
82954
|
if (lm === "") {
|
|
82825
|
-
if (
|
|
82826
|
-
res +=
|
|
82955
|
+
if (sep14 === "\n")
|
|
82956
|
+
res += sep14;
|
|
82827
82957
|
else
|
|
82828
|
-
|
|
82958
|
+
sep14 = "\n";
|
|
82829
82959
|
} else {
|
|
82830
|
-
res +=
|
|
82831
|
-
|
|
82960
|
+
res += sep14 + lm;
|
|
82961
|
+
sep14 = " ";
|
|
82832
82962
|
}
|
|
82833
82963
|
pos = line.lastIndex;
|
|
82834
82964
|
}
|
|
82835
82965
|
const last = /[ \t]*(.*)/sy;
|
|
82836
82966
|
last.lastIndex = pos;
|
|
82837
82967
|
match = last.exec(source);
|
|
82838
|
-
return res +
|
|
82968
|
+
return res + sep14 + (match?.[1] ?? "");
|
|
82839
82969
|
}
|
|
82840
82970
|
function doubleQuotedValue(source, onError) {
|
|
82841
82971
|
let res = "";
|
|
@@ -83645,14 +83775,14 @@ var require_cst_stringify = __commonJS({
|
|
|
83645
83775
|
}
|
|
83646
83776
|
}
|
|
83647
83777
|
}
|
|
83648
|
-
function stringifyItem({ start, key, sep:
|
|
83778
|
+
function stringifyItem({ start, key, sep: sep14, value }) {
|
|
83649
83779
|
let res = "";
|
|
83650
83780
|
for (const st of start)
|
|
83651
83781
|
res += st.source;
|
|
83652
83782
|
if (key)
|
|
83653
83783
|
res += stringifyToken(key);
|
|
83654
|
-
if (
|
|
83655
|
-
for (const st of
|
|
83784
|
+
if (sep14)
|
|
83785
|
+
for (const st of sep14)
|
|
83656
83786
|
res += st.source;
|
|
83657
83787
|
if (value)
|
|
83658
83788
|
res += stringifyToken(value);
|
|
@@ -84819,18 +84949,18 @@ var require_parser = __commonJS({
|
|
|
84819
84949
|
if (this.type === "map-value-ind") {
|
|
84820
84950
|
const prev = getPrevProps(this.peek(2));
|
|
84821
84951
|
const start = getFirstKeyStartProps(prev);
|
|
84822
|
-
let
|
|
84952
|
+
let sep14;
|
|
84823
84953
|
if (scalar2.end) {
|
|
84824
|
-
|
|
84825
|
-
|
|
84954
|
+
sep14 = scalar2.end;
|
|
84955
|
+
sep14.push(this.sourceToken);
|
|
84826
84956
|
delete scalar2.end;
|
|
84827
84957
|
} else
|
|
84828
|
-
|
|
84958
|
+
sep14 = [this.sourceToken];
|
|
84829
84959
|
const map = {
|
|
84830
84960
|
type: "block-map",
|
|
84831
84961
|
offset: scalar2.offset,
|
|
84832
84962
|
indent: scalar2.indent,
|
|
84833
|
-
items: [{ start, key: scalar2, sep:
|
|
84963
|
+
items: [{ start, key: scalar2, sep: sep14 }]
|
|
84834
84964
|
};
|
|
84835
84965
|
this.onKeyLine = true;
|
|
84836
84966
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -84983,15 +85113,15 @@ var require_parser = __commonJS({
|
|
|
84983
85113
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
84984
85114
|
const start2 = getFirstKeyStartProps(it.start);
|
|
84985
85115
|
const key = it.key;
|
|
84986
|
-
const
|
|
84987
|
-
|
|
85116
|
+
const sep14 = it.sep;
|
|
85117
|
+
sep14.push(this.sourceToken);
|
|
84988
85118
|
delete it.key;
|
|
84989
85119
|
delete it.sep;
|
|
84990
85120
|
this.stack.push({
|
|
84991
85121
|
type: "block-map",
|
|
84992
85122
|
offset: this.offset,
|
|
84993
85123
|
indent: this.indent,
|
|
84994
|
-
items: [{ start: start2, key, sep:
|
|
85124
|
+
items: [{ start: start2, key, sep: sep14 }]
|
|
84995
85125
|
});
|
|
84996
85126
|
} else if (start.length > 0) {
|
|
84997
85127
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -85185,13 +85315,13 @@ var require_parser = __commonJS({
|
|
|
85185
85315
|
const prev = getPrevProps(parent);
|
|
85186
85316
|
const start = getFirstKeyStartProps(prev);
|
|
85187
85317
|
fixFlowSeqItems(fc);
|
|
85188
|
-
const
|
|
85189
|
-
|
|
85318
|
+
const sep14 = fc.end.splice(1, fc.end.length);
|
|
85319
|
+
sep14.push(this.sourceToken);
|
|
85190
85320
|
const map = {
|
|
85191
85321
|
type: "block-map",
|
|
85192
85322
|
offset: fc.offset,
|
|
85193
85323
|
indent: fc.indent,
|
|
85194
|
-
items: [{ start, key: fc, sep:
|
|
85324
|
+
items: [{ start, key: fc, sep: sep14 }]
|
|
85195
85325
|
};
|
|
85196
85326
|
this.onKeyLine = true;
|
|
85197
85327
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -86890,6 +87020,18 @@ async function sandboxRun(opts, writer = stdoutWriter, deps = {}) {
|
|
|
86890
87020
|
if (!workspace) return fail3(NO_WORKSPACE, "usage");
|
|
86891
87021
|
const org = getOrgId();
|
|
86892
87022
|
if (!org) return fail3(NO_ORG, "not_logged_in");
|
|
87023
|
+
if (opts.accountSource !== void 0 && !ACCOUNT_SOURCES.includes(opts.accountSource)) {
|
|
87024
|
+
return fail3(
|
|
87025
|
+
`Pass --account-source with one of: ${ACCOUNT_SOURCES.join(", ")}.`,
|
|
87026
|
+
"usage"
|
|
87027
|
+
);
|
|
87028
|
+
}
|
|
87029
|
+
if (opts.workOrder && (opts.accountSource || opts.confirmWorkspaceBilling)) {
|
|
87030
|
+
return fail3(
|
|
87031
|
+
"A work order runs on the account source its send recorded. Leave out --account-source and --confirm-workspace-billing.",
|
|
87032
|
+
"usage"
|
|
87033
|
+
);
|
|
87034
|
+
}
|
|
86893
87035
|
if (opts.workOrder) {
|
|
86894
87036
|
if (opts.repo || opts.repoProvider || opts.branch || opts.prompt || opts.promptFile) {
|
|
86895
87037
|
return fail3(
|
|
@@ -86940,6 +87082,8 @@ async function sandboxRun(opts, writer = stdoutWriter, deps = {}) {
|
|
|
86940
87082
|
...opts.runtime ? { runtime: opts.runtime } : {},
|
|
86941
87083
|
...prompt !== void 0 ? { prompt } : {},
|
|
86942
87084
|
...opts.workOrder ? { workOrderId: opts.workOrder } : {},
|
|
87085
|
+
...opts.accountSource ? { accountSource: opts.accountSource } : {},
|
|
87086
|
+
...opts.confirmWorkspaceBilling ? { confirmWorkspaceBilling: true } : {},
|
|
86943
87087
|
launchedVia: "cli"
|
|
86944
87088
|
};
|
|
86945
87089
|
let run3;
|
|
@@ -87154,13 +87298,18 @@ async function sandboxShow(run3, opts, writer = stdoutWriter) {
|
|
|
87154
87298
|
}
|
|
87155
87299
|
}
|
|
87156
87300
|
}
|
|
87157
|
-
var NO_WORKSPACE, NO_ORG, NO_RUNTIME_HINT, REPO_SLUG, REPO_PROVIDERS, SANDBOX_STATES;
|
|
87301
|
+
var ACCOUNT_SOURCES, NO_WORKSPACE, NO_ORG, NO_RUNTIME_HINT, REPO_SLUG, REPO_PROVIDERS, SANDBOX_STATES;
|
|
87158
87302
|
var init_sandbox_run = __esm({
|
|
87159
87303
|
"src/commands/sandbox-run.ts"() {
|
|
87160
87304
|
init_api();
|
|
87161
87305
|
init_config();
|
|
87162
87306
|
init_capture_writer();
|
|
87163
87307
|
init_output();
|
|
87308
|
+
ACCOUNT_SOURCES = [
|
|
87309
|
+
"operator",
|
|
87310
|
+
"workspace",
|
|
87311
|
+
"operator_then_workspace"
|
|
87312
|
+
];
|
|
87164
87313
|
NO_WORKSPACE = "Name a workspace with --workspace-slug <slug> or OXAGEN_WORKSPACE. The CLI does not pick one for you.";
|
|
87165
87314
|
NO_ORG = "No organization is selected. Run `oxagen login`, or set OXAGEN_ORG_ID.";
|
|
87166
87315
|
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 +87497,7 @@ var sandbox_template_exports = {};
|
|
|
87348
87497
|
__export(sandbox_template_exports, {
|
|
87349
87498
|
STARTER_IDS: () => STARTER_IDS,
|
|
87350
87499
|
sandboxTemplateGenerate: () => sandboxTemplateGenerate,
|
|
87500
|
+
sandboxTemplateLog: () => sandboxTemplateLog,
|
|
87351
87501
|
sandboxTemplateTest: () => sandboxTemplateTest
|
|
87352
87502
|
});
|
|
87353
87503
|
async function sandboxTemplateGenerate(opts, writer = stdoutWriter) {
|
|
@@ -87563,7 +87713,51 @@ function testLines(test) {
|
|
|
87563
87713
|
}
|
|
87564
87714
|
return lines;
|
|
87565
87715
|
}
|
|
87566
|
-
|
|
87716
|
+
async function sandboxTemplateLog(runtime, build, opts, writer = stdoutWriter) {
|
|
87717
|
+
const out = createOutput({ json: opts.json }, writer);
|
|
87718
|
+
if (!RUNTIME_ID2.test(runtime)) {
|
|
87719
|
+
return out.error(
|
|
87720
|
+
`Name the sandbox runtime by its id, which starts with rtm_. "${runtime}" is not a runtime id.`,
|
|
87721
|
+
"usage"
|
|
87722
|
+
);
|
|
87723
|
+
}
|
|
87724
|
+
if (!TEMPLATE_ID.test(build)) {
|
|
87725
|
+
return out.error(
|
|
87726
|
+
`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.`,
|
|
87727
|
+
"usage"
|
|
87728
|
+
);
|
|
87729
|
+
}
|
|
87730
|
+
const workspace = namedWorkspace(opts.workspaceSlug);
|
|
87731
|
+
if (!workspace) return out.error(NO_WORKSPACE, "usage");
|
|
87732
|
+
const org = getOrgId();
|
|
87733
|
+
if (!org) return out.error(NO_ORG, "not_logged_in");
|
|
87734
|
+
let answer;
|
|
87735
|
+
try {
|
|
87736
|
+
answer = await apiPostOrThrow(
|
|
87737
|
+
"sandbox-templates/build-log",
|
|
87738
|
+
{ runtimeId: runtime, templateId: build },
|
|
87739
|
+
{ org, ws: workspace }
|
|
87740
|
+
);
|
|
87741
|
+
} catch (err2) {
|
|
87742
|
+
const refusal = refusalOf3(err2);
|
|
87743
|
+
return out.error(refusal.message, refusal.reason ?? "api");
|
|
87744
|
+
}
|
|
87745
|
+
if (out.isJson) {
|
|
87746
|
+
out.data(answer);
|
|
87747
|
+
return;
|
|
87748
|
+
}
|
|
87749
|
+
if (answer.log === null) {
|
|
87750
|
+
writer.writeErr(
|
|
87751
|
+
`Build ${build} stored no log. \`oxagen sandbox runtime list --json\` shows its failure reason.`
|
|
87752
|
+
);
|
|
87753
|
+
return;
|
|
87754
|
+
}
|
|
87755
|
+
if (answer.log.truncated) {
|
|
87756
|
+
writer.writeErr("The log is long, so this shows its last 256 KiB.");
|
|
87757
|
+
}
|
|
87758
|
+
writer.write(answer.log.text);
|
|
87759
|
+
}
|
|
87760
|
+
var STARTERS, STARTER_IDS, ROUTE_TEXT, POLL_MS, MAX_WAIT_MS, RUNTIME_ID2, TEMPLATE_ID;
|
|
87567
87761
|
var init_sandbox_template = __esm({
|
|
87568
87762
|
"src/commands/sandbox-template.ts"() {
|
|
87569
87763
|
init_api();
|
|
@@ -87587,6 +87781,7 @@ var init_sandbox_template = __esm({
|
|
|
87587
87781
|
POLL_MS = 5e3;
|
|
87588
87782
|
MAX_WAIT_MS = 12 * 6e4;
|
|
87589
87783
|
RUNTIME_ID2 = /^rtm_[0-9a-z]+$/;
|
|
87784
|
+
TEMPLATE_ID = /^rtp_[0-9a-z]+$/;
|
|
87590
87785
|
}
|
|
87591
87786
|
});
|
|
87592
87787
|
|
|
@@ -87607,6 +87802,15 @@ function templateFromFlags(flags) {
|
|
|
87607
87802
|
if (flags.dockerfile !== void 0)
|
|
87608
87803
|
named.push(["dockerfile", flags.dockerfile]);
|
|
87609
87804
|
const services = flags.service ?? [];
|
|
87805
|
+
const setup = flags.setupCommand === void 0 ? void 0 : {
|
|
87806
|
+
command: flags.setupCommand,
|
|
87807
|
+
workingDirectory: flags.setupDir ?? "/"
|
|
87808
|
+
};
|
|
87809
|
+
if (flags.setupDir !== void 0 && setup === void 0) {
|
|
87810
|
+
return {
|
|
87811
|
+
error: "--setup-dir names the folder the setup command runs in. Pass --setup-command with it."
|
|
87812
|
+
};
|
|
87813
|
+
}
|
|
87610
87814
|
if (named.length > 1) {
|
|
87611
87815
|
return {
|
|
87612
87816
|
error: "Pass one of --image, --pinned-image, or --dockerfile. Each names a whole template."
|
|
@@ -87614,16 +87818,21 @@ function templateFromFlags(flags) {
|
|
|
87614
87818
|
}
|
|
87615
87819
|
const [first] = named;
|
|
87616
87820
|
if (first === void 0) {
|
|
87617
|
-
|
|
87618
|
-
|
|
87619
|
-
|
|
87821
|
+
if (services.length > 0)
|
|
87822
|
+
return {
|
|
87823
|
+
error: "--service adds a service to a template. Pass --image, --pinned-image, or --dockerfile with it."
|
|
87824
|
+
};
|
|
87825
|
+
return setup === void 0 ? {} : {
|
|
87826
|
+
error: "--setup-command is part of a template. Pass --image, --pinned-image, or --dockerfile with it."
|
|
87827
|
+
};
|
|
87620
87828
|
}
|
|
87621
87829
|
const [sourceKind, sourceRef] = first;
|
|
87622
87830
|
return {
|
|
87623
87831
|
template: {
|
|
87624
87832
|
sourceKind,
|
|
87625
87833
|
sourceRef,
|
|
87626
|
-
...services.length > 0 ? { services } : {}
|
|
87834
|
+
...services.length > 0 ? { services } : {},
|
|
87835
|
+
...setup === void 0 ? {} : { setup }
|
|
87627
87836
|
}
|
|
87628
87837
|
};
|
|
87629
87838
|
}
|
|
@@ -93455,7 +93664,7 @@ function compareModels(usage3) {
|
|
|
93455
93664
|
function listRateCard() {
|
|
93456
93665
|
return RATE_CARD.filter((e) => !e.alias);
|
|
93457
93666
|
}
|
|
93458
|
-
var HAIKU_5_5_LONG_CONTEXT, RATE_CARD, FALLBACK_RATE;
|
|
93667
|
+
var HAIKU_5_5_LONG_CONTEXT, QWEN_3_7_FLASH_LONG_CONTEXT, RATE_CARD, FALLBACK_RATE;
|
|
93459
93668
|
var init_rate_card = __esm({
|
|
93460
93669
|
"../../packages/billing/src/rate-card.ts"() {
|
|
93461
93670
|
"use strict";
|
|
@@ -93466,6 +93675,13 @@ var init_rate_card = __esm({
|
|
|
93466
93675
|
cachedInputPer1M: 0.05,
|
|
93467
93676
|
cacheWritePer1M: 0.625
|
|
93468
93677
|
};
|
|
93678
|
+
QWEN_3_7_FLASH_LONG_CONTEXT = {
|
|
93679
|
+
abovePromptTokens: 32e3,
|
|
93680
|
+
inputPer1M: 0.1,
|
|
93681
|
+
outputPer1M: 0.4,
|
|
93682
|
+
cachedInputPer1M: 0.02,
|
|
93683
|
+
cacheWritePer1M: 0.125
|
|
93684
|
+
};
|
|
93469
93685
|
RATE_CARD = [
|
|
93470
93686
|
// Fable 5.1 and Opus 5.5 break from their family's price, so each gets a row
|
|
93471
93687
|
// for both the hyphenated and the dotted gateway spelling, the dotted one
|
|
@@ -93914,7 +94130,20 @@ var init_rate_card = __esm({
|
|
|
93914
94130
|
},
|
|
93915
94131
|
// Zhipu GLM rows from the AI Gateway's /v1/models pricing (2026-07-10).
|
|
93916
94132
|
// Specific families MUST sort before the generic "glm" prefix row (same
|
|
93917
|
-
// first-match rule as the gpt-5.5 rows above).
|
|
94133
|
+
// first-match rule as the gpt-5.5 rows above). GLM 5.3 Flash is from
|
|
94134
|
+
// OpenRouter's model list (2026-10-28), which prices a cache read at the
|
|
94135
|
+
// fresh input rate.
|
|
94136
|
+
{
|
|
94137
|
+
family: "glm-5.3-flash",
|
|
94138
|
+
label: "GLM 5.3 Flash",
|
|
94139
|
+
vendor: "zai",
|
|
94140
|
+
rate: {
|
|
94141
|
+
inputPer1M: 0.0259,
|
|
94142
|
+
outputPer1M: 0.1042,
|
|
94143
|
+
cachedInputPer1M: 0.0259,
|
|
94144
|
+
cacheWritePer1M: 0.0259
|
|
94145
|
+
}
|
|
94146
|
+
},
|
|
93918
94147
|
{
|
|
93919
94148
|
family: "glm-5.2-fast",
|
|
93920
94149
|
label: "GLM 5.2 Fast",
|
|
@@ -94046,6 +94275,22 @@ var init_rate_card = __esm({
|
|
|
94046
94275
|
cacheWritePer1M: 0.28
|
|
94047
94276
|
}
|
|
94048
94277
|
},
|
|
94278
|
+
// Qwen3.7 Flash at OpenRouter's price (2026-10-28). Unlike the other
|
|
94279
|
+
// vendors here, OpenRouter lists a cache write above fresh input for it:
|
|
94280
|
+
// $0.038 against $0.03. There is no generic "qwen" row, so another Qwen
|
|
94281
|
+
// model still falls back.
|
|
94282
|
+
{
|
|
94283
|
+
family: "qwen3.7-flash",
|
|
94284
|
+
label: "Qwen3.7 Flash",
|
|
94285
|
+
vendor: "qwen",
|
|
94286
|
+
rate: {
|
|
94287
|
+
inputPer1M: 0.03,
|
|
94288
|
+
outputPer1M: 0.13,
|
|
94289
|
+
cachedInputPer1M: 6e-3,
|
|
94290
|
+
cacheWritePer1M: 0.038,
|
|
94291
|
+
longContext: QWEN_3_7_FLASH_LONG_CONTEXT
|
|
94292
|
+
}
|
|
94293
|
+
},
|
|
94049
94294
|
// Gateway /v1/models 2026-07-07 (base tier ≤200k): gemini-3-pro* $2/$12.
|
|
94050
94295
|
{
|
|
94051
94296
|
family: "gemini-3-pro",
|
|
@@ -94085,6 +94330,19 @@ var init_rate_card = __esm({
|
|
|
94085
94330
|
cacheWritePer1M: 0.5
|
|
94086
94331
|
}
|
|
94087
94332
|
},
|
|
94333
|
+
// Gemini 3.8 Flash at OpenRouter's price (2026-10-28), the batch triage
|
|
94334
|
+
// model. It MUST sort before the generic "gemini" row.
|
|
94335
|
+
{
|
|
94336
|
+
family: "gemini-3.8-flash",
|
|
94337
|
+
label: "Gemini 3.8 Flash",
|
|
94338
|
+
vendor: "google",
|
|
94339
|
+
rate: {
|
|
94340
|
+
inputPer1M: 0.825,
|
|
94341
|
+
outputPer1M: 4.125,
|
|
94342
|
+
cachedInputPer1M: 0.0825,
|
|
94343
|
+
cacheWritePer1M: 0.825
|
|
94344
|
+
}
|
|
94345
|
+
},
|
|
94088
94346
|
{
|
|
94089
94347
|
family: "gemini",
|
|
94090
94348
|
label: "Gemini",
|
|
@@ -98238,26 +98496,14 @@ var init_steering_findings = __esm({
|
|
|
98238
98496
|
// src/commands/repo.ts
|
|
98239
98497
|
var repo_exports = {};
|
|
98240
98498
|
__export(repo_exports, {
|
|
98241
|
-
draftGovernanceToml: () => draftGovernanceToml,
|
|
98242
98499
|
parseRepositoryRef: () => parseRepositoryRef,
|
|
98243
98500
|
repoBranch: () => repoBranch,
|
|
98244
98501
|
repoGovernance: () => repoGovernance,
|
|
98245
|
-
repoInit: () => repoInit,
|
|
98246
98502
|
repoLink: () => repoLink,
|
|
98247
98503
|
repoList: () => repoList,
|
|
98248
98504
|
repoTree: () => repoTree,
|
|
98249
98505
|
repoUnlink: () => repoUnlink
|
|
98250
98506
|
});
|
|
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
98507
|
function parseRepositoryRef(ref) {
|
|
98262
98508
|
const parts = ref.trim().split("/");
|
|
98263
98509
|
if (parts.length !== 2) return null;
|
|
@@ -98380,20 +98626,21 @@ async function repoUnlink(bindingId, opts = {}, writer = stdoutWriter) {
|
|
|
98380
98626
|
"Its binding versions stay as evidence for the runs that cited them. Link it again to write the next version."
|
|
98381
98627
|
);
|
|
98382
98628
|
}
|
|
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
|
-
}
|
|
98629
|
+
async function repoTree(opts = {}, writer = stdoutWriter) {
|
|
98392
98630
|
const out = createOutput({ json: opts.json }, writer);
|
|
98393
98631
|
let result2;
|
|
98394
98632
|
try {
|
|
98633
|
+
const { repositories } = await apiGetOrThrow("repositories");
|
|
98634
|
+
const steeringRepo = repositories.find((repo) => repo.role === "main");
|
|
98635
|
+
if (steeringRepo === void 0) {
|
|
98636
|
+
out.error(
|
|
98637
|
+
"This workspace has no steering repository yet.",
|
|
98638
|
+
"main_repo_unbound"
|
|
98639
|
+
);
|
|
98640
|
+
return;
|
|
98641
|
+
}
|
|
98395
98642
|
result2 = await apiPostOrThrow("repository/tree", {
|
|
98396
|
-
bindingId:
|
|
98643
|
+
bindingId: steeringRepo.bindingId
|
|
98397
98644
|
});
|
|
98398
98645
|
} catch (err2) {
|
|
98399
98646
|
out.error(err2, "api");
|
|
@@ -98413,9 +98660,7 @@ async function repoTree(bindingId, opts = {}, writer = stdoutWriter) {
|
|
|
98413
98660
|
}
|
|
98414
98661
|
const steering = result2.steering?.present === true;
|
|
98415
98662
|
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
|
-
);
|
|
98663
|
+
writer.write("No steering files on the production branch.");
|
|
98419
98664
|
return;
|
|
98420
98665
|
}
|
|
98421
98666
|
writer.write(`governance mode: ${result2.governanceMode}`);
|
|
@@ -98451,59 +98696,6 @@ async function repoBranch(bindingId, branch, opts = {}, writer = stdoutWriter) {
|
|
|
98451
98696
|
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
98697
|
);
|
|
98453
98698
|
}
|
|
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
98699
|
async function repoGovernance(opts = {}, writer = stdoutWriter) {
|
|
98508
98700
|
const line = "oxagen repo governance --mode solo|team|regulated [--workspace <wrk_\u2026>] [--apply-now] [--json]";
|
|
98509
98701
|
const mode = opts.mode;
|
|
@@ -99208,7 +99400,7 @@ function recordLineageFromPath(path2) {
|
|
|
99208
99400
|
return parts[parts.length - 1].slice(0, -3);
|
|
99209
99401
|
return null;
|
|
99210
99402
|
}
|
|
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
|
|
99403
|
+
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
99404
|
var init_paths2 = __esm({
|
|
99213
99405
|
"../../packages/oxagen/src/steering-repo/paths.ts"() {
|
|
99214
99406
|
"use strict";
|
|
@@ -99260,7 +99452,6 @@ var init_paths2 = __esm({
|
|
|
99260
99452
|
"schema.graphql": "server-definition"
|
|
99261
99453
|
};
|
|
99262
99454
|
SANDBOX_SERVICE_NAME = /^[a-z0-9][a-z0-9@._-]{0,127}$/;
|
|
99263
|
-
WORKSPACE_LINK_PATH = ".oxagen/workspace.json";
|
|
99264
99455
|
}
|
|
99265
99456
|
});
|
|
99266
99457
|
|
|
@@ -104249,15 +104440,35 @@ var init_schemas2 = __esm({
|
|
|
104249
104440
|
});
|
|
104250
104441
|
|
|
104251
104442
|
// ../../packages/oxagen/src/steering-repo/settings-baseline.ts
|
|
104252
|
-
var OXAGEN_STEERING_APP, GITLAB_SETTINGS_BASELINE;
|
|
104443
|
+
var OXAGEN_STEERING_APP, GITHUB_MAIN_PROTECTION, GITLAB_SETTINGS_BASELINE;
|
|
104253
104444
|
var init_settings_baseline = __esm({
|
|
104254
104445
|
"../../packages/oxagen/src/steering-repo/settings-baseline.ts"() {
|
|
104255
104446
|
"use strict";
|
|
104256
104447
|
init_names();
|
|
104257
104448
|
OXAGEN_STEERING_APP = "oxagen-steering";
|
|
104449
|
+
GITHUB_MAIN_PROTECTION = {
|
|
104450
|
+
name: "Oxagen steering",
|
|
104451
|
+
target: "branch",
|
|
104452
|
+
enforcement: "active",
|
|
104453
|
+
include: [`refs/heads/${STEERING_DEFAULT_BRANCH}`],
|
|
104454
|
+
bypass_actors: [],
|
|
104455
|
+
rules: [
|
|
104456
|
+
{
|
|
104457
|
+
type: "pull_request",
|
|
104458
|
+
parameters: {
|
|
104459
|
+
required_approving_review_count: 0,
|
|
104460
|
+
dismiss_stale_reviews_on_push: false,
|
|
104461
|
+
require_code_owner_review: false,
|
|
104462
|
+
require_last_push_approval: false,
|
|
104463
|
+
required_review_thread_resolution: false
|
|
104464
|
+
}
|
|
104465
|
+
}
|
|
104466
|
+
]
|
|
104467
|
+
};
|
|
104258
104468
|
GITLAB_SETTINGS_BASELINE = {
|
|
104259
104469
|
visibility: "private",
|
|
104260
104470
|
default_branch: STEERING_DEFAULT_BRANCH,
|
|
104471
|
+
// Creation protects main so no one pushes and only the Oxagen bot merges.
|
|
104261
104472
|
protected_branches: {
|
|
104262
104473
|
[STEERING_DEFAULT_BRANCH]: {
|
|
104263
104474
|
push_access: "no_one",
|
|
@@ -106678,32 +106889,19 @@ function shown2(value) {
|
|
|
106678
106889
|
return text6.length > 120 ? `${text6.slice(0, 117)}...` : text6;
|
|
106679
106890
|
}
|
|
106680
106891
|
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") {
|
|
106892
|
+
const { setting: setting2, expected, actual } = difference;
|
|
106893
|
+
if (SQUASH_SETTINGS.has(setting2) && actual === false) {
|
|
106691
106894
|
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.`
|
|
106895
|
+
rule: "squash-merge-off",
|
|
106896
|
+
message: "Squash merging is off",
|
|
106897
|
+
expected: "Squash merging is on.",
|
|
106898
|
+
fix: `${REPAIR} Or turn squash merging back on by hand. Oxagen merges every steering pull request with a squash.`
|
|
106702
106899
|
};
|
|
106703
106900
|
}
|
|
106704
106901
|
return {
|
|
106705
106902
|
rule: "setting-differs",
|
|
106706
106903
|
message: `${setting2} is ${shown2(actual)}`,
|
|
106904
|
+
expected: `${setting2} is ${shown2(expected)}.`,
|
|
106707
106905
|
fix: `${REPAIR} Or set it back by hand.`
|
|
106708
106906
|
};
|
|
106709
106907
|
}
|
|
@@ -106715,13 +106913,17 @@ function changedBy(difference) {
|
|
|
106715
106913
|
if (by) return ` (by ${by})`;
|
|
106716
106914
|
return "";
|
|
106717
106915
|
}
|
|
106718
|
-
var find11, REPAIR, settingsCheck;
|
|
106916
|
+
var find11, REPAIR, SQUASH_SETTINGS, settingsCheck;
|
|
106719
106917
|
var init_settings = __esm({
|
|
106720
106918
|
"../../packages/steering-check/src/checks/settings.ts"() {
|
|
106721
106919
|
"use strict";
|
|
106722
106920
|
init_finding();
|
|
106723
106921
|
find11 = finder("settings");
|
|
106724
106922
|
REPAIR = "A workspace admin opens Workspace settings, then Steering repo, and selects Repair settings.";
|
|
106923
|
+
SQUASH_SETTINGS = /* @__PURE__ */ new Set([
|
|
106924
|
+
"merge.allow_squash_merge",
|
|
106925
|
+
"merge_requests.squash_allowed"
|
|
106926
|
+
]);
|
|
106725
106927
|
settingsCheck = (env) => {
|
|
106726
106928
|
if (env.health === null) {
|
|
106727
106929
|
return {
|
|
@@ -106729,20 +106931,20 @@ var init_settings = __esm({
|
|
|
106729
106931
|
};
|
|
106730
106932
|
}
|
|
106731
106933
|
const findings = env.health.differences.map((difference) => {
|
|
106732
|
-
const { rule, message: message2, fix } = describe7(difference);
|
|
106934
|
+
const { rule, message: message2, expected, fix } = describe7(difference);
|
|
106733
106935
|
return find11({
|
|
106734
106936
|
rule,
|
|
106735
106937
|
path: difference.setting,
|
|
106736
106938
|
line: null,
|
|
106737
106939
|
field: null,
|
|
106738
106940
|
message: `${message2}${changedBy(difference)}.`,
|
|
106739
|
-
expected
|
|
106941
|
+
expected,
|
|
106740
106942
|
fix
|
|
106741
106943
|
});
|
|
106742
106944
|
});
|
|
106743
106945
|
return findings.length === 0 ? { findings } : {
|
|
106744
106946
|
findings,
|
|
106745
|
-
note: "
|
|
106947
|
+
note: "Oxagen merges no steering pull request while these settings differ."
|
|
106746
106948
|
};
|
|
106747
106949
|
};
|
|
106748
106950
|
}
|
|
@@ -107220,7 +107422,7 @@ var init_memory_client = __esm({
|
|
|
107220
107422
|
});
|
|
107221
107423
|
|
|
107222
107424
|
// src/lib/markdown-import.ts
|
|
107223
|
-
import { readFile as
|
|
107425
|
+
import { readFile as readFile6 } from "node:fs/promises";
|
|
107224
107426
|
import {
|
|
107225
107427
|
basename as basename10,
|
|
107226
107428
|
dirname as dirname35,
|
|
@@ -107249,7 +107451,7 @@ async function readImportDocuments(sources, target, writer) {
|
|
|
107249
107451
|
for (const source of sources) {
|
|
107250
107452
|
let content;
|
|
107251
107453
|
try {
|
|
107252
|
-
content = await
|
|
107454
|
+
content = await readFile6(source.path, "utf8");
|
|
107253
107455
|
} catch {
|
|
107254
107456
|
unreadable.push(source.path);
|
|
107255
107457
|
continue;
|
|
@@ -107272,7 +107474,7 @@ async function readImportDocuments(sources, target, writer) {
|
|
|
107272
107474
|
for (const file of source.files) {
|
|
107273
107475
|
let text6;
|
|
107274
107476
|
try {
|
|
107275
|
-
text6 = await
|
|
107477
|
+
text6 = await readFile6(file.file, "utf8");
|
|
107276
107478
|
} catch {
|
|
107277
107479
|
unreadable.push(file.file);
|
|
107278
107480
|
continue;
|
|
@@ -108154,9 +108356,9 @@ function formatDismissResult(result2, restore) {
|
|
|
108154
108356
|
}
|
|
108155
108357
|
function formatDropResult(result2) {
|
|
108156
108358
|
const pr = result2.pull_request;
|
|
108157
|
-
const
|
|
108359
|
+
const short4 = result2.commit_sha.slice(0, 7);
|
|
108158
108360
|
return [
|
|
108159
|
-
result2.already_dropped ? `${result2.path} was already dropped from memory PR #${pr.number} in commit ${
|
|
108361
|
+
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
108362
|
"When the PR merges, the record's statements are rejected and its memories wait again.",
|
|
108161
108363
|
pr.url
|
|
108162
108364
|
].join("\n");
|
|
@@ -109722,6 +109924,12 @@ __export(credentials_exports, {
|
|
|
109722
109924
|
credentialsUpdate: () => credentialsUpdate,
|
|
109723
109925
|
readSecret: () => readSecret
|
|
109724
109926
|
});
|
|
109927
|
+
function sharedBody(opts) {
|
|
109928
|
+
return opts.shared ? { scope: "workspace" } : {};
|
|
109929
|
+
}
|
|
109930
|
+
function sharedQuery(opts) {
|
|
109931
|
+
return opts.shared ? "?scope=workspace" : "";
|
|
109932
|
+
}
|
|
109725
109933
|
async function readSecret(label, io = {
|
|
109726
109934
|
stdin: process.stdin,
|
|
109727
109935
|
prompt: (text6) => process.stderr.write(text6)
|
|
@@ -109876,13 +110084,17 @@ async function credentialsAdd(opts, writer = stdoutWriter, deps = {}) {
|
|
|
109876
110084
|
);
|
|
109877
110085
|
}
|
|
109878
110086
|
try {
|
|
109879
|
-
const { credential } = await apiPostOrThrow(
|
|
110087
|
+
const { credential } = await apiPostOrThrow(
|
|
110088
|
+
"user/model-credentials",
|
|
110089
|
+
{ ...body2, ...sharedBody(opts), secret },
|
|
110090
|
+
scope
|
|
110091
|
+
);
|
|
109880
110092
|
if (out.isJson) {
|
|
109881
110093
|
out.data({ credential });
|
|
109882
110094
|
return;
|
|
109883
110095
|
}
|
|
109884
110096
|
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.`
|
|
110097
|
+
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
110098
|
);
|
|
109887
110099
|
} catch (err2) {
|
|
109888
110100
|
const refusal = refusalOf3(err2);
|
|
@@ -109896,7 +110108,7 @@ async function credentialsList(opts, writer = stdoutWriter) {
|
|
|
109896
110108
|
try {
|
|
109897
110109
|
const { items } = await apiGetOrThrow(
|
|
109898
110110
|
"user/model-credentials",
|
|
109899
|
-
void 0,
|
|
110111
|
+
opts.shared ? { scope: "workspace" } : void 0,
|
|
109900
110112
|
scope
|
|
109901
110113
|
);
|
|
109902
110114
|
if (out.isJson) {
|
|
@@ -109964,7 +110176,8 @@ async function credentialsUpdate(credentialId, opts, writer = stdoutWriter) {
|
|
|
109964
110176
|
{
|
|
109965
110177
|
...opts.label !== void 0 ? { label: opts.label } : {},
|
|
109966
110178
|
...opts.pause ? { paused: true } : {},
|
|
109967
|
-
...opts.resume ? { paused: false } : {}
|
|
110179
|
+
...opts.resume ? { paused: false } : {},
|
|
110180
|
+
...sharedBody(opts)
|
|
109968
110181
|
},
|
|
109969
110182
|
scope
|
|
109970
110183
|
);
|
|
@@ -110010,7 +110223,7 @@ async function credentialsRotate(credentialId, opts, writer = stdoutWriter, deps
|
|
|
110010
110223
|
try {
|
|
110011
110224
|
const { items } = await apiGetOrThrow(
|
|
110012
110225
|
"user/model-credentials",
|
|
110013
|
-
void 0,
|
|
110226
|
+
opts.shared ? { scope: "workspace" } : void 0,
|
|
110014
110227
|
scope
|
|
110015
110228
|
);
|
|
110016
110229
|
current = items.find((c) => c.id === credentialId);
|
|
@@ -110059,7 +110272,7 @@ async function credentialsRotate(credentialId, opts, writer = stdoutWriter, deps
|
|
|
110059
110272
|
try {
|
|
110060
110273
|
const { credential } = await apiPostOrThrow(
|
|
110061
110274
|
`user/model-credentials/${encodeURIComponent(credentialId)}/rotate`,
|
|
110062
|
-
{ secret },
|
|
110275
|
+
{ secret, ...sharedBody(opts) },
|
|
110063
110276
|
scope
|
|
110064
110277
|
);
|
|
110065
110278
|
if (out.isJson) {
|
|
@@ -110080,7 +110293,10 @@ async function credentialsRemove(credentialId, opts, writer = stdoutWriter) {
|
|
|
110080
110293
|
const scope = scopeFor(opts);
|
|
110081
110294
|
if ("error" in scope) return out.error(scope.error, "usage");
|
|
110082
110295
|
try {
|
|
110083
|
-
const { credential } = await apiDeleteOrThrow(
|
|
110296
|
+
const { credential } = await apiDeleteOrThrow(
|
|
110297
|
+
`user/model-credentials/${encodeURIComponent(credentialId)}${sharedQuery(opts)}`,
|
|
110298
|
+
scope
|
|
110299
|
+
);
|
|
110084
110300
|
if (out.isJson) {
|
|
110085
110301
|
out.data({ credential });
|
|
110086
110302
|
return;
|
|
@@ -124726,49 +124942,49 @@ var require_fast_uri = __commonJS({
|
|
|
124726
124942
|
schemelessOptions.skipEscape = true;
|
|
124727
124943
|
return serialize2(resolved, schemelessOptions);
|
|
124728
124944
|
}
|
|
124729
|
-
function resolveComponent(base2,
|
|
124945
|
+
function resolveComponent(base2, relative11, options, skipNormalization) {
|
|
124730
124946
|
const target = {};
|
|
124731
124947
|
if (!skipNormalization) {
|
|
124732
124948
|
base2 = parse4(serialize2(base2, options), options);
|
|
124733
|
-
|
|
124949
|
+
relative11 = parse4(serialize2(relative11, options), options);
|
|
124734
124950
|
}
|
|
124735
124951
|
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 =
|
|
124952
|
+
if (!options.tolerant && relative11.scheme) {
|
|
124953
|
+
target.scheme = relative11.scheme;
|
|
124954
|
+
target.userinfo = relative11.userinfo;
|
|
124955
|
+
target.host = relative11.host;
|
|
124956
|
+
target.port = relative11.port;
|
|
124957
|
+
target.path = removeDotSegments(relative11.path || "");
|
|
124958
|
+
target.query = relative11.query;
|
|
124743
124959
|
} else {
|
|
124744
|
-
if (
|
|
124745
|
-
target.userinfo =
|
|
124746
|
-
target.host =
|
|
124747
|
-
target.port =
|
|
124748
|
-
target.path = removeDotSegments(
|
|
124749
|
-
target.query =
|
|
124960
|
+
if (relative11.userinfo !== void 0 || relative11.host !== void 0 || relative11.port !== void 0) {
|
|
124961
|
+
target.userinfo = relative11.userinfo;
|
|
124962
|
+
target.host = relative11.host;
|
|
124963
|
+
target.port = relative11.port;
|
|
124964
|
+
target.path = removeDotSegments(relative11.path || "");
|
|
124965
|
+
target.query = relative11.query;
|
|
124750
124966
|
} else {
|
|
124751
|
-
if (!
|
|
124967
|
+
if (!relative11.path) {
|
|
124752
124968
|
target.path = base2.path;
|
|
124753
|
-
if (
|
|
124754
|
-
target.query =
|
|
124969
|
+
if (relative11.query !== void 0) {
|
|
124970
|
+
target.query = relative11.query;
|
|
124755
124971
|
} else {
|
|
124756
124972
|
target.query = base2.query;
|
|
124757
124973
|
}
|
|
124758
124974
|
} else {
|
|
124759
|
-
if (
|
|
124760
|
-
target.path = removeDotSegments(
|
|
124975
|
+
if (relative11.path[0] === "/") {
|
|
124976
|
+
target.path = removeDotSegments(relative11.path);
|
|
124761
124977
|
} else {
|
|
124762
124978
|
if ((base2.userinfo !== void 0 || base2.host !== void 0 || base2.port !== void 0) && !base2.path) {
|
|
124763
|
-
target.path = "/" +
|
|
124979
|
+
target.path = "/" + relative11.path;
|
|
124764
124980
|
} else if (!base2.path) {
|
|
124765
|
-
target.path =
|
|
124981
|
+
target.path = relative11.path;
|
|
124766
124982
|
} else {
|
|
124767
|
-
target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) +
|
|
124983
|
+
target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) + relative11.path;
|
|
124768
124984
|
}
|
|
124769
124985
|
target.path = removeDotSegments(target.path);
|
|
124770
124986
|
}
|
|
124771
|
-
target.query =
|
|
124987
|
+
target.query = relative11.query;
|
|
124772
124988
|
}
|
|
124773
124989
|
target.userinfo = base2.userinfo;
|
|
124774
124990
|
target.host = base2.host;
|
|
@@ -124776,7 +124992,7 @@ var require_fast_uri = __commonJS({
|
|
|
124776
124992
|
}
|
|
124777
124993
|
target.scheme = base2.scheme;
|
|
124778
124994
|
}
|
|
124779
|
-
target.fragment =
|
|
124995
|
+
target.fragment = relative11.fragment;
|
|
124780
124996
|
return target;
|
|
124781
124997
|
}
|
|
124782
124998
|
function equal(uriA, uriB, options) {
|
|
@@ -128946,7 +129162,7 @@ __export(mcp_exports, {
|
|
|
128946
129162
|
mcpDescribe: () => mcpDescribe,
|
|
128947
129163
|
mcpList: () => mcpList
|
|
128948
129164
|
});
|
|
128949
|
-
import { readFile as
|
|
129165
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
128950
129166
|
function errorDetails(error2) {
|
|
128951
129167
|
return {
|
|
128952
129168
|
message: error2 instanceof Error ? error2.message : "The MCP request failed.",
|
|
@@ -129006,7 +129222,7 @@ async function readInput(options) {
|
|
|
129006
129222
|
}
|
|
129007
129223
|
text6 = Buffer.concat(chunks).toString("utf8");
|
|
129008
129224
|
} else {
|
|
129009
|
-
text6 = await
|
|
129225
|
+
text6 = await readFile7(options.inputFile, "utf8");
|
|
129010
129226
|
}
|
|
129011
129227
|
}
|
|
129012
129228
|
let value;
|
|
@@ -129510,7 +129726,6 @@ var init_open_browser = __esm({
|
|
|
129510
129726
|
import { execFile as execFile6 } from "node:child_process";
|
|
129511
129727
|
import { createHash as createHash29, randomBytes as randomBytes14 } from "node:crypto";
|
|
129512
129728
|
import {
|
|
129513
|
-
appendFileSync as appendFileSync5,
|
|
129514
129729
|
existsSync as existsSync30,
|
|
129515
129730
|
lstatSync as lstatSync13,
|
|
129516
129731
|
mkdirSync as mkdirSync14,
|
|
@@ -129520,7 +129735,7 @@ import {
|
|
|
129520
129735
|
writeFileSync as writeFileSync11
|
|
129521
129736
|
} from "node:fs";
|
|
129522
129737
|
import { homedir as homedir13, hostname as osHostname3 } from "node:os";
|
|
129523
|
-
import { join as join68,
|
|
129738
|
+
import { join as join68, resolve as resolve26, sep as sep12 } from "node:path";
|
|
129524
129739
|
function git3(cwd, args) {
|
|
129525
129740
|
return new Promise((done) => {
|
|
129526
129741
|
try {
|
|
@@ -129637,7 +129852,6 @@ async function probeWorkingCopy(opts) {
|
|
|
129637
129852
|
return "";
|
|
129638
129853
|
}
|
|
129639
129854
|
})();
|
|
129640
|
-
const pulled = opts.pulledCommit ?? null;
|
|
129641
129855
|
return {
|
|
129642
129856
|
machineId: machineId(opts.configDir),
|
|
129643
129857
|
hostname: host.length > 0 ? host : "unknown",
|
|
@@ -129648,8 +129862,8 @@ async function probeWorkingCopy(opts) {
|
|
|
129648
129862
|
headCommit: head3 && COMMIT_SHA.test(head3) ? head3 : null,
|
|
129649
129863
|
oxagenPresent: oxagenPresent(root),
|
|
129650
129864
|
symlinks: symlinkState(root),
|
|
129651
|
-
pulledCommit:
|
|
129652
|
-
event:
|
|
129865
|
+
pulledCommit: null,
|
|
129866
|
+
event: "init",
|
|
129653
129867
|
cliVersion: cliVersion()
|
|
129654
129868
|
};
|
|
129655
129869
|
}
|
|
@@ -129670,35 +129884,6 @@ async function reportWorkingCopy(opts) {
|
|
|
129670
129884
|
return { error: err2 instanceof Error ? err2.message : String(err2) };
|
|
129671
129885
|
}
|
|
129672
129886
|
}
|
|
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
129887
|
var GIT_TIMEOUT_MS2, REPORT_TIMEOUT_MS, MACHINE_ID_FILE, STELLA_LINKS, COMMIT_SHA;
|
|
129703
129888
|
var init_working_copy = __esm({
|
|
129704
129889
|
"src/lib/working-copy.ts"() {
|
|
@@ -129717,84 +129902,6 @@ var init_working_copy = __esm({
|
|
|
129717
129902
|
}
|
|
129718
129903
|
});
|
|
129719
129904
|
|
|
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
129905
|
// src/commands/init.ts
|
|
129799
129906
|
var init_exports = {};
|
|
129800
129907
|
__export(init_exports, {
|
|
@@ -129937,7 +130044,7 @@ GitHub connected. Fetching repositories...
|
|
|
129937
130044
|
} catch (err2) {
|
|
129938
130045
|
process.stdout.write(
|
|
129939
130046
|
` Could not list the GitHub App's installations: ${errorMessage3(err2)}
|
|
129940
|
-
|
|
130047
|
+
Re-run \`oxagen init\` to list the repositories again.
|
|
129941
130048
|
`
|
|
129942
130049
|
);
|
|
129943
130050
|
return null;
|
|
@@ -129968,7 +130075,7 @@ GitHub connected. Fetching repositories...
|
|
|
129968
130075
|
});
|
|
129969
130076
|
if (failed5 > 0) {
|
|
129970
130077
|
process.stdout.write(
|
|
129971
|
-
`
|
|
130078
|
+
` Re-run \`oxagen init\` to list the repositories again.
|
|
129972
130079
|
`
|
|
129973
130080
|
);
|
|
129974
130081
|
return null;
|
|
@@ -129992,7 +130099,7 @@ GitHub connected. Fetching repositories...
|
|
|
129992
130099
|
}
|
|
129993
130100
|
return repos;
|
|
129994
130101
|
}
|
|
129995
|
-
async function runWorkspaceLinker(
|
|
130102
|
+
async function runWorkspaceLinker(flags) {
|
|
129996
130103
|
const token = getToken();
|
|
129997
130104
|
if (!token) {
|
|
129998
130105
|
return {
|
|
@@ -130005,25 +130112,20 @@ async function runWorkspaceLinker(root, flags) {
|
|
|
130005
130112
|
Linking workspace...
|
|
130006
130113
|
`);
|
|
130007
130114
|
let account;
|
|
130008
|
-
const
|
|
130009
|
-
const
|
|
130115
|
+
const savedOrg = getOrgId();
|
|
130116
|
+
const savedWorkspace = getWorkspaceId();
|
|
130117
|
+
const saved = savedOrg && savedWorkspace ? { orgSlug: savedOrg, workspaceSlug: savedWorkspace } : null;
|
|
130118
|
+
const namesOtherPair = saved !== null && (flags.org !== void 0 && flags.org !== saved.orgSlug || flags.workspace !== void 0 && flags.workspace !== saved.workspaceSlug);
|
|
130010
130119
|
let relinkedFrom;
|
|
130011
|
-
if (
|
|
130120
|
+
if (saved && !namesOtherPair) {
|
|
130012
130121
|
process.stdout.write(
|
|
130013
|
-
` Already linked: ${
|
|
130122
|
+
` Already linked: ${saved.orgSlug} / ${saved.workspaceSlug}
|
|
130014
130123
|
`
|
|
130015
130124
|
);
|
|
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
|
-
};
|
|
130125
|
+
account = saved;
|
|
130024
130126
|
} else {
|
|
130025
|
-
const orgSlug = flags.org ??
|
|
130026
|
-
const workspaceSlug3 = flags.workspace ?? (
|
|
130127
|
+
const orgSlug = flags.org ?? saved?.orgSlug;
|
|
130128
|
+
const workspaceSlug3 = flags.workspace ?? (saved && orgSlug === saved.orgSlug ? saved.workspaceSlug : void 0);
|
|
130027
130129
|
try {
|
|
130028
130130
|
account = await resolveLinkedAccount({ orgSlug, workspaceSlug: workspaceSlug3, isTTY });
|
|
130029
130131
|
} catch (err2) {
|
|
@@ -130032,23 +130134,14 @@ Linking workspace...
|
|
|
130032
130134
|
skippedReason: `Workspace picker failed: ${err2 instanceof Error ? err2.message : String(err2)}`
|
|
130033
130135
|
};
|
|
130034
130136
|
}
|
|
130035
|
-
|
|
130137
|
+
writeConfig({
|
|
130036
130138
|
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
|
-
};
|
|
130139
|
+
workspaceSlug: account.workspaceSlug
|
|
130140
|
+
});
|
|
130141
|
+
if (saved) {
|
|
130142
|
+
relinkedFrom = saved;
|
|
130050
130143
|
process.stdout.write(
|
|
130051
|
-
` Relinked: ${account.orgName} / ${account.workspaceName} (was ${
|
|
130144
|
+
` Relinked: ${account.orgName} / ${account.workspaceName} (was ${saved.orgSlug} / ${saved.workspaceSlug})
|
|
130052
130145
|
`
|
|
130053
130146
|
);
|
|
130054
130147
|
} else {
|
|
@@ -130108,23 +130201,19 @@ No GitHub connection found in this workspace.
|
|
|
130108
130201
|
`
|
|
130109
130202
|
);
|
|
130110
130203
|
}
|
|
130111
|
-
const currentLink = readWorkspaceLink(root);
|
|
130112
|
-
if (currentLink && repos) {
|
|
130113
|
-
writeWorkspaceLink(root, { ...currentLink, repos });
|
|
130114
|
-
}
|
|
130115
130204
|
return {
|
|
130116
130205
|
linked: true,
|
|
130117
130206
|
orgSlug: account.orgSlug,
|
|
130118
|
-
orgName: account.orgName,
|
|
130207
|
+
...account.orgName !== void 0 ? { orgName: account.orgName } : {},
|
|
130119
130208
|
workspaceSlug: account.workspaceSlug,
|
|
130120
|
-
workspaceName: account.workspaceName,
|
|
130121
|
-
repos
|
|
130209
|
+
...account.workspaceName !== void 0 ? { workspaceName: account.workspaceName } : {},
|
|
130210
|
+
...repos ? { repos } : {},
|
|
130122
130211
|
...relinkedFrom ? { relinkedFrom } : {}
|
|
130123
130212
|
};
|
|
130124
130213
|
}
|
|
130125
130214
|
function formatInitSummary(result2) {
|
|
130126
130215
|
const lines = [];
|
|
130127
|
-
lines.push(`
|
|
130216
|
+
lines.push(`Directory: ${result2.projectRoot}`);
|
|
130128
130217
|
if (result2.workspaceLink === null) {
|
|
130129
130218
|
lines.push(" Skipped (--no-link).");
|
|
130130
130219
|
return lines.join("\n");
|
|
@@ -130136,7 +130225,7 @@ function formatInitSummary(result2) {
|
|
|
130136
130225
|
);
|
|
130137
130226
|
if (wl.relinkedFrom) {
|
|
130138
130227
|
lines.push(
|
|
130139
|
-
` Replaced
|
|
130228
|
+
` Replaced ${wl.relinkedFrom.orgSlug} / ${wl.relinkedFrom.workspaceSlug}.`
|
|
130140
130229
|
);
|
|
130141
130230
|
}
|
|
130142
130231
|
if (wl.repos && wl.repos.length > 0) {
|
|
@@ -130147,9 +130236,6 @@ function formatInitSummary(result2) {
|
|
|
130147
130236
|
} else if (result2.workspaceLink.skippedReason) {
|
|
130148
130237
|
lines.push(` ${result2.workspaceLink.skippedReason}`);
|
|
130149
130238
|
}
|
|
130150
|
-
if (result2.gitignoreUpdated) {
|
|
130151
|
-
lines.push(` Added .oxagen/workspace.json to ${result2.gitignoreUpdated}.`);
|
|
130152
|
-
}
|
|
130153
130239
|
if (result2.workingCopy && "workingCopyId" in result2.workingCopy) {
|
|
130154
130240
|
lines.push(
|
|
130155
130241
|
` Reported this directory to Oxagen (${result2.workingCopy.workingCopyId}).`
|
|
@@ -130163,48 +130249,28 @@ async function runInit(opts) {
|
|
|
130163
130249
|
await opts.onProgress?.(event);
|
|
130164
130250
|
};
|
|
130165
130251
|
let workspaceLink = null;
|
|
130166
|
-
let gitignoreUpdated = null;
|
|
130167
130252
|
let workingCopy = null;
|
|
130168
130253
|
if (!opts.noLink) {
|
|
130169
130254
|
await emit({ phase: "link", status: "start" });
|
|
130170
|
-
workspaceLink = await runWorkspaceLinker(
|
|
130255
|
+
workspaceLink = await runWorkspaceLinker({
|
|
130171
130256
|
org: opts.org,
|
|
130172
130257
|
workspace: opts.workspace
|
|
130173
130258
|
});
|
|
130174
130259
|
await emit({ phase: "link", status: "done" });
|
|
130175
130260
|
}
|
|
130176
|
-
if (workspaceLink?.linked) {
|
|
130177
|
-
|
|
130178
|
-
|
|
130179
|
-
|
|
130261
|
+
if (workspaceLink?.linked && workspaceLink.orgSlug !== void 0 && workspaceLink.workspaceSlug !== void 0) {
|
|
130262
|
+
workingCopy = await reportWorkingCopy({
|
|
130263
|
+
root,
|
|
130264
|
+
scope: { org: workspaceLink.orgSlug, ws: workspaceLink.workspaceSlug }
|
|
130265
|
+
});
|
|
130266
|
+
if ("error" in workingCopy) {
|
|
130180
130267
|
process.stderr.write(
|
|
130181
|
-
`Warning: could not
|
|
130268
|
+
`Warning: could not report this directory to Oxagen: ${workingCopy.error}
|
|
130182
130269
|
`
|
|
130183
130270
|
);
|
|
130184
130271
|
}
|
|
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
130272
|
}
|
|
130201
|
-
return {
|
|
130202
|
-
projectRoot: root,
|
|
130203
|
-
workspaceLinkPath: workspaceLinkPath(root),
|
|
130204
|
-
workspaceLink,
|
|
130205
|
-
gitignoreUpdated,
|
|
130206
|
-
workingCopy
|
|
130207
|
-
};
|
|
130273
|
+
return { projectRoot: root, workspaceLink, workingCopy };
|
|
130208
130274
|
}
|
|
130209
130275
|
function divertStdoutToStderr() {
|
|
130210
130276
|
const original = process.stdout.write;
|
|
@@ -130258,7 +130324,6 @@ var init_init = __esm({
|
|
|
130258
130324
|
init_config();
|
|
130259
130325
|
init_linker();
|
|
130260
130326
|
init_working_copy();
|
|
130261
|
-
init_workspace_link();
|
|
130262
130327
|
init_api();
|
|
130263
130328
|
init_output();
|
|
130264
130329
|
GITHUB_POLL = {
|
|
@@ -130268,430 +130333,6 @@ var init_init = __esm({
|
|
|
130268
130333
|
}
|
|
130269
130334
|
});
|
|
130270
130335
|
|
|
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
130336
|
// ../../packages/mcp-studio/src/not-built.ts
|
|
130696
130337
|
var NotBuiltError;
|
|
130697
130338
|
var init_not_built = __esm({
|
|
@@ -133112,7 +132753,7 @@ var init_local_discovery_envelope = __esm({
|
|
|
133112
132753
|
function messageOf5(error2) {
|
|
133113
132754
|
return error2 instanceof Error ? error2.message : String(error2);
|
|
133114
132755
|
}
|
|
133115
|
-
function
|
|
132756
|
+
function isRecord10(value) {
|
|
133116
132757
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
133117
132758
|
}
|
|
133118
132759
|
function isList(value) {
|
|
@@ -133126,7 +132767,7 @@ function jsonEqual(a, b3) {
|
|
|
133126
132767
|
if (Array.isArray(a)) {
|
|
133127
132768
|
return Array.isArray(b3) && a.length === b3.length && a.every((item, index) => jsonEqual(item, b3[index]));
|
|
133128
132769
|
}
|
|
133129
|
-
if (
|
|
132770
|
+
if (isRecord10(a) && isRecord10(b3)) {
|
|
133130
132771
|
const keys = definedKeys(a);
|
|
133131
132772
|
return keys.length === definedKeys(b3).length && keys.every((key) => Object.hasOwn(b3, key) && jsonEqual(a[key], b3[key]));
|
|
133132
132773
|
}
|
|
@@ -133138,7 +132779,7 @@ function utf8Length(text6) {
|
|
|
133138
132779
|
function valueAt2(value, path2) {
|
|
133139
132780
|
let current = value;
|
|
133140
132781
|
for (const step of path2.split(".")) {
|
|
133141
|
-
if (step.endsWith("[]") || !
|
|
132782
|
+
if (step.endsWith("[]") || !isRecord10(current) || !Object.hasOwn(current, step))
|
|
133142
132783
|
return void 0;
|
|
133143
132784
|
current = current[step];
|
|
133144
132785
|
}
|
|
@@ -133146,9 +132787,9 @@ function valueAt2(value, path2) {
|
|
|
133146
132787
|
}
|
|
133147
132788
|
function withValueAt(value, path2, replacement) {
|
|
133148
132789
|
const [step, ...rest] = path2.split(".");
|
|
133149
|
-
if (step === void 0 || !
|
|
132790
|
+
if (step === void 0 || !isRecord10(value)) return value;
|
|
133150
132791
|
const inner = Object.hasOwn(value, step) ? value[step] : void 0;
|
|
133151
|
-
if (rest.length > 0 && !
|
|
132792
|
+
if (rest.length > 0 && !isRecord10(inner)) return value;
|
|
133152
132793
|
const next = rest.length === 0 ? replacement : withValueAt(inner, rest.join("."), replacement);
|
|
133153
132794
|
return { ...value, [step]: next };
|
|
133154
132795
|
}
|
|
@@ -142180,13 +141821,13 @@ var require_path = __commonJS({
|
|
|
142180
141821
|
"../../node_modules/.pnpm/@protobufjs+path@1.1.2/node_modules/@protobufjs/path/index.js"(exports) {
|
|
142181
141822
|
"use strict";
|
|
142182
141823
|
var path2 = exports;
|
|
142183
|
-
var
|
|
141824
|
+
var isAbsolute20 = (
|
|
142184
141825
|
/**
|
|
142185
141826
|
* Tests if the specified path is absolute.
|
|
142186
141827
|
* @param {string} path Path to test
|
|
142187
141828
|
* @returns {boolean} `true` if path is absolute
|
|
142188
141829
|
*/
|
|
142189
|
-
path2.isAbsolute = function
|
|
141830
|
+
path2.isAbsolute = function isAbsolute21(path3) {
|
|
142190
141831
|
return /^(?:\/|\w+:)/.test(path3);
|
|
142191
141832
|
}
|
|
142192
141833
|
);
|
|
@@ -142198,7 +141839,7 @@ var require_path = __commonJS({
|
|
|
142198
141839
|
*/
|
|
142199
141840
|
path2.normalize = function normalize5(path3) {
|
|
142200
141841
|
path3 = path3.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
|
|
142201
|
-
var parts = path3.split("/"), absolute =
|
|
141842
|
+
var parts = path3.split("/"), absolute = isAbsolute20(path3), prefix = "";
|
|
142202
141843
|
if (absolute)
|
|
142203
141844
|
prefix = parts.shift() + "/";
|
|
142204
141845
|
for (var i2 = 0; i2 < parts.length; ) {
|
|
@@ -142220,7 +141861,7 @@ var require_path = __commonJS({
|
|
|
142220
141861
|
path2.resolve = function resolve29(originPath, includePath, alreadyNormalized) {
|
|
142221
141862
|
if (!alreadyNormalized)
|
|
142222
141863
|
includePath = normalize4(includePath);
|
|
142223
|
-
if (
|
|
141864
|
+
if (isAbsolute20(includePath))
|
|
142224
141865
|
return includePath;
|
|
142225
141866
|
if (!alreadyNormalized)
|
|
142226
141867
|
originPath = normalize4(originPath);
|
|
@@ -146548,8 +146189,8 @@ function doubleText(value) {
|
|
|
146548
146189
|
if (value === Infinity) return "inf";
|
|
146549
146190
|
if (value === -Infinity) return "-inf";
|
|
146550
146191
|
if (Object.is(value, -0)) return "-0";
|
|
146551
|
-
const
|
|
146552
|
-
return Number(
|
|
146192
|
+
const short4 = formatG(value, 15);
|
|
146193
|
+
return Number(short4) === value ? short4 : formatG(value, 17);
|
|
146553
146194
|
}
|
|
146554
146195
|
function floatText(value) {
|
|
146555
146196
|
const float = toFloat32(value);
|
|
@@ -146557,8 +146198,8 @@ function floatText(value) {
|
|
|
146557
146198
|
if (float === Infinity) return "inf";
|
|
146558
146199
|
if (float === -Infinity) return "-inf";
|
|
146559
146200
|
if (Object.is(float, -0)) return "-0";
|
|
146560
|
-
const
|
|
146561
|
-
return Math.fround(Number(
|
|
146201
|
+
const short4 = formatG(float, 6);
|
|
146202
|
+
return Math.fround(Number(short4)) === float ? short4 : formatG(float, 9);
|
|
146562
146203
|
}
|
|
146563
146204
|
function toFloat32(value) {
|
|
146564
146205
|
if (value > FLOAT_MAX) {
|
|
@@ -149023,7 +148664,7 @@ var init_lock2 = __esm({
|
|
|
149023
148664
|
|
|
149024
148665
|
// ../../packages/mcp-studio/src/compile/json-schema.ts
|
|
149025
148666
|
function propertiesOf(schema) {
|
|
149026
|
-
return
|
|
148667
|
+
return isRecord10(schema.properties) ? schema.properties : {};
|
|
149027
148668
|
}
|
|
149028
148669
|
function requiredOf(schema) {
|
|
149029
148670
|
if (!Array.isArray(schema.required)) return [];
|
|
@@ -149184,7 +148825,7 @@ function shapeInput(key, entry2, upstream, supplied, issues) {
|
|
|
149184
148825
|
for (const [name2, value] of defaults) {
|
|
149185
148826
|
if (!usable("defaults", name2)) continue;
|
|
149186
148827
|
const property = shaped[name2];
|
|
149187
|
-
shaped[name2] = { ...
|
|
148828
|
+
shaped[name2] = { ...isRecord10(property) ? property : {}, default: value };
|
|
149188
148829
|
required2 = required2.filter((other) => other !== name2);
|
|
149189
148830
|
}
|
|
149190
148831
|
const renamed = /* @__PURE__ */ new Map();
|
|
@@ -149237,7 +148878,7 @@ function selectTree(paths) {
|
|
|
149237
148878
|
return root;
|
|
149238
148879
|
}
|
|
149239
148880
|
function trimObject(schema, children) {
|
|
149240
|
-
if (!
|
|
148881
|
+
if (!isRecord10(schema.properties)) return schema;
|
|
149241
148882
|
const properties = schema.properties;
|
|
149242
148883
|
const kept = {};
|
|
149243
148884
|
for (const [name2, node2] of children) {
|
|
@@ -149252,9 +148893,9 @@ function trimObject(schema, children) {
|
|
|
149252
148893
|
return out;
|
|
149253
148894
|
}
|
|
149254
148895
|
function trimNode(schema, node2) {
|
|
149255
|
-
if (node2.whole || !
|
|
148896
|
+
if (node2.whole || !isRecord10(schema)) return schema;
|
|
149256
148897
|
if (!node2.array) return trimObject(schema, node2.children);
|
|
149257
|
-
return
|
|
148898
|
+
return isRecord10(schema.items) ? { ...schema, items: trimObject(schema.items, node2.children) } : schema;
|
|
149258
148899
|
}
|
|
149259
148900
|
function selectOutput(outputSchema, select) {
|
|
149260
148901
|
if (select.length === 0) return outputSchema;
|
|
@@ -150068,12 +149709,12 @@ function walkSchemas(root, at2, visit2) {
|
|
|
150068
149709
|
node2.forEach((item, index) => walk2(item, `${path2}[${index}]`, depth + 1));
|
|
150069
149710
|
return;
|
|
150070
149711
|
}
|
|
150071
|
-
if (!
|
|
149712
|
+
if (!isRecord10(node2) || above.has(node2)) return;
|
|
150072
149713
|
visit2(node2, path2);
|
|
150073
149714
|
above.add(node2);
|
|
150074
149715
|
for (const [key, value] of Object.entries(node2)) {
|
|
150075
149716
|
if (DATA.has(key)) continue;
|
|
150076
|
-
if (SCHEMA_MAPS.has(key) &&
|
|
149717
|
+
if (SCHEMA_MAPS.has(key) && isRecord10(value)) {
|
|
150077
149718
|
for (const [name2, child] of Object.entries(value))
|
|
150078
149719
|
walk2(child, `${path2}.${key}.${name2}`, depth + 1);
|
|
150079
149720
|
} else {
|
|
@@ -150085,7 +149726,7 @@ function walkSchemas(root, at2, visit2) {
|
|
|
150085
149726
|
walk2(root, at2, 0);
|
|
150086
149727
|
}
|
|
150087
149728
|
function tagOf(schema) {
|
|
150088
|
-
if (!
|
|
149729
|
+
if (!isRecord10(schema)) return void 0;
|
|
150089
149730
|
if (Object.hasOwn(schema, "const")) return JSON.stringify(schema.const);
|
|
150090
149731
|
if (Array.isArray(schema.enum) && schema.enum.length === 1)
|
|
150091
149732
|
return JSON.stringify(schema.enum[0]);
|
|
@@ -150093,7 +149734,7 @@ function tagOf(schema) {
|
|
|
150093
149734
|
}
|
|
150094
149735
|
function distinguishable(branches) {
|
|
150095
149736
|
if (branches.length < 2) return true;
|
|
150096
|
-
const records = branches.filter(
|
|
149737
|
+
const records = branches.filter(isRecord10);
|
|
150097
149738
|
const [first] = records;
|
|
150098
149739
|
if (first === void 0 || records.length < branches.length) return false;
|
|
150099
149740
|
const types = records.map((branch) => branch.type);
|
|
@@ -150203,11 +149844,11 @@ function quoted2(values) {
|
|
|
150203
149844
|
return orList2(values.map((value) => JSON.stringify(value)));
|
|
150204
149845
|
}
|
|
150205
149846
|
function isArraySchema(schema) {
|
|
150206
|
-
if (!
|
|
149847
|
+
if (!isRecord10(schema)) return false;
|
|
150207
149848
|
return schema.type === "array" || Array.isArray(schema.type) && schema.type.includes("array");
|
|
150208
149849
|
}
|
|
150209
149850
|
function hasDescription(schema) {
|
|
150210
|
-
return
|
|
149851
|
+
return isRecord10(schema) && typeof schema.description === "string" && schema.description.trim() !== "";
|
|
150211
149852
|
}
|
|
150212
149853
|
function refTarget(root, ref) {
|
|
150213
149854
|
if (ref === "#") return root;
|
|
@@ -150220,7 +149861,7 @@ function refTarget(root, ref) {
|
|
|
150220
149861
|
} catch {
|
|
150221
149862
|
return void 0;
|
|
150222
149863
|
}
|
|
150223
|
-
if (!
|
|
149864
|
+
if (!isRecord10(node2) || !Object.hasOwn(node2, name2)) return void 0;
|
|
150224
149865
|
node2 = node2[name2];
|
|
150225
149866
|
}
|
|
150226
149867
|
return node2;
|
|
@@ -150229,7 +149870,7 @@ function isDescribed(schema, root) {
|
|
|
150229
149870
|
const seen = /* @__PURE__ */ new Set();
|
|
150230
149871
|
let node2 = schema;
|
|
150231
149872
|
while (!hasDescription(node2)) {
|
|
150232
|
-
const ref =
|
|
149873
|
+
const ref = isRecord10(node2) ? node2.$ref : void 0;
|
|
150233
149874
|
if (typeof ref !== "string") return false;
|
|
150234
149875
|
if (seen.has(ref)) return true;
|
|
150235
149876
|
seen.add(ref);
|
|
@@ -150495,7 +150136,7 @@ function lintUpstream(folder, context, key, entry2, upstream, apply, report) {
|
|
|
150495
150136
|
});
|
|
150496
150137
|
}
|
|
150497
150138
|
const oneOf4 = (node2, at2) => {
|
|
150498
|
-
if (!Array.isArray(node2.oneOf) ||
|
|
150139
|
+
if (!Array.isArray(node2.oneOf) || isRecord10(node2.discriminator) || distinguishable(node2.oneOf))
|
|
150499
150140
|
return;
|
|
150500
150141
|
report("undiscriminated_one_of", {
|
|
150501
150142
|
tool: key,
|
|
@@ -151342,7 +150983,7 @@ function upstreamError(response, bytes) {
|
|
|
151342
150983
|
let problem;
|
|
151343
150984
|
if (text6 !== "" && isJsonMediaType(headerValue(response.headers, "content-type"))) {
|
|
151344
150985
|
const parsed2 = parseJson4(text6);
|
|
151345
|
-
if (parsed2.ok &&
|
|
150986
|
+
if (parsed2.ok && isRecord10(parsed2.value)) problem = parsed2.value;
|
|
151346
150987
|
}
|
|
151347
150988
|
const title = problem === void 0 ? void 0 : firstText(problem, ["title"]);
|
|
151348
150989
|
const detail = problem === void 0 ? text6.trim() === "" ? void 0 : text6 : firstText(problem, ["detail", "message", "error_description", "error"]);
|
|
@@ -151477,13 +151118,13 @@ var init_http_call = __esm({
|
|
|
151477
151118
|
|
|
151478
151119
|
// ../../packages/mcp-studio/src/execute/mcp.ts
|
|
151479
151120
|
function toolResult(value) {
|
|
151480
|
-
if (!
|
|
151121
|
+
if (!isRecord10(value))
|
|
151481
151122
|
return { ok: false, detail: "The tools/call result is not an object." };
|
|
151482
151123
|
if (!isList(value.content))
|
|
151483
151124
|
return { ok: false, detail: "The tools/call result has no content list." };
|
|
151484
151125
|
const content = [];
|
|
151485
151126
|
for (const [index, item] of value.content.entries()) {
|
|
151486
|
-
if (!
|
|
151127
|
+
if (!isRecord10(item) || typeof item.type !== "string") {
|
|
151487
151128
|
return {
|
|
151488
151129
|
ok: false,
|
|
151489
151130
|
detail: `Content item ${index} is not an object with a string type.`
|
|
@@ -151494,7 +151135,7 @@ function toolResult(value) {
|
|
|
151494
151135
|
const result2 = { content };
|
|
151495
151136
|
const structured = value.structuredContent;
|
|
151496
151137
|
if (structured !== void 0 && structured !== null) {
|
|
151497
|
-
if (!
|
|
151138
|
+
if (!isRecord10(structured))
|
|
151498
151139
|
return {
|
|
151499
151140
|
ok: false,
|
|
151500
151141
|
detail: "The tools/call result's structuredContent is not an object."
|
|
@@ -151639,7 +151280,7 @@ function rejectedAttempt(response, failure4) {
|
|
|
151639
151280
|
function findResponse(value, id2) {
|
|
151640
151281
|
const messages = isList(value) ? value : [value];
|
|
151641
151282
|
for (const message2 of messages) {
|
|
151642
|
-
if (
|
|
151283
|
+
if (isRecord10(message2) && message2.id === id2 && !Object.hasOwn(message2, "method"))
|
|
151643
151284
|
return message2;
|
|
151644
151285
|
}
|
|
151645
151286
|
return void 0;
|
|
@@ -151712,8 +151353,8 @@ async function readReply(session, response, id2, what) {
|
|
|
151712
151353
|
return { ok: true, value: message2 };
|
|
151713
151354
|
}
|
|
151714
151355
|
function rpcError2(error2) {
|
|
151715
|
-
const message2 =
|
|
151716
|
-
const code =
|
|
151356
|
+
const message2 = isRecord10(error2) && typeof error2.message === "string" ? error2.message : JSON.stringify(error2);
|
|
151357
|
+
const code = isRecord10(error2) && typeof error2.code === "number" ? ` (code ${error2.code})` : "";
|
|
151717
151358
|
return {
|
|
151718
151359
|
title: "MCP error",
|
|
151719
151360
|
detail: cutDetail(`${message2}${code}`),
|
|
@@ -151752,7 +151393,7 @@ async function initialize(session) {
|
|
|
151752
151393
|
if (Object.hasOwn(reply3.value, "error"))
|
|
151753
151394
|
return { ok: false, error: rpcError2(reply3.value.error) };
|
|
151754
151395
|
const result2 = reply3.value.result;
|
|
151755
|
-
if (!
|
|
151396
|
+
if (!isRecord10(result2))
|
|
151756
151397
|
return invalidResponse(
|
|
151757
151398
|
"The MCP server's initialize result is not an object.",
|
|
151758
151399
|
response.status
|
|
@@ -152010,8 +151651,8 @@ function firstPosition(paging, args, options) {
|
|
|
152010
151651
|
if (paging.style === "offset") return 0;
|
|
152011
151652
|
const properties = options.inputSchema.properties;
|
|
152012
151653
|
const name2 = options.agentName(paging.input);
|
|
152013
|
-
const property =
|
|
152014
|
-
if (
|
|
151654
|
+
const property = isRecord10(properties) && Object.hasOwn(properties, name2) ? properties[name2] : void 0;
|
|
151655
|
+
if (isRecord10(property)) {
|
|
152015
151656
|
const fallback = wholeNumber(property.default) ?? wholeNumber(property.minimum);
|
|
152016
151657
|
if (fallback !== void 0) return fallback;
|
|
152017
151658
|
}
|
|
@@ -152194,7 +151835,7 @@ function graphqlDocument(template, args) {
|
|
|
152194
151835
|
}
|
|
152195
151836
|
function errorMessages(errors) {
|
|
152196
151837
|
return errors.map(
|
|
152197
|
-
(entry2) =>
|
|
151838
|
+
(entry2) => isRecord10(entry2) && typeof entry2.message === "string" ? entry2.message : JSON.stringify(entry2)
|
|
152198
151839
|
).join("; ");
|
|
152199
151840
|
}
|
|
152200
151841
|
function invalidResponse2(detail, status2) {
|
|
@@ -152206,7 +151847,7 @@ function interpret(template) {
|
|
|
152206
151847
|
const status2 = response.status;
|
|
152207
151848
|
const parsed2 = bytes.byteLength === 0 ? void 0 : parseJson4(decodeText2(bytes));
|
|
152208
151849
|
const body2 = parsed2?.ok === true ? parsed2.value : void 0;
|
|
152209
|
-
if (
|
|
151850
|
+
if (isRecord10(body2) && isList(body2.errors) && body2.errors.length > 0) {
|
|
152210
151851
|
return {
|
|
152211
151852
|
ok: false,
|
|
152212
151853
|
error: {
|
|
@@ -152228,8 +151869,8 @@ function interpret(template) {
|
|
|
152228
151869
|
`The upstream answered ${status2} with JSON that does not parse: ${parsed2.message}`,
|
|
152229
151870
|
status2
|
|
152230
151871
|
);
|
|
152231
|
-
const data =
|
|
152232
|
-
if (!
|
|
151872
|
+
const data = isRecord10(body2) ? body2.data : void 0;
|
|
151873
|
+
if (!isRecord10(data))
|
|
152233
151874
|
return invalidResponse2(
|
|
152234
151875
|
`The upstream answered ${status2} with no data object.`,
|
|
152235
151876
|
status2
|
|
@@ -152902,7 +152543,7 @@ function exchangesFor(call2, ending) {
|
|
|
152902
152543
|
];
|
|
152903
152544
|
}
|
|
152904
152545
|
function isJsonObject(value) {
|
|
152905
|
-
return
|
|
152546
|
+
return isRecord10(value);
|
|
152906
152547
|
}
|
|
152907
152548
|
var DEFAULT_MAX_STREAM_BYTES, RETRIED_LEVELS, CANCELLED2, grpcSender, TRANSPORT_TITLES2;
|
|
152908
152549
|
var init_sender = __esm({
|
|
@@ -152966,7 +152607,7 @@ function scalarText(value, name2) {
|
|
|
152966
152607
|
function shapeOf(value, name2) {
|
|
152967
152608
|
if (isList(value))
|
|
152968
152609
|
return { kind: "list", items: value.map((item) => scalarText(item, name2)) };
|
|
152969
|
-
if (
|
|
152610
|
+
if (isRecord10(value)) {
|
|
152970
152611
|
return {
|
|
152971
152612
|
kind: "object",
|
|
152972
152613
|
entries: Object.entries(value).filter(([, item]) => item !== void 0).map(([key, item]) => [key, scalarText(item, name2)])
|
|
@@ -153159,7 +152800,7 @@ function formText(value) {
|
|
|
153159
152800
|
throw invalidArguments(`A form body cannot carry a ${typeof value} value.`);
|
|
153160
152801
|
}
|
|
153161
152802
|
function formBody(value) {
|
|
153162
|
-
if (!
|
|
152803
|
+
if (!isRecord10(value)) throw invalidArguments("A form body takes an object.");
|
|
153163
152804
|
const form = new URLSearchParams();
|
|
153164
152805
|
for (const [key, item] of Object.entries(value)) {
|
|
153165
152806
|
const items = (isList(item) ? item : [item]).filter(
|
|
@@ -153427,7 +153068,7 @@ function project(value, at2) {
|
|
|
153427
153068
|
const each = at2.each;
|
|
153428
153069
|
return value.map((item) => project(item, each)).filter((item) => item !== ABSENT);
|
|
153429
153070
|
}
|
|
153430
|
-
if (
|
|
153071
|
+
if (isRecord10(value) && at2.fields.size > 0) {
|
|
153431
153072
|
const kept = [];
|
|
153432
153073
|
for (const [name2, child] of at2.fields) {
|
|
153433
153074
|
if (!Object.hasOwn(value, name2)) continue;
|
|
@@ -153444,7 +153085,7 @@ function remove(value, at2) {
|
|
|
153444
153085
|
const each = at2.each;
|
|
153445
153086
|
return value.map((item) => remove(item, each)).filter((item) => item !== ABSENT);
|
|
153446
153087
|
}
|
|
153447
|
-
if (
|
|
153088
|
+
if (isRecord10(value) && at2.fields.size > 0) {
|
|
153448
153089
|
const kept = [];
|
|
153449
153090
|
for (const [name2, item] of Object.entries(value)) {
|
|
153450
153091
|
const child = at2.fields.get(name2);
|
|
@@ -153480,14 +153121,14 @@ function shapeRecord(value, rules, isError) {
|
|
|
153480
153121
|
let out = value;
|
|
153481
153122
|
if (rules.select !== void 0 && !isError) out = project(out, rules.select);
|
|
153482
153123
|
if (rules.redact !== void 0) out = remove(out, rules.redact);
|
|
153483
|
-
return
|
|
153124
|
+
return isRecord10(out) ? out : {};
|
|
153484
153125
|
}
|
|
153485
153126
|
function redactReachesList(redact) {
|
|
153486
153127
|
const items = redact.fields.get(LIST_FIELD);
|
|
153487
153128
|
return items !== void 0 && (items.end || items.each !== void 0);
|
|
153488
153129
|
}
|
|
153489
153130
|
function shapeAny(value, rules) {
|
|
153490
|
-
if (
|
|
153131
|
+
if (isRecord10(value)) return shapeRecord(value, rules, false);
|
|
153491
153132
|
if (!isList(value)) return value;
|
|
153492
153133
|
if (rules.redact !== void 0 && !redactReachesList(rules.redact))
|
|
153493
153134
|
return WITHHELD;
|
|
@@ -153520,12 +153161,12 @@ function resultBytes(content, structured) {
|
|
|
153520
153161
|
}
|
|
153521
153162
|
function jsonResult(value, text6) {
|
|
153522
153163
|
const result2 = { content: [textItem(text6)] };
|
|
153523
|
-
if (
|
|
153164
|
+
if (isRecord10(value)) result2.structuredContent = value;
|
|
153524
153165
|
return result2;
|
|
153525
153166
|
}
|
|
153526
153167
|
function jsonResultBytes(value, text6) {
|
|
153527
153168
|
const bytes = utf8Length(text6);
|
|
153528
|
-
return
|
|
153169
|
+
return isRecord10(value) ? 2 * bytes : bytes;
|
|
153529
153170
|
}
|
|
153530
153171
|
function cutList(value, rules) {
|
|
153531
153172
|
const list2 = valueAt2(value, rules.list);
|
|
@@ -153590,7 +153231,7 @@ function shapeText(text6, rules, isError, structured) {
|
|
|
153590
153231
|
if (typeof text6 !== "string") return void 0;
|
|
153591
153232
|
const parsed2 = parseJson4(text6);
|
|
153592
153233
|
if (!parsed2.ok) return void 0;
|
|
153593
|
-
if (
|
|
153234
|
+
if (isRecord10(parsed2.value))
|
|
153594
153235
|
return JSON.stringify(shapeRecord(parsed2.value, rules, isError));
|
|
153595
153236
|
if (!isList(parsed2.value) || rules.redact === void 0) return void 0;
|
|
153596
153237
|
if (redactReachesList(rules.redact)) {
|
|
@@ -153604,7 +153245,7 @@ function shapeItem(item, rules, isError, structured) {
|
|
|
153604
153245
|
const text6 = shapeText(item.text, rules, isError, structured);
|
|
153605
153246
|
return text6 === void 0 ? item : { ...item, text: text6 };
|
|
153606
153247
|
}
|
|
153607
|
-
if (item.type === "resource" &&
|
|
153248
|
+
if (item.type === "resource" && isRecord10(item.resource)) {
|
|
153608
153249
|
const text6 = shapeText(item.resource.text, rules, isError, structured);
|
|
153609
153250
|
return text6 === void 0 ? item : { ...item, resource: { ...item.resource, text: text6 } };
|
|
153610
153251
|
}
|
|
@@ -153692,7 +153333,7 @@ function hasType(type, value) {
|
|
|
153692
153333
|
case "boolean":
|
|
153693
153334
|
return typeof value === "boolean";
|
|
153694
153335
|
case "object":
|
|
153695
|
-
return
|
|
153336
|
+
return isRecord10(value);
|
|
153696
153337
|
case "array":
|
|
153697
153338
|
return isList(value);
|
|
153698
153339
|
default:
|
|
@@ -153756,7 +153397,7 @@ function resolveRef(root, ref) {
|
|
|
153756
153397
|
if (!Number.isInteger(index) || index < 0 || index >= current.length)
|
|
153757
153398
|
return void 0;
|
|
153758
153399
|
current = current[index];
|
|
153759
|
-
} else if (
|
|
153400
|
+
} else if (isRecord10(current) && Object.hasOwn(current, token)) {
|
|
153760
153401
|
current = current[token];
|
|
153761
153402
|
} else {
|
|
153762
153403
|
return void 0;
|
|
@@ -153766,7 +153407,7 @@ function resolveRef(root, ref) {
|
|
|
153766
153407
|
}
|
|
153767
153408
|
function canonical2(value) {
|
|
153768
153409
|
if (isList(value)) return `[${value.map(canonical2).join(",")}]`;
|
|
153769
|
-
if (
|
|
153410
|
+
if (isRecord10(value)) {
|
|
153770
153411
|
const keys = Object.keys(value).sort();
|
|
153771
153412
|
return `{${keys.map((key) => `${JSON.stringify(key)}:${canonical2(value[key])}`).join(",")}}`;
|
|
153772
153413
|
}
|
|
@@ -153819,7 +153460,7 @@ var init_validate = __esm({
|
|
|
153819
153460
|
return [];
|
|
153820
153461
|
}
|
|
153821
153462
|
if (schema === false) return [`${path2} is not allowed.`];
|
|
153822
|
-
if (!
|
|
153463
|
+
if (!isRecord10(schema)) return [];
|
|
153823
153464
|
if (value === null && schema.nullable === true) return [];
|
|
153824
153465
|
const issues = [];
|
|
153825
153466
|
if (typeof schema.$ref === "string") {
|
|
@@ -153841,7 +153482,7 @@ var init_validate = __esm({
|
|
|
153841
153482
|
issues.push(...checkNumber2(schema, value, path2));
|
|
153842
153483
|
else if (isList(value))
|
|
153843
153484
|
issues.push(...this.checkArray(schema, value, path2, depth));
|
|
153844
|
-
else if (
|
|
153485
|
+
else if (isRecord10(value))
|
|
153845
153486
|
issues.push(...this.checkObject(schema, value, path2, depth));
|
|
153846
153487
|
issues.push(...this.checkCombinators(schema, value, path2, depth));
|
|
153847
153488
|
return issues;
|
|
@@ -153953,8 +153594,8 @@ var init_validate = __esm({
|
|
|
153953
153594
|
`${path2} must have at most ${schema.maxProperties} ${plural8(schema.maxProperties, "property", "properties")}.`
|
|
153954
153595
|
);
|
|
153955
153596
|
}
|
|
153956
|
-
const properties =
|
|
153957
|
-
const patterns =
|
|
153597
|
+
const properties = isRecord10(schema.properties) ? schema.properties : {};
|
|
153598
|
+
const patterns = isRecord10(schema.patternProperties) ? Object.entries(schema.patternProperties) : [];
|
|
153958
153599
|
for (const key of present) {
|
|
153959
153600
|
const at2 = propertyPath(path2, key);
|
|
153960
153601
|
let known = false;
|
|
@@ -172237,7 +171878,7 @@ function differenceAt(path2, expected, actual) {
|
|
|
172237
171878
|
actual: actual[shared]
|
|
172238
171879
|
};
|
|
172239
171880
|
}
|
|
172240
|
-
if (
|
|
171881
|
+
if (isRecord10(expected) && isRecord10(actual)) {
|
|
172241
171882
|
for (const key of Object.keys(expected)) {
|
|
172242
171883
|
const found = differenceAt(
|
|
172243
171884
|
keyPath(path2, key),
|
|
@@ -172332,7 +171973,7 @@ function rpcMessage(request3) {
|
|
|
172332
171973
|
const parsed2 = parseJson4(decodeText2(request3.body));
|
|
172333
171974
|
if (!parsed2.ok) return void 0;
|
|
172334
171975
|
const value = isList(parsed2.value) ? parsed2.value[0] : parsed2.value;
|
|
172335
|
-
return
|
|
171976
|
+
return isRecord10(value) ? value : void 0;
|
|
172336
171977
|
}
|
|
172337
171978
|
function replayTransport(exchanges, route) {
|
|
172338
171979
|
let next = 0;
|
|
@@ -174587,10 +174228,12 @@ var init_src8 = __esm({
|
|
|
174587
174228
|
});
|
|
174588
174229
|
|
|
174589
174230
|
// ../../packages/steering-bundle/src/tree.ts
|
|
174590
|
-
import { createHash as
|
|
174231
|
+
import { createHash as createHash30 } from "node:crypto";
|
|
174591
174232
|
function gitBlobId(text6) {
|
|
174592
|
-
|
|
174593
|
-
|
|
174233
|
+
return gitBlobIdOfBytes(Buffer.from(text6, "utf8"));
|
|
174234
|
+
}
|
|
174235
|
+
function gitBlobIdOfBytes(bytes) {
|
|
174236
|
+
return createHash30("sha1").update(`blob ${bytes.length}\0`).update(bytes).digest("hex");
|
|
174594
174237
|
}
|
|
174595
174238
|
function treeFromFiles(files2) {
|
|
174596
174239
|
return {
|
|
@@ -174650,6 +174293,10 @@ var init_tree = __esm({
|
|
|
174650
174293
|
texts = /* @__PURE__ */ new Map();
|
|
174651
174294
|
/** Reads in flight, so two callers of one path share one fetch. */
|
|
174652
174295
|
pending = /* @__PURE__ */ new Map();
|
|
174296
|
+
/** Texts decoded from the tree's bytes, by blob id, or by path for a file listed without one. */
|
|
174297
|
+
decoded = /* @__PURE__ */ new Map();
|
|
174298
|
+
/** Byte reads in flight, keyed as `decoded` is. */
|
|
174299
|
+
decoding = /* @__PURE__ */ new Map();
|
|
174653
174300
|
blobs = /* @__PURE__ */ new Map();
|
|
174654
174301
|
listed;
|
|
174655
174302
|
/** How many files this reader fetched from the host. */
|
|
@@ -174676,6 +174323,35 @@ var init_tree = __esm({
|
|
|
174676
174323
|
const text6 = await this.read(path2);
|
|
174677
174324
|
return this.blobs.get(path2) ?? gitBlobId(text6);
|
|
174678
174325
|
}
|
|
174326
|
+
/**
|
|
174327
|
+
* The file's text as `read_steering` serves it, for any file, an image
|
|
174328
|
+
* included. With the tree's bytes, they are decoded as UTF-8: a byte that
|
|
174329
|
+
* is not UTF-8 becomes U+FFFD, and a NUL byte stays as U+0000. Without
|
|
174330
|
+
* them, the text `read` returns. Paths that share a listed blob share one
|
|
174331
|
+
* fetch, and a fetch that fails is not kept.
|
|
174332
|
+
*/
|
|
174333
|
+
async text(path2) {
|
|
174334
|
+
if (this.tree.readBytes === void 0) return this.read(path2);
|
|
174335
|
+
const listed = this.blobs.get(path2);
|
|
174336
|
+
const key = listed === void 0 ? `path:${path2}` : `blob:${listed}`;
|
|
174337
|
+
const held = this.decoded.get(key);
|
|
174338
|
+
if (held !== void 0) return held;
|
|
174339
|
+
const inFlight = this.decoding.get(key);
|
|
174340
|
+
if (inFlight !== void 0) return inFlight;
|
|
174341
|
+
const reading = this.decode(path2, key).finally(
|
|
174342
|
+
() => this.decoding.delete(key)
|
|
174343
|
+
);
|
|
174344
|
+
this.decoding.set(key, reading);
|
|
174345
|
+
return reading;
|
|
174346
|
+
}
|
|
174347
|
+
async decode(path2, key) {
|
|
174348
|
+
if (this.tree.readBytes === void 0) return this.read(path2);
|
|
174349
|
+
const bytes = await this.tree.readBytes(path2);
|
|
174350
|
+
this.reads += 1;
|
|
174351
|
+
const text6 = new TextDecoder("utf-8").decode(bytes);
|
|
174352
|
+
this.decoded.set(key, text6);
|
|
174353
|
+
return text6;
|
|
174354
|
+
}
|
|
174679
174355
|
/** The file's text, from this reader, the cache, or the host. */
|
|
174680
174356
|
async read(path2) {
|
|
174681
174357
|
const held = this.texts.get(path2);
|
|
@@ -175076,15 +174752,15 @@ __export(check_exports, {
|
|
|
175076
174752
|
readHead: () => readHead2
|
|
175077
174753
|
});
|
|
175078
174754
|
import { execFileSync } from "node:child_process";
|
|
175079
|
-
import { createHash as
|
|
174755
|
+
import { createHash as createHash31 } from "node:crypto";
|
|
175080
174756
|
import {
|
|
175081
|
-
lstatSync as
|
|
175082
|
-
mkdirSync as
|
|
175083
|
-
readFileSync as
|
|
174757
|
+
lstatSync as lstatSync14,
|
|
174758
|
+
mkdirSync as mkdirSync15,
|
|
174759
|
+
readFileSync as readFileSync32,
|
|
175084
174760
|
readlinkSync as readlinkSync4,
|
|
175085
174761
|
statSync as statSync21
|
|
175086
174762
|
} from "node:fs";
|
|
175087
|
-
import { dirname as
|
|
174763
|
+
import { dirname as dirname37, isAbsolute as isAbsolute19, join as join69, relative as relative10, resolve as resolve28, sep as sep13 } from "node:path";
|
|
175088
174764
|
function cloneRepoKind(root) {
|
|
175089
174765
|
const out = git4(root, ["remote", "get-url", "origin"]);
|
|
175090
174766
|
const url2 = out?.toString("utf8").trim() ?? "";
|
|
@@ -175124,11 +174800,11 @@ function commitOf(root, ref) {
|
|
|
175124
174800
|
return sha2.length > 0 ? sha2 : null;
|
|
175125
174801
|
}
|
|
175126
174802
|
function readWorkingFile(root, path2) {
|
|
175127
|
-
const abs =
|
|
174803
|
+
const abs = join69(root, ...path2.split("/"));
|
|
175128
174804
|
try {
|
|
175129
|
-
const stat7 =
|
|
174805
|
+
const stat7 = lstatSync14(abs);
|
|
175130
174806
|
if (stat7.isSymbolicLink()) return readlinkSync4(abs, "utf8");
|
|
175131
|
-
return stat7.isFile() ?
|
|
174807
|
+
return stat7.isFile() ? readFileSync32(abs, "utf8") : null;
|
|
175132
174808
|
} catch {
|
|
175133
174809
|
return null;
|
|
175134
174810
|
}
|
|
@@ -175218,10 +174894,10 @@ function isDir(path2) {
|
|
|
175218
174894
|
function findSteeringRoot(start) {
|
|
175219
174895
|
let dir = resolve28(start);
|
|
175220
174896
|
for (; ; ) {
|
|
175221
|
-
if (isFile(
|
|
174897
|
+
if (isFile(join69(dir, WORKSPACE_TOML_PATH)) || isFile(join69(dir, AGENTS_MD_PATH)) && isDir(join69(dir, STEERING_DIR))) {
|
|
175222
174898
|
return dir;
|
|
175223
174899
|
}
|
|
175224
|
-
const parent =
|
|
174900
|
+
const parent = dirname37(dir);
|
|
175225
174901
|
if (parent === dir) return null;
|
|
175226
174902
|
dir = parent;
|
|
175227
174903
|
}
|
|
@@ -175232,11 +174908,11 @@ function within3(path2, scope) {
|
|
|
175232
174908
|
function scopesFor(root, cwd, paths, trees) {
|
|
175233
174909
|
const scopes = [];
|
|
175234
174910
|
for (const path2 of paths) {
|
|
175235
|
-
const rel =
|
|
175236
|
-
if (rel === ".." || rel.startsWith(`..${
|
|
174911
|
+
const rel = relative10(root, resolve28(cwd, path2));
|
|
174912
|
+
if (rel === ".." || rel.startsWith(`..${sep13}`) || isAbsolute19(rel)) {
|
|
175237
174913
|
return { error: `${path2} is outside the steering repo at ${root}.` };
|
|
175238
174914
|
}
|
|
175239
|
-
const scope = rel.split(
|
|
174915
|
+
const scope = rel.split(sep13).join("/");
|
|
175240
174916
|
const known = trees.some(
|
|
175241
174917
|
(tree) => tree !== null && [...tree.keys()].some((file) => within3(file, scope))
|
|
175242
174918
|
);
|
|
@@ -175295,15 +174971,15 @@ function cacheFile(cacheDir, root) {
|
|
|
175295
174971
|
const identity = {
|
|
175296
174972
|
api: getApiUrl(),
|
|
175297
174973
|
...targetOf(root),
|
|
175298
|
-
key: token === void 0 ? null :
|
|
174974
|
+
key: token === void 0 ? null : createHash31("sha256").update(token).digest("hex").slice(0, 16)
|
|
175299
174975
|
};
|
|
175300
|
-
const key =
|
|
175301
|
-
return
|
|
174976
|
+
const key = createHash31("sha256").update(JSON.stringify([root, identity])).digest("hex").slice(0, 32);
|
|
174977
|
+
return join69(cacheDir, `${key}.json`);
|
|
175302
174978
|
}
|
|
175303
174979
|
function readCache(file, now) {
|
|
175304
174980
|
let entry2;
|
|
175305
174981
|
try {
|
|
175306
|
-
entry2 = JSON.parse(
|
|
174982
|
+
entry2 = JSON.parse(readFileSync32(file, "utf8"));
|
|
175307
174983
|
} catch {
|
|
175308
174984
|
return null;
|
|
175309
174985
|
}
|
|
@@ -175326,7 +175002,7 @@ async function publishedInputs(root, deps, refresh, out) {
|
|
|
175326
175002
|
}
|
|
175327
175003
|
if (file !== null) {
|
|
175328
175004
|
try {
|
|
175329
|
-
|
|
175005
|
+
mkdirSync15(dirname37(file), { recursive: true });
|
|
175330
175006
|
atomicWriteFileSync(
|
|
175331
175007
|
file,
|
|
175332
175008
|
JSON.stringify({
|
|
@@ -175412,7 +175088,7 @@ function defaultDeps2() {
|
|
|
175412
175088
|
return {
|
|
175413
175089
|
fetchPublished: fetchSteeringIndex,
|
|
175414
175090
|
cedar: cedarHooks,
|
|
175415
|
-
cacheDir:
|
|
175091
|
+
cacheDir: join69(getConfigDir(), "cache", "steering-check"),
|
|
175416
175092
|
now: () => Date.now()
|
|
175417
175093
|
};
|
|
175418
175094
|
}
|
|
@@ -175987,12 +175663,12 @@ var init_telemetry = __esm({
|
|
|
175987
175663
|
});
|
|
175988
175664
|
|
|
175989
175665
|
// src/auth/pkce.ts
|
|
175990
|
-
import { createHash as
|
|
175666
|
+
import { createHash as createHash32, randomBytes as randomBytes15 } from "node:crypto";
|
|
175991
175667
|
function generateCodeVerifier() {
|
|
175992
175668
|
return randomBytes15(32).toString("base64url");
|
|
175993
175669
|
}
|
|
175994
175670
|
function codeChallengeS256(codeVerifier) {
|
|
175995
|
-
return
|
|
175671
|
+
return createHash32("sha256").update(codeVerifier, "ascii").digest("base64url");
|
|
175996
175672
|
}
|
|
175997
175673
|
function generateState() {
|
|
175998
175674
|
return randomBytes15(16).toString("base64url");
|
|
@@ -176609,10 +176285,6 @@ async function handleLogout() {
|
|
|
176609
176285
|
`
|
|
176610
176286
|
);
|
|
176611
176287
|
}
|
|
176612
|
-
process.stdout.write(
|
|
176613
|
-
`Note: per-project links (.oxagen/workspace.json) are left intact.
|
|
176614
|
-
`
|
|
176615
|
-
);
|
|
176616
176288
|
}
|
|
176617
176289
|
var WHOAMI_TIMEOUT_MS, LOGOUT_TIMEOUT_MS;
|
|
176618
176290
|
var init_auth4 = __esm({
|
|
@@ -176874,7 +176546,7 @@ async function routerPreview(prompt, opts = {}, writer = stdoutWriter) {
|
|
|
176874
176546
|
writer.write(
|
|
176875
176547
|
`Task class: ${result2.taskClass} \xB7 decision: ${result2.source}`
|
|
176876
176548
|
);
|
|
176877
|
-
writer.write(`\u2192 ${
|
|
176549
|
+
writer.write(`\u2192 ${short3(result2.model)} (${result2.tier})`);
|
|
176878
176550
|
writer.write(` ${result2.rationale}`);
|
|
176879
176551
|
writer.write("");
|
|
176880
176552
|
if (result2.candidates.length === 0) {
|
|
@@ -176886,7 +176558,7 @@ async function routerPreview(prompt, opts = {}, writer = stdoutWriter) {
|
|
|
176886
176558
|
printTable(
|
|
176887
176559
|
["MODEL", "VERIFIED", "N", "AVG COST", "ELIGIBLE", "WHY"],
|
|
176888
176560
|
result2.candidates.map((c) => [
|
|
176889
|
-
|
|
176561
|
+
short3(c.model),
|
|
176890
176562
|
pct2(c.verifiedRate),
|
|
176891
176563
|
String(c.samples),
|
|
176892
176564
|
usd(c.avgCostUsdMicros),
|
|
@@ -176974,7 +176646,7 @@ async function routerPolicySet(opts = {}, writer = stdoutWriter) {
|
|
|
176974
176646
|
renderPolicy(result2, writer);
|
|
176975
176647
|
renderKindRules(result2.kindRules, { withSource: false }, writer);
|
|
176976
176648
|
}
|
|
176977
|
-
var pct2, usd,
|
|
176649
|
+
var pct2, usd, short3;
|
|
176978
176650
|
var init_router = __esm({
|
|
176979
176651
|
"src/commands/router.ts"() {
|
|
176980
176652
|
init_api();
|
|
@@ -176983,7 +176655,7 @@ var init_router = __esm({
|
|
|
176983
176655
|
init_capture_writer();
|
|
176984
176656
|
pct2 = (r) => `${(r * 100).toFixed(1)}%`;
|
|
176985
176657
|
usd = (micros2) => formatUsd(micros2 / 1e6);
|
|
176986
|
-
|
|
176658
|
+
short3 = (model) => model.split("/").pop() ?? model;
|
|
176987
176659
|
}
|
|
176988
176660
|
});
|
|
176989
176661
|
|
|
@@ -177048,7 +176720,7 @@ __export(secret_exports, {
|
|
|
177048
176720
|
handleSecretReveal: () => handleSecretReveal,
|
|
177049
176721
|
handleSecretSet: () => handleSecretSet
|
|
177050
176722
|
});
|
|
177051
|
-
import { readFileSync as
|
|
176723
|
+
import { readFileSync as readFileSync33, writeFileSync as writeFileSync12 } from "fs";
|
|
177052
176724
|
async function readStdin2() {
|
|
177053
176725
|
const chunks = [];
|
|
177054
176726
|
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
@@ -177161,7 +176833,7 @@ async function handleSecretReveal(key, opts, writer = stdoutWriter) {
|
|
|
177161
176833
|
async function handleSecretImport(opts, writer = stdoutWriter) {
|
|
177162
176834
|
const out = createOutput({}, writer);
|
|
177163
176835
|
try {
|
|
177164
|
-
const text6 = opts.file ?
|
|
176836
|
+
const text6 = opts.file ? readFileSync33(opts.file, "utf8") : await readStdin2();
|
|
177165
176837
|
const environmentId = opts.env ? await resolveEnvironmentId(opts.env) : null;
|
|
177166
176838
|
const { rows, committed } = await apiPostOrThrow("secret/import-env", { text: text6, environmentId, commit: !!opts.yes });
|
|
177167
176839
|
const newCount = rows.filter((r) => r.isNewKey).length;
|
|
@@ -177538,6 +177210,12 @@ function withTemplateFlags(command2) {
|
|
|
177538
177210
|
"--service <name>",
|
|
177539
177211
|
"A service the template starts before the harness, such as postgres. Repeat for each one",
|
|
177540
177212
|
collectLines
|
|
177213
|
+
).option(
|
|
177214
|
+
"--setup-command <command>",
|
|
177215
|
+
"A command the image build runs once as root, such as 'apt-get install -y libpq-dev'"
|
|
177216
|
+
).option(
|
|
177217
|
+
"--setup-dir <folder>",
|
|
177218
|
+
"The folder the setup command runs in, such as /opt/setup (default: /)"
|
|
177541
177219
|
);
|
|
177542
177220
|
}
|
|
177543
177221
|
function addSandboxRunsAndRuntimes(sandbox) {
|
|
@@ -178078,10 +177756,10 @@ function buildProgram() {
|
|
|
178078
177756
|
await repoUnlink2(bindingId, opts);
|
|
178079
177757
|
});
|
|
178080
177758
|
repoCmd.command("tree").description(
|
|
178081
|
-
"What
|
|
178082
|
-
).
|
|
177759
|
+
"What the workspace's steering repository holds on its production branch, read from GitHub now"
|
|
177760
|
+
).option("--json", "Output JSON").action(async (opts) => {
|
|
178083
177761
|
const { repoTree: repoTree2 } = await Promise.resolve().then(() => (init_repo(), repo_exports));
|
|
178084
|
-
await repoTree2(
|
|
177762
|
+
await repoTree2(opts);
|
|
178085
177763
|
});
|
|
178086
177764
|
repoCmd.command("branch").description(
|
|
178087
177765
|
"Confirm or change a repository's production branch; the branch must exist on GitHub"
|
|
@@ -178091,20 +177769,6 @@ function buildProgram() {
|
|
|
178091
177769
|
await repoBranch2(bindingId, branch, opts);
|
|
178092
177770
|
}
|
|
178093
177771
|
);
|
|
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
177772
|
repoCmd.command("governance").description(
|
|
178109
177773
|
"Set the steering governance mode: who may merge a steering PR in this workspace"
|
|
178110
177774
|
).requiredOption("--mode <mode>", "solo | team | regulated").option(
|
|
@@ -178414,6 +178078,12 @@ function buildProgram() {
|
|
|
178414
178078
|
).option("--prompt <text>", "The task for the agent").option("--prompt-file <path>", "Read the task for the agent from a file").option(
|
|
178415
178079
|
"--work-order <id>",
|
|
178416
178080
|
"Run this work order (wo_\u2026) instead of naming a repo"
|
|
178081
|
+
).option(
|
|
178082
|
+
"--account-source <source>",
|
|
178083
|
+
"Whose model accounts the run bills: operator, workspace, or operator_then_workspace (default: the agent's)"
|
|
178084
|
+
).option(
|
|
178085
|
+
"--confirm-workspace-billing",
|
|
178086
|
+
"Confirm that the run may bill the workspace's model accounts"
|
|
178417
178087
|
).option("--json", "Output the run as JSON and do not attach").action(
|
|
178418
178088
|
async (opts) => (await Promise.resolve().then(() => (init_sandbox_run(), sandbox_run_exports))).sandboxRun(opts)
|
|
178419
178089
|
);
|
|
@@ -178461,6 +178131,18 @@ function buildProgram() {
|
|
|
178461
178131
|
opts
|
|
178462
178132
|
)
|
|
178463
178133
|
);
|
|
178134
|
+
sandboxTemplateCmd.command("log").description(
|
|
178135
|
+
"Print the stored log of one template build of a sandbox runtime, with credentials redacted. Org Owner, or workspace Admin"
|
|
178136
|
+
).argument("<runtime>", "The sandbox runtime's id (rtm_\u2026)").argument("<build>", "The template build's id (rtp_\u2026)").option(
|
|
178137
|
+
"--workspace-slug <slug>",
|
|
178138
|
+
"The workspace the runtime belongs to (or OXAGEN_WORKSPACE)"
|
|
178139
|
+
).option("--json", "Output the log as JSON").action(
|
|
178140
|
+
async (runtime, build, opts) => (await Promise.resolve().then(() => (init_sandbox_template(), sandbox_template_exports))).sandboxTemplateLog(
|
|
178141
|
+
runtime,
|
|
178142
|
+
build,
|
|
178143
|
+
opts
|
|
178144
|
+
)
|
|
178145
|
+
);
|
|
178464
178146
|
sandboxCmd.command("pin-hooks", { hidden: true }).description(
|
|
178465
178147
|
"Write the sandbox's hook files as the launcher does, and print their hash"
|
|
178466
178148
|
).helpOption(false).allowUnknownOption().allowExcessArguments().action(async () => {
|
|
@@ -178488,18 +178170,27 @@ function buildProgram() {
|
|
|
178488
178170
|
).option(
|
|
178489
178171
|
"--workspace-slug <slug>",
|
|
178490
178172
|
"The workspace to address (or OXAGEN_WORKSPACE)"
|
|
178173
|
+
).option(
|
|
178174
|
+
"--shared",
|
|
178175
|
+
"Act on this workspace's accounts instead of your own. Changing one needs a workspace Admin or an organization Owner"
|
|
178491
178176
|
).option("--json", "Output JSON").action(
|
|
178492
178177
|
async (opts) => (await Promise.resolve().then(() => (init_credentials(), credentials_exports))).credentialsAdd(opts)
|
|
178493
178178
|
);
|
|
178494
178179
|
credentialsCmd.command("list").description("List your credentials in the order the gateway uses them").option(
|
|
178495
178180
|
"--workspace-slug <slug>",
|
|
178496
178181
|
"The workspace to address (or OXAGEN_WORKSPACE)"
|
|
178182
|
+
).option(
|
|
178183
|
+
"--shared",
|
|
178184
|
+
"Act on this workspace's accounts instead of your own. Changing one needs a workspace Admin or an organization Owner"
|
|
178497
178185
|
).option("--json", "Output JSON").action(
|
|
178498
178186
|
async (opts) => (await Promise.resolve().then(() => (init_credentials(), credentials_exports))).credentialsList(opts)
|
|
178499
178187
|
);
|
|
178500
178188
|
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
178189
|
"--workspace-slug <slug>",
|
|
178502
178190
|
"The workspace to address (or OXAGEN_WORKSPACE)"
|
|
178191
|
+
).option(
|
|
178192
|
+
"--shared",
|
|
178193
|
+
"Act on this workspace's accounts instead of your own. Changing one needs a workspace Admin or an organization Owner"
|
|
178503
178194
|
).option("--json", "Output JSON").action(
|
|
178504
178195
|
async (credential, opts) => (await Promise.resolve().then(() => (init_credentials(), credentials_exports))).credentialsUpdate(
|
|
178505
178196
|
credential,
|
|
@@ -178514,6 +178205,9 @@ function buildProgram() {
|
|
|
178514
178205
|
).option(
|
|
178515
178206
|
"--workspace-slug <slug>",
|
|
178516
178207
|
"The workspace to address (or OXAGEN_WORKSPACE)"
|
|
178208
|
+
).option(
|
|
178209
|
+
"--shared",
|
|
178210
|
+
"Act on this workspace's accounts instead of your own. Changing one needs a workspace Admin or an organization Owner"
|
|
178517
178211
|
).option("--json", "Output JSON").action(
|
|
178518
178212
|
async (credential, opts) => (await Promise.resolve().then(() => (init_credentials(), credentials_exports))).credentialsRotate(
|
|
178519
178213
|
credential,
|
|
@@ -178523,6 +178217,9 @@ function buildProgram() {
|
|
|
178523
178217
|
credentialsCmd.command("remove").description("Remove one of your credentials").argument("<credential>", "The credential's id (vlt_\u2026)").option(
|
|
178524
178218
|
"--workspace-slug <slug>",
|
|
178525
178219
|
"The workspace to address (or OXAGEN_WORKSPACE)"
|
|
178220
|
+
).option(
|
|
178221
|
+
"--shared",
|
|
178222
|
+
"Act on this workspace's accounts instead of your own. Changing one needs a workspace Admin or an organization Owner"
|
|
178526
178223
|
).option("--json", "Output JSON").action(
|
|
178527
178224
|
async (credential, opts) => (await Promise.resolve().then(() => (init_credentials(), credentials_exports))).credentialsRemove(
|
|
178528
178225
|
credential,
|
|
@@ -178805,13 +178502,13 @@ function buildProgram() {
|
|
|
178805
178502
|
}
|
|
178806
178503
|
);
|
|
178807
178504
|
program2.command("init").description(
|
|
178808
|
-
"
|
|
178505
|
+
"Pick the Oxagen org + workspace the CLI works in, and report this directory to it. Writes no file here"
|
|
178809
178506
|
).option(
|
|
178810
178507
|
"--org <slug>",
|
|
178811
178508
|
"Link this organization instead of choosing one; works without a terminal"
|
|
178812
178509
|
).option(
|
|
178813
178510
|
"--workspace <slug>",
|
|
178814
|
-
"Link this workspace instead of choosing one; relinks when
|
|
178511
|
+
"Link this workspace instead of choosing one; relinks when another one is saved"
|
|
178815
178512
|
).option("--json", "Output JSON instead of human-readable text").option("--no-link", "Skip the workspace linker step entirely").action(
|
|
178816
178513
|
async (opts) => {
|
|
178817
178514
|
const { handleInit: handleInit2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
@@ -178823,17 +178520,6 @@ function buildProgram() {
|
|
|
178823
178520
|
});
|
|
178824
178521
|
}
|
|
178825
178522
|
);
|
|
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
178523
|
program2.command("check").argument(
|
|
178838
178524
|
"[paths...]",
|
|
178839
178525
|
"Report only the findings in these files and folders"
|