@m8t-stack/cli 0.2.29 → 0.2.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +420 -218
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1247,7 +1247,7 @@ var init_enable_hosted_brain = __esm({
|
|
|
1247
1247
|
import { Builtins, Cli } from "clipanion";
|
|
1248
1248
|
|
|
1249
1249
|
// src/lib/package-version.ts
|
|
1250
|
-
var CLI_VERSION = "0.2.
|
|
1250
|
+
var CLI_VERSION = "0.2.30";
|
|
1251
1251
|
|
|
1252
1252
|
// src/lib/render-error.ts
|
|
1253
1253
|
init_errors();
|
|
@@ -1335,7 +1335,7 @@ var BACKEND_RULES = [
|
|
|
1335
1335
|
reason: "unknown_channel",
|
|
1336
1336
|
hint: () => "channel must be one of: telegram, slack, teams."
|
|
1337
1337
|
},
|
|
1338
|
-
// BAD_REQUEST —
|
|
1338
|
+
// BAD_REQUEST — binding-validation reasons
|
|
1339
1339
|
{
|
|
1340
1340
|
code: "BAD_REQUEST",
|
|
1341
1341
|
reason: "no_adapter_registered",
|
|
@@ -1391,13 +1391,13 @@ var BACKEND_RULES = [
|
|
|
1391
1391
|
return `no binding '${bindingId}' found. Run 'm8t bind list' to see all bindings.`;
|
|
1392
1392
|
}
|
|
1393
1393
|
},
|
|
1394
|
-
// BAD_REQUEST —
|
|
1394
|
+
// BAD_REQUEST — webhook-registration rejection
|
|
1395
1395
|
{
|
|
1396
1396
|
code: "BAD_REQUEST",
|
|
1397
1397
|
reason: "webhook_registration_rejected",
|
|
1398
1398
|
hint: () => "Telegram rejected the bot token. Double-check the token from BotFather and that it isn't revoked."
|
|
1399
1399
|
},
|
|
1400
|
-
// UPSTREAM_FAILED —
|
|
1400
|
+
// UPSTREAM_FAILED — webhook-registration transient failure
|
|
1401
1401
|
{
|
|
1402
1402
|
code: "UPSTREAM_FAILED",
|
|
1403
1403
|
reason: "webhook_registration_failed",
|
|
@@ -1452,7 +1452,7 @@ var LOCAL_RULES = {
|
|
|
1452
1452
|
APP_HEALTH_FAILED: "Run `m8t brain check-app` for details, then re-run this command.",
|
|
1453
1453
|
APP_UNINSTALL_FAILED: "GitHub App-uninstall DELETE failed. Re-run with `--keep-app-install` if you want to skip this step.",
|
|
1454
1454
|
ARM_AUTH: "Run `az login` and retry.",
|
|
1455
|
-
//
|
|
1455
|
+
// m8t brain create: stageAsGitRepo step
|
|
1456
1456
|
BRAIN_GIT_INIT_FAILED: "If git is not installed, install it. Otherwise re-run with --verbose.",
|
|
1457
1457
|
BRAIN_NOT_LINKED: "The worker has no brain link. Use `m8t brain link` or `m8t brain create` first.",
|
|
1458
1458
|
BRAIN_YAML_MIRROR_FAILED: "GitHub Contents API PUT failed. Verify the App has `contents: write` permission on the repo.",
|
|
@@ -1468,7 +1468,6 @@ var LOCAL_RULES = {
|
|
|
1468
1468
|
PERSONA_PATH_NOT_ABSOLUTE: "The persona path in ~/.m8t/foundry/<worker>.yaml must be absolute. Re-deploy the worker via the architect.",
|
|
1469
1469
|
PERSONA_PLACEHOLDER_UNSATISFIED: "Re-deploy the worker via the architect to repopulate fillableFieldValues, OR edit ~/.m8t/foundry/<worker>.yaml manually.",
|
|
1470
1470
|
PERSONA_READ_FAILED: "Verify the persona path in ~/.m8t/foundry/<worker>.yaml; the architect should have populated it at deploy time.",
|
|
1471
|
-
// ── pre-existing entries ──────────────────────────────────────────────────
|
|
1472
1471
|
AUTH_NOT_SIGNED_IN: "you are not signed in to Azure \u2014 run 'az login' first.",
|
|
1473
1472
|
AUTH_EXPIRED: "your Azure login expired \u2014 run 'az login' to re-authenticate.",
|
|
1474
1473
|
AUTH_WRONG_TENANT: "your active Azure session may be in a different tenant \u2014 run 'az login --tenant <id>'.",
|
|
@@ -14262,8 +14261,8 @@ function isM8tBrainMarker(yamlText) {
|
|
|
14262
14261
|
}
|
|
14263
14262
|
if (!parsed || typeof parsed !== "object") return false;
|
|
14264
14263
|
const root = parsed;
|
|
14265
|
-
const
|
|
14266
|
-
return
|
|
14264
|
+
const isObj4 = (v) => typeof v === "object" && v !== null;
|
|
14265
|
+
return isObj4(root.engine) || isObj4(root.processes) || isObj4(root.link);
|
|
14267
14266
|
}
|
|
14268
14267
|
async function createBlankRepo(args) {
|
|
14269
14268
|
const res = await fetch(`https://api.github.com/orgs/${args.org}/repos`, {
|
|
@@ -20184,8 +20183,181 @@ function targetManifestSource(ctx, target) {
|
|
|
20184
20183
|
return manifestSourceForVersionTag(ctx.channelUrl, target);
|
|
20185
20184
|
}
|
|
20186
20185
|
|
|
20187
|
-
// src/commands/platform/
|
|
20186
|
+
// src/commands/platform/seed-stamp.ts
|
|
20187
|
+
import { readFileSync as readFileSync17 } from "fs";
|
|
20188
20188
|
import { Command as Command34, Option as Option31 } from "clipanion";
|
|
20189
|
+
import { DefaultAzureCredential as DefaultAzureCredential18, ManagedIdentityCredential as ManagedIdentityCredential2 } from "@azure/identity";
|
|
20190
|
+
init_errors();
|
|
20191
|
+
|
|
20192
|
+
// src/lib/platform-stamp-seed.ts
|
|
20193
|
+
var IMAGE_COMPONENTS = ["gateway", "codingAgent", "azureExecutor"];
|
|
20194
|
+
var BARE_SEMVER = /^\d+\.\d+\.\d+$/;
|
|
20195
|
+
function isObj3(v) {
|
|
20196
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
20197
|
+
}
|
|
20198
|
+
function validateDescriptor(raw) {
|
|
20199
|
+
const errors = [];
|
|
20200
|
+
if (!isObj3(raw)) return ["descriptor is not an object"];
|
|
20201
|
+
if (raw.schemaVersion !== 1) errors.push("schemaVersion must be the integer 1");
|
|
20202
|
+
if (typeof raw.platformVersion !== "string" || !BARE_SEMVER.test(raw.platformVersion)) {
|
|
20203
|
+
errors.push(`platformVersion must be a bare X.Y.Z release version, got ${JSON.stringify(raw.platformVersion)}`);
|
|
20204
|
+
}
|
|
20205
|
+
if (!isObj3(raw.generatedFrom)) {
|
|
20206
|
+
errors.push("generatedFrom is required");
|
|
20207
|
+
} else {
|
|
20208
|
+
if (typeof raw.generatedFrom.commit !== "string") {
|
|
20209
|
+
errors.push("generatedFrom.commit is required");
|
|
20210
|
+
}
|
|
20211
|
+
if (typeof raw.generatedFrom.generatedAt !== "string") {
|
|
20212
|
+
errors.push("generatedFrom.generatedAt is required");
|
|
20213
|
+
}
|
|
20214
|
+
}
|
|
20215
|
+
const images = raw.images;
|
|
20216
|
+
if (!isObj3(images)) {
|
|
20217
|
+
errors.push("images is required");
|
|
20218
|
+
} else {
|
|
20219
|
+
for (const key2 of IMAGE_COMPONENTS) {
|
|
20220
|
+
const img = images[key2];
|
|
20221
|
+
if (!isObj3(img)) {
|
|
20222
|
+
errors.push(`images.${key2} is required`);
|
|
20223
|
+
continue;
|
|
20224
|
+
}
|
|
20225
|
+
if (typeof img.ref !== "string" || img.ref.length === 0) errors.push(`images.${key2}.ref is required`);
|
|
20226
|
+
if (typeof img.tag !== "string" || img.tag.length === 0) errors.push(`images.${key2}.tag is required`);
|
|
20227
|
+
if (typeof img.digest !== "string") errors.push(`images.${key2}.digest must be a string (may be empty)`);
|
|
20228
|
+
}
|
|
20229
|
+
}
|
|
20230
|
+
const content = raw.content;
|
|
20231
|
+
if (content !== void 0) {
|
|
20232
|
+
if (!isObj3(content)) {
|
|
20233
|
+
errors.push("content must be an object when present");
|
|
20234
|
+
} else {
|
|
20235
|
+
if (!isObj3(content.personas)) errors.push("content.personas must be an object");
|
|
20236
|
+
if (typeof content.infra !== "string") errors.push("content.infra must be a string");
|
|
20237
|
+
if (typeof content.brainSeedsRev !== "string") errors.push("content.brainSeedsRev must be a string");
|
|
20238
|
+
}
|
|
20239
|
+
}
|
|
20240
|
+
return errors;
|
|
20241
|
+
}
|
|
20242
|
+
function buildSeedStamp(d, cliVersion, nowIso) {
|
|
20243
|
+
const img = (k) => ({
|
|
20244
|
+
tag: d.images[k].tag,
|
|
20245
|
+
digest: d.images[k].digest,
|
|
20246
|
+
state: "managed"
|
|
20247
|
+
});
|
|
20248
|
+
const personas = {};
|
|
20249
|
+
for (const [name, treeSha] of Object.entries(d.content?.personas ?? {})) {
|
|
20250
|
+
personas[name] = { treeSha, foundryVersion: "" };
|
|
20251
|
+
}
|
|
20252
|
+
const stamp = {
|
|
20253
|
+
schemaVersion: 1,
|
|
20254
|
+
platformVersion: platformTag(d.platformVersion),
|
|
20255
|
+
previousPlatformVersion: null,
|
|
20256
|
+
updatedAt: nowIso,
|
|
20257
|
+
lastResult: "success",
|
|
20258
|
+
cli: cliVersion,
|
|
20259
|
+
origin: "install-seed",
|
|
20260
|
+
components: {
|
|
20261
|
+
gateway: img("gateway"),
|
|
20262
|
+
codingAgent: img("codingAgent"),
|
|
20263
|
+
azureExecutor: img("azureExecutor"),
|
|
20264
|
+
personas,
|
|
20265
|
+
infra: { treeSha: d.content?.infra ?? "" }
|
|
20266
|
+
}
|
|
20267
|
+
};
|
|
20268
|
+
if (d.content?.brainSeedsRev) stamp.components.brainSeeds = { seedRev: d.content.brainSeedsRev };
|
|
20269
|
+
return stamp;
|
|
20270
|
+
}
|
|
20271
|
+
|
|
20272
|
+
// src/commands/platform/seed-stamp.ts
|
|
20273
|
+
async function seedStamp2(args) {
|
|
20274
|
+
const readFileImpl = args.readFileImpl ?? ((p) => readFileSync17(p, "utf8"));
|
|
20275
|
+
const readStampImpl = args.readStampImpl ?? readStamp;
|
|
20276
|
+
const writeStampImpl = args.writeStampImpl ?? ((stamp2, o) => writeStamp({ ...o, stamp: stamp2 }));
|
|
20277
|
+
const discoverImpl = args.discoverImpl ?? discoverStampStorage;
|
|
20278
|
+
const ctx = { credential: args.credential, subscriptionId: args.subscriptionId, resourceGroup: args.resourceGroup };
|
|
20279
|
+
let raw;
|
|
20280
|
+
try {
|
|
20281
|
+
raw = JSON.parse(readFileImpl(args.descriptorPath));
|
|
20282
|
+
} catch (e) {
|
|
20283
|
+
throw new LocalCliError({
|
|
20284
|
+
code: "PLATFORM_SEED_DESCRIPTOR_UNREADABLE",
|
|
20285
|
+
message: `Cannot read the install descriptor at ${args.descriptorPath}.`,
|
|
20286
|
+
hint: "The descriptor is generated at installer-image build time (scripts/install-descriptor-gen.mjs). An image built without that step cannot seed a stamp.",
|
|
20287
|
+
cause: e
|
|
20288
|
+
});
|
|
20289
|
+
}
|
|
20290
|
+
const errors = validateDescriptor(raw);
|
|
20291
|
+
if (errors.length > 0) {
|
|
20292
|
+
throw new LocalCliError({
|
|
20293
|
+
code: "PLATFORM_SEED_DESCRIPTOR_INVALID",
|
|
20294
|
+
message: `The install descriptor at ${args.descriptorPath} is not valid: ${errors.join("; ")}.`,
|
|
20295
|
+
hint: "Regenerate it with scripts/install-descriptor-gen.mjs."
|
|
20296
|
+
});
|
|
20297
|
+
}
|
|
20298
|
+
const descriptor = raw;
|
|
20299
|
+
const { accountName } = await discoverImpl(ctx);
|
|
20300
|
+
const existing = await readStampImpl(ctx);
|
|
20301
|
+
if (existing) {
|
|
20302
|
+
args.onProgress?.(`platform stamp already present (${existing.platformVersion}) \u2014 leaving it untouched.`);
|
|
20303
|
+
return { outcome: "already-stamped", platformVersion: existing.platformVersion, storageAccount: accountName };
|
|
20304
|
+
}
|
|
20305
|
+
const stamp = buildSeedStamp(descriptor, CLI_VERSION, args.nowIso ?? (/* @__PURE__ */ new Date()).toISOString());
|
|
20306
|
+
await writeStampImpl(stamp, { ...ctx, onProgress: args.onProgress });
|
|
20307
|
+
return {
|
|
20308
|
+
outcome: descriptor.content ? "seeded" : "seeded-partial",
|
|
20309
|
+
platformVersion: stamp.platformVersion,
|
|
20310
|
+
storageAccount: accountName,
|
|
20311
|
+
components: {
|
|
20312
|
+
gateway: stamp.components.gateway.tag,
|
|
20313
|
+
codingAgent: stamp.components.codingAgent.tag,
|
|
20314
|
+
azureExecutor: stamp.components.azureExecutor.tag
|
|
20315
|
+
}
|
|
20316
|
+
};
|
|
20317
|
+
}
|
|
20318
|
+
var PlatformSeedStampCommand = class extends M8tCommand {
|
|
20319
|
+
static paths = [["platform", "seed-stamp"]];
|
|
20320
|
+
static usage = Command34.Usage({
|
|
20321
|
+
description: "INTERNAL: write the initial installed-state stamp from a build-time install descriptor.",
|
|
20322
|
+
details: "Used by the cloud installer at the end of a from-zero install so the platform records which release it is running. Writes the stamp ONLY IF ABSENT \u2014 it never overwrites a stamp written by the converge engine, so a re-run or a container restart is harmless. Not a founder-facing command: to change what is installed, use 'm8t platform update'."
|
|
20323
|
+
});
|
|
20324
|
+
descriptor = Option31.String("--descriptor", { description: "Path to install-descriptor.json (baked into the installer image)." });
|
|
20325
|
+
subscription = Option31.String("--subscription");
|
|
20326
|
+
resourceGroup = Option31.String("--resource-group");
|
|
20327
|
+
miClientId = Option31.String("--mi-client-id", { description: "Authenticate as this user-assigned managed identity instead of the ambient credential." });
|
|
20328
|
+
output = Option31.String("--output");
|
|
20329
|
+
async executeCommand() {
|
|
20330
|
+
const mode = resolveOutputMode(this.output, this.context.stdout);
|
|
20331
|
+
const need = (v, flag) => {
|
|
20332
|
+
if (typeof v !== "string" || v.trim().length === 0) {
|
|
20333
|
+
throw new LocalCliError({ code: "PLATFORM_SEED_ARG_MISSING", message: `${flag} is required.` });
|
|
20334
|
+
}
|
|
20335
|
+
return v.trim();
|
|
20336
|
+
};
|
|
20337
|
+
const onProgress = (m) => {
|
|
20338
|
+
this.context.stderr.write(`${m}
|
|
20339
|
+
`);
|
|
20340
|
+
};
|
|
20341
|
+
const credential2 = typeof this.miClientId === "string" && this.miClientId.trim().length > 0 ? new ManagedIdentityCredential2({ clientId: this.miClientId.trim() }) : new DefaultAzureCredential18();
|
|
20342
|
+
const result = await seedStamp2({
|
|
20343
|
+
descriptorPath: need(this.descriptor, "--descriptor"),
|
|
20344
|
+
credential: credential2,
|
|
20345
|
+
subscriptionId: need(this.subscription, "--subscription"),
|
|
20346
|
+
resourceGroup: need(this.resourceGroup, "--resource-group"),
|
|
20347
|
+
onProgress
|
|
20348
|
+
});
|
|
20349
|
+
if (mode === "json") {
|
|
20350
|
+
this.context.stdout.write(renderJson(result) + "\n");
|
|
20351
|
+
} else {
|
|
20352
|
+
this.context.stdout.write(`${result.outcome}: ${result.platformVersion} (storage ${result.storageAccount})
|
|
20353
|
+
`);
|
|
20354
|
+
}
|
|
20355
|
+
return 0;
|
|
20356
|
+
}
|
|
20357
|
+
};
|
|
20358
|
+
|
|
20359
|
+
// src/commands/platform/enable-cost-report.ts
|
|
20360
|
+
import { Command as Command35, Option as Option32 } from "clipanion";
|
|
20189
20361
|
|
|
20190
20362
|
// src/lib/wire-gateway-acs.ts
|
|
20191
20363
|
init_rbac();
|
|
@@ -20225,18 +20397,18 @@ async function wireGatewayForAcs(args) {
|
|
|
20225
20397
|
init_errors();
|
|
20226
20398
|
var PlatformEnableCostReportCommand = class extends M8tCommand {
|
|
20227
20399
|
static paths = [["platform", "enable-cost-report"]];
|
|
20228
|
-
static usage =
|
|
20400
|
+
static usage = Command35.Usage({
|
|
20229
20401
|
description: "Wire the deployed gateway to send the bi-weekly cost report via ACS Email.",
|
|
20230
20402
|
details: "Discovers the live gateway Container App, grants its managed identity Contributor at the ACS resource scope (authorising the ACS Email send), and sets M8T_ACS_ENDPOINT / M8T_ACS_SENDER / M8T_ENABLE_COST_REPORTER=1 on the gateway. Idempotent \u2014 safely re-runnable. ACS is created during the executor deploy; pass its endpoint, sender, and resource id (from that deploy or 'az communication list')."
|
|
20231
20403
|
});
|
|
20232
|
-
subscription =
|
|
20233
|
-
resourceGroup =
|
|
20404
|
+
subscription = Option32.String("--subscription");
|
|
20405
|
+
resourceGroup = Option32.String("--resource-group", {
|
|
20234
20406
|
description: "m8t resource group to disambiguate the gateway (multi-deployment subscriptions)."
|
|
20235
20407
|
});
|
|
20236
|
-
acsEndpoint =
|
|
20237
|
-
acsSender =
|
|
20238
|
-
acsResourceId =
|
|
20239
|
-
output =
|
|
20408
|
+
acsEndpoint = Option32.String("--acs-endpoint", { required: true, description: "ACS data-plane endpoint, e.g. https://acs-<name>.communication.azure.com/" });
|
|
20409
|
+
acsSender = Option32.String("--acs-sender", { required: true, description: "Managed-domain sender address, e.g. DoNotReply@<guid>.azurecomm.net" });
|
|
20410
|
+
acsResourceId = Option32.String("--acs-resource-id", { required: true, description: "ARM resource id of the acs-<name> Communication Service \u2014 the role-grant scope." });
|
|
20411
|
+
output = Option32.String("--output");
|
|
20240
20412
|
async executeCommand() {
|
|
20241
20413
|
const mode = resolveOutputMode(
|
|
20242
20414
|
this.output,
|
|
@@ -20310,39 +20482,39 @@ var PlatformEnableCostReportCommand = class extends M8tCommand {
|
|
|
20310
20482
|
};
|
|
20311
20483
|
|
|
20312
20484
|
// src/commands/platform/enable-auto-update.ts
|
|
20313
|
-
import { Command as
|
|
20485
|
+
import { Command as Command36, Option as Option33 } from "clipanion";
|
|
20314
20486
|
import { confirm as confirm6 } from "@inquirer/prompts";
|
|
20315
|
-
import { DefaultAzureCredential as
|
|
20487
|
+
import { DefaultAzureCredential as DefaultAzureCredential19 } from "@azure/identity";
|
|
20316
20488
|
init_errors();
|
|
20317
20489
|
var PlatformEnableAutoUpdateCommand = class extends M8tCommand {
|
|
20318
20490
|
static paths = [["platform", "enable-auto-update"]];
|
|
20319
|
-
static usage =
|
|
20491
|
+
static usage = Command36.Usage({
|
|
20320
20492
|
category: "Platform",
|
|
20321
20493
|
description: "Retrofit the auto-updater (MI + cron job + role assignments) onto an existing install.",
|
|
20322
20494
|
details: "For an install that predates the Platform Update Framework: recovers the deployment's resource-name suffix (from the stamped system/infra-params row, or by verified derivation from the live gateway), recovers the other bicep params from live state (WITHOUT changing the deployed gateway image), and re-runs deploy/main.bicep with provisionUpdater=true \u2014 which provisions the updater managed identity, the cron Container Apps Job, and every role assignment (Owner@RG + Foundry User@account + Storage Table + Storage Blob + AcrPull), all scoped to the resource group. On success, backfills system/infra-params so future converges never have to re-derive the suffix. Idempotent \u2014 safe to re-run."
|
|
20323
20495
|
});
|
|
20324
|
-
subscription =
|
|
20325
|
-
resourceGroup =
|
|
20496
|
+
subscription = Option33.String("--subscription");
|
|
20497
|
+
resourceGroup = Option33.String("--resource-group", {
|
|
20326
20498
|
description: "m8t resource group to disambiguate the gateway (multi-deployment subscriptions)."
|
|
20327
20499
|
});
|
|
20328
|
-
suffix =
|
|
20500
|
+
suffix = Option33.String("--suffix", {
|
|
20329
20501
|
description: "The existing deployment's resource-name suffix. Required when it cannot be recovered from system/infra-params or the live gateway."
|
|
20330
20502
|
});
|
|
20331
|
-
installerImage =
|
|
20503
|
+
installerImage = Option33.String("--installer-image", {
|
|
20332
20504
|
required: true,
|
|
20333
20505
|
description: "Updater CA-Job image ref (the converge engine at the current release). Required \u2014 an empty image would skip provisioning."
|
|
20334
20506
|
});
|
|
20335
|
-
updateCron =
|
|
20507
|
+
updateCron = Option33.String("--update-cron", {
|
|
20336
20508
|
description: "Cron schedule for the updater job (bicep default applies when omitted)."
|
|
20337
20509
|
});
|
|
20338
|
-
channelUrl =
|
|
20510
|
+
channelUrl = Option33.String("--channel-url", {
|
|
20339
20511
|
description: "Release-channel URL the updater job polls (bicep default applies when omitted)."
|
|
20340
20512
|
});
|
|
20341
|
-
endpoint =
|
|
20513
|
+
endpoint = Option33.String("--endpoint", {
|
|
20342
20514
|
description: "Foundry project endpoint URL. Disambiguates the project in a multi-project subscription."
|
|
20343
20515
|
});
|
|
20344
|
-
yes =
|
|
20345
|
-
output =
|
|
20516
|
+
yes = Option33.Boolean("--yes", false);
|
|
20517
|
+
output = Option33.String("--output");
|
|
20346
20518
|
async executeCommand() {
|
|
20347
20519
|
const mode = resolveOutputMode(
|
|
20348
20520
|
this.output,
|
|
@@ -20361,7 +20533,7 @@ var PlatformEnableAutoUpdateCommand = class extends M8tCommand {
|
|
|
20361
20533
|
resourceGroup: this.resourceGroup
|
|
20362
20534
|
});
|
|
20363
20535
|
const { resourceGroup, name: gatewayName } = parseContainerAppResourceId(gw.containerAppResourceId);
|
|
20364
|
-
const credential2 = new
|
|
20536
|
+
const credential2 = new DefaultAzureCredential19();
|
|
20365
20537
|
const account = await getAzAccount();
|
|
20366
20538
|
const subscriptionId = this.subscription ?? account.subscriptionId;
|
|
20367
20539
|
const explicitSuffix = typeof this.suffix === "string" && this.suffix.length > 0 ? this.suffix : void 0;
|
|
@@ -20463,7 +20635,7 @@ var PlatformEnableAutoUpdateCommand = class extends M8tCommand {
|
|
|
20463
20635
|
};
|
|
20464
20636
|
|
|
20465
20637
|
// src/commands/deploy.ts
|
|
20466
|
-
import { Command as
|
|
20638
|
+
import { Command as Command37, Option as Option34 } from "clipanion";
|
|
20467
20639
|
|
|
20468
20640
|
// src/lib/app-reg.ts
|
|
20469
20641
|
init_errors();
|
|
@@ -20865,40 +21037,40 @@ function classifyWhatIf(changes) {
|
|
|
20865
21037
|
var DEFAULT_IMAGE_REF = "ghcr.io/m8t-labs/m8t:latest";
|
|
20866
21038
|
var DeployCommand = class extends M8tCommand {
|
|
20867
21039
|
static paths = [["deploy"]];
|
|
20868
|
-
static usage =
|
|
21040
|
+
static usage = Command37.Usage({
|
|
20869
21041
|
description: "Deploy (or update) the m8t gateway/webapp stack via Bicep.",
|
|
20870
21042
|
details: "Ensures the Entra app reg (or pass --client-id to reuse an existing one \u2014 required if you can't create app regs), writes ~/.m8t/config.yaml, ensures the resource group, and runs deploy/main.bicep. The repo is located via ~/.m8t/repo-root."
|
|
20871
21043
|
});
|
|
20872
|
-
subscription =
|
|
20873
|
-
resourceGroup =
|
|
20874
|
-
location =
|
|
20875
|
-
suffix =
|
|
20876
|
-
imageRef =
|
|
20877
|
-
acrPullIdentity =
|
|
20878
|
-
acrResourceId =
|
|
20879
|
-
foundryEndpoint =
|
|
20880
|
-
foundryResourceId =
|
|
20881
|
-
foundryTracing =
|
|
21044
|
+
subscription = Option34.String("--subscription");
|
|
21045
|
+
resourceGroup = Option34.String("--resource-group", "rg-m8t-stack");
|
|
21046
|
+
location = Option34.String("--location", "eastus");
|
|
21047
|
+
suffix = Option34.String("--suffix", "");
|
|
21048
|
+
imageRef = Option34.String("--image-ref", DEFAULT_IMAGE_REF);
|
|
21049
|
+
acrPullIdentity = Option34.String("--acrpull-identity");
|
|
21050
|
+
acrResourceId = Option34.String("--acr-resource-id");
|
|
21051
|
+
foundryEndpoint = Option34.String("--foundry-endpoint");
|
|
21052
|
+
foundryResourceId = Option34.String("--foundry-resource-id");
|
|
21053
|
+
foundryTracing = Option34.String("--foundry-tracing");
|
|
20882
21054
|
// project | account | skip (bicep default: project)
|
|
20883
|
-
clientId =
|
|
20884
|
-
whatIf =
|
|
20885
|
-
output =
|
|
20886
|
-
// Referee
|
|
21055
|
+
clientId = Option34.String("--client-id");
|
|
21056
|
+
whatIf = Option34.Boolean("--what-if", false);
|
|
21057
|
+
output = Option34.String("--output");
|
|
21058
|
+
// Referee — all optional, undefined by default ⇒ the bicep defaults
|
|
20887
21059
|
// apply (dormant: gatewayCpu=0.25, gatewayMemory=0.5Gi, every referee/exam var
|
|
20888
21060
|
// empty). Only pass these when explicitly enabling the referee exam stack.
|
|
20889
|
-
gatewayCpu =
|
|
20890
|
-
gatewayMemory =
|
|
20891
|
-
refereeEnabled =
|
|
20892
|
-
refereeBrainRepos =
|
|
20893
|
-
refereeFeedRepo =
|
|
20894
|
-
refereeInstallationId =
|
|
20895
|
-
refereeWebhookHmacKvUri =
|
|
20896
|
-
examKvUri =
|
|
20897
|
-
examLaWorkspaceId =
|
|
20898
|
-
brainEvalDeployment =
|
|
20899
|
-
brainAppLogin =
|
|
20900
|
-
refereeCheckpointDir =
|
|
20901
|
-
examApiBase =
|
|
21061
|
+
gatewayCpu = Option34.String("--gateway-cpu");
|
|
21062
|
+
gatewayMemory = Option34.String("--gateway-memory");
|
|
21063
|
+
refereeEnabled = Option34.String("--referee-enabled");
|
|
21064
|
+
refereeBrainRepos = Option34.String("--referee-brain-repos");
|
|
21065
|
+
refereeFeedRepo = Option34.String("--referee-feed-repo");
|
|
21066
|
+
refereeInstallationId = Option34.String("--referee-installation-id");
|
|
21067
|
+
refereeWebhookHmacKvUri = Option34.String("--referee-webhook-hmac-kv-uri");
|
|
21068
|
+
examKvUri = Option34.String("--exam-kv-uri");
|
|
21069
|
+
examLaWorkspaceId = Option34.String("--exam-la-workspace-id");
|
|
21070
|
+
brainEvalDeployment = Option34.String("--brain-eval-deployment");
|
|
21071
|
+
brainAppLogin = Option34.String("--brain-app-login");
|
|
21072
|
+
refereeCheckpointDir = Option34.String("--referee-checkpoint-dir");
|
|
21073
|
+
examApiBase = Option34.String("--exam-api-base");
|
|
20902
21074
|
async executeCommand() {
|
|
20903
21075
|
const mode = resolveOutputMode(
|
|
20904
21076
|
this.output,
|
|
@@ -21038,7 +21210,7 @@ var DeployCommand = class extends M8tCommand {
|
|
|
21038
21210
|
|
|
21039
21211
|
// src/commands/eval/skill.ts
|
|
21040
21212
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
21041
|
-
import { Command as
|
|
21213
|
+
import { Command as Command38, Option as Option35 } from "clipanion";
|
|
21042
21214
|
init_errors();
|
|
21043
21215
|
var DECISIONS = /* @__PURE__ */ new Set(["promote", "reject", "needs_review"]);
|
|
21044
21216
|
var JUDGE_STATUSES = /* @__PURE__ */ new Set(["ok", "skipped", "unavailable"]);
|
|
@@ -21063,14 +21235,14 @@ function parseVerdict(stdout) {
|
|
|
21063
21235
|
}
|
|
21064
21236
|
var EvalSkillCommand = class extends M8tCommand {
|
|
21065
21237
|
static paths = [["eval", "skill"]];
|
|
21066
|
-
static usage =
|
|
21238
|
+
static usage = Command38.Usage({
|
|
21067
21239
|
description: "Vet one inbox skill candidate (Brain Faculties Eval F1): promote / reject / needs_review. Shells out to the Python `brain-eval` core (override its path with $BRAIN_EVAL_BIN)."
|
|
21068
21240
|
});
|
|
21069
|
-
candidate =
|
|
21070
|
-
skillsDir =
|
|
21071
|
-
noJudge =
|
|
21072
|
-
deployment =
|
|
21073
|
-
output =
|
|
21241
|
+
candidate = Option35.String();
|
|
21242
|
+
skillsDir = Option35.String("--skills-dir");
|
|
21243
|
+
noJudge = Option35.Boolean("--no-judge", false);
|
|
21244
|
+
deployment = Option35.String("--deployment");
|
|
21245
|
+
output = Option35.String("--output");
|
|
21074
21246
|
executeCommand() {
|
|
21075
21247
|
return Promise.resolve(this._runCommand());
|
|
21076
21248
|
}
|
|
@@ -21127,9 +21299,9 @@ var EvalSkillCommand = class extends M8tCommand {
|
|
|
21127
21299
|
|
|
21128
21300
|
// src/commands/eval/exam.ts
|
|
21129
21301
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
21130
|
-
import { writeFileSync as writeFileSync6, mkdirSync as mkdirSync5, readFileSync as
|
|
21302
|
+
import { writeFileSync as writeFileSync6, mkdirSync as mkdirSync5, readFileSync as readFileSync18, existsSync as existsSync15, readdirSync as readdirSync2 } from "fs";
|
|
21131
21303
|
import { join as join27 } from "path";
|
|
21132
|
-
import { Command as
|
|
21304
|
+
import { Command as Command39, Option as Option36 } from "clipanion";
|
|
21133
21305
|
init_errors();
|
|
21134
21306
|
init_esm();
|
|
21135
21307
|
function parseArmToken(tok, opts) {
|
|
@@ -21332,7 +21504,7 @@ function readSealedTaskIds(taskSetVersion, refereeHomeOut, env = process.env) {
|
|
|
21332
21504
|
const manifestPath = join27(home, "tasksets", worker, versionDir, "manifest.yaml");
|
|
21333
21505
|
let text;
|
|
21334
21506
|
try {
|
|
21335
|
-
text =
|
|
21507
|
+
text = readFileSync18(manifestPath, "utf-8");
|
|
21336
21508
|
} catch (e) {
|
|
21337
21509
|
throw new LocalCliError({
|
|
21338
21510
|
code: "EXAM_REDACTION_UNSAFE",
|
|
@@ -21359,24 +21531,24 @@ function buildPlan(args) {
|
|
|
21359
21531
|
}
|
|
21360
21532
|
var EvalExamCommand = class extends M8tCommand {
|
|
21361
21533
|
static paths = [["eval", "exam"]];
|
|
21362
|
-
static usage =
|
|
21534
|
+
static usage = Command39.Usage({
|
|
21363
21535
|
description: "Run a brain exam (Brain Referee E2-F2): impact A/B + dream-delta. Resolves the plan, then shells out to the Python `brain-exam` orchestrator (override its path with $BRAIN_EXAM_BIN). Renders an ExamVerdict: three-valued verdict + power note + per-task flips."
|
|
21364
21536
|
});
|
|
21365
|
-
worker =
|
|
21366
|
-
arms =
|
|
21367
|
-
taskSet =
|
|
21368
|
-
examType =
|
|
21369
|
-
skill =
|
|
21370
|
-
reps =
|
|
21371
|
-
probes =
|
|
21372
|
-
pool =
|
|
21373
|
-
out =
|
|
21374
|
-
dryRun =
|
|
21375
|
-
keepArms =
|
|
21376
|
-
allowStub =
|
|
21377
|
-
deployment =
|
|
21378
|
-
output =
|
|
21379
|
-
observeWaitS =
|
|
21537
|
+
worker = Option36.String();
|
|
21538
|
+
arms = Option36.String("--arms");
|
|
21539
|
+
taskSet = Option36.String("--task-set");
|
|
21540
|
+
examType = Option36.String("--exam-type");
|
|
21541
|
+
skill = Option36.String("--skill");
|
|
21542
|
+
reps = Option36.String("-n,--reps");
|
|
21543
|
+
probes = Option36.String("--probes");
|
|
21544
|
+
pool = Option36.String("--pool");
|
|
21545
|
+
out = Option36.String("--out");
|
|
21546
|
+
dryRun = Option36.Boolean("--dry-run", false);
|
|
21547
|
+
keepArms = Option36.Boolean("--keep-arms", false);
|
|
21548
|
+
allowStub = Option36.Boolean("--allow-stub", false);
|
|
21549
|
+
deployment = Option36.String("--deployment");
|
|
21550
|
+
output = Option36.String("--output");
|
|
21551
|
+
observeWaitS = Option36.String("--observe-wait-s");
|
|
21380
21552
|
async executeCommand() {
|
|
21381
21553
|
await Promise.resolve();
|
|
21382
21554
|
const worker = typeof this.worker === "string" ? this.worker : void 0;
|
|
@@ -21491,10 +21663,10 @@ var EvalExamCommand = class extends M8tCommand {
|
|
|
21491
21663
|
};
|
|
21492
21664
|
|
|
21493
21665
|
// src/commands/version.ts
|
|
21494
|
-
import { Command as
|
|
21666
|
+
import { Command as Command40, Option as Option37 } from "clipanion";
|
|
21495
21667
|
var VersionCommand = class extends M8tCommand {
|
|
21496
21668
|
static paths = [["version"], ["--version"], ["-v"]];
|
|
21497
|
-
static usage =
|
|
21669
|
+
static usage = Command40.Usage({
|
|
21498
21670
|
description: "Print the CLI version.",
|
|
21499
21671
|
details: "Prints the m8t CLI version. With --verbose, also prints Node version and platform.",
|
|
21500
21672
|
examples: [
|
|
@@ -21502,8 +21674,8 @@ var VersionCommand = class extends M8tCommand {
|
|
|
21502
21674
|
["Print as JSON", "$0 version --output json"]
|
|
21503
21675
|
]
|
|
21504
21676
|
});
|
|
21505
|
-
output =
|
|
21506
|
-
verbose =
|
|
21677
|
+
output = Option37.String("--output", { description: "pretty | json | auto (default)" });
|
|
21678
|
+
verbose = Option37.Boolean("--verbose", false);
|
|
21507
21679
|
executeCommand() {
|
|
21508
21680
|
const mode = resolveOutputMode(
|
|
21509
21681
|
this.output ?? "auto",
|
|
@@ -21534,18 +21706,18 @@ var VersionCommand = class extends M8tCommand {
|
|
|
21534
21706
|
};
|
|
21535
21707
|
|
|
21536
21708
|
// src/commands/whoami.ts
|
|
21537
|
-
import { Command as
|
|
21709
|
+
import { Command as Command41, Option as Option38 } from "clipanion";
|
|
21538
21710
|
var WhoamiCommand = class extends M8tCommand {
|
|
21539
21711
|
static paths = [["whoami"]];
|
|
21540
|
-
static usage =
|
|
21712
|
+
static usage = Command41.Usage({
|
|
21541
21713
|
description: "Show your identity + the gateway you'll talk to. Probes the backend."
|
|
21542
21714
|
});
|
|
21543
|
-
output =
|
|
21544
|
-
verbose =
|
|
21545
|
-
subscription =
|
|
21715
|
+
output = Option38.String("--output");
|
|
21716
|
+
verbose = Option38.Boolean("--verbose", false);
|
|
21717
|
+
subscription = Option38.String("--subscription", {
|
|
21546
21718
|
description: "Azure subscription ID to discover gateway in (defaults to active az subscription)."
|
|
21547
21719
|
});
|
|
21548
|
-
resourceGroup =
|
|
21720
|
+
resourceGroup = Option38.String("--resource-group", {
|
|
21549
21721
|
description: "m8t resource group to disambiguate the gateway (multi-deployment subscriptions)."
|
|
21550
21722
|
});
|
|
21551
21723
|
async executeCommand() {
|
|
@@ -21610,7 +21782,7 @@ var WhoamiCommand = class extends M8tCommand {
|
|
|
21610
21782
|
};
|
|
21611
21783
|
|
|
21612
21784
|
// src/commands/status.ts
|
|
21613
|
-
import { Command as
|
|
21785
|
+
import { Command as Command42, Option as Option39 } from "clipanion";
|
|
21614
21786
|
|
|
21615
21787
|
// src/lib/azd.ts
|
|
21616
21788
|
init_errors();
|
|
@@ -21675,10 +21847,10 @@ async function resolveLocalContext() {
|
|
|
21675
21847
|
// src/commands/status.ts
|
|
21676
21848
|
var StatusCommand = class extends M8tCommand {
|
|
21677
21849
|
static paths = [["status"]];
|
|
21678
|
-
static usage =
|
|
21850
|
+
static usage = Command42.Usage({
|
|
21679
21851
|
description: "Show the local m8t context: identity, config.yaml, gateway cache, azd mode."
|
|
21680
21852
|
});
|
|
21681
|
-
output =
|
|
21853
|
+
output = Option39.String("--output");
|
|
21682
21854
|
async executeCommand() {
|
|
21683
21855
|
const mode = resolveOutputMode(
|
|
21684
21856
|
this.output,
|
|
@@ -21716,8 +21888,8 @@ var StatusCommand = class extends M8tCommand {
|
|
|
21716
21888
|
};
|
|
21717
21889
|
|
|
21718
21890
|
// src/commands/doctor.ts
|
|
21719
|
-
import { Command as
|
|
21720
|
-
import { DefaultAzureCredential as
|
|
21891
|
+
import { Command as Command43, Option as Option40 } from "clipanion";
|
|
21892
|
+
import { DefaultAzureCredential as DefaultAzureCredential20 } from "@azure/identity";
|
|
21721
21893
|
import * as fs26 from "fs";
|
|
21722
21894
|
import * as os11 from "os";
|
|
21723
21895
|
import * as path28 from "path";
|
|
@@ -21992,12 +22164,12 @@ function probeLegacyStateDir() {
|
|
|
21992
22164
|
}
|
|
21993
22165
|
var DoctorCommand = class extends M8tCommand {
|
|
21994
22166
|
static paths = [["doctor"]];
|
|
21995
|
-
static usage =
|
|
22167
|
+
static usage = Command43.Usage({
|
|
21996
22168
|
description: "Diagnose the local m8t setup: az login, config.yaml, gateway, Foundry data-plane."
|
|
21997
22169
|
});
|
|
21998
|
-
output =
|
|
21999
|
-
agent =
|
|
22000
|
-
resourceGroup =
|
|
22170
|
+
output = Option40.String("--output");
|
|
22171
|
+
agent = Option40.String("--agent");
|
|
22172
|
+
resourceGroup = Option40.String("--resource-group", {
|
|
22001
22173
|
description: "m8t resource group to disambiguate the gateway (multi-deployment subscriptions)."
|
|
22002
22174
|
});
|
|
22003
22175
|
async executeCommand() {
|
|
@@ -22071,7 +22243,7 @@ var DoctorCommand = class extends M8tCommand {
|
|
|
22071
22243
|
if (typeof this.agent === "string" && this.agent) {
|
|
22072
22244
|
checking(`delivery grant for ${this.agent}`);
|
|
22073
22245
|
try {
|
|
22074
|
-
const credential2 = new
|
|
22246
|
+
const credential2 = new DefaultAzureCredential20();
|
|
22075
22247
|
const cur = await getAgentVersion({
|
|
22076
22248
|
credential: credential2,
|
|
22077
22249
|
projectEndpoint: foundry.projectEndpoint,
|
|
@@ -22114,7 +22286,7 @@ var DoctorCommand = class extends M8tCommand {
|
|
|
22114
22286
|
};
|
|
22115
22287
|
|
|
22116
22288
|
// src/commands/switch.ts
|
|
22117
|
-
import { Command as
|
|
22289
|
+
import { Command as Command44, Option as Option41 } from "clipanion";
|
|
22118
22290
|
|
|
22119
22291
|
// src/lib/profiles.ts
|
|
22120
22292
|
import * as fs27 from "fs/promises";
|
|
@@ -22254,14 +22426,14 @@ async function profileSwitch(name, asName) {
|
|
|
22254
22426
|
init_errors();
|
|
22255
22427
|
var SwitchCommand = class extends M8tCommand {
|
|
22256
22428
|
static paths = [["switch"]];
|
|
22257
|
-
static usage =
|
|
22429
|
+
static usage = Command44.Usage({
|
|
22258
22430
|
description: "Re-point local config at another deployment: --subscription <id|name> (discovery) or <profile>."
|
|
22259
22431
|
});
|
|
22260
|
-
profile =
|
|
22261
|
-
subscription =
|
|
22262
|
-
list =
|
|
22263
|
-
as =
|
|
22264
|
-
output =
|
|
22432
|
+
profile = Option41.String({ required: false });
|
|
22433
|
+
subscription = Option41.String("--subscription");
|
|
22434
|
+
list = Option41.Boolean("--list", false);
|
|
22435
|
+
as = Option41.String("--as");
|
|
22436
|
+
output = Option41.String("--output");
|
|
22265
22437
|
async executeCommand() {
|
|
22266
22438
|
const mode = resolveOutputMode(
|
|
22267
22439
|
this.output,
|
|
@@ -22318,7 +22490,7 @@ var SwitchCommand = class extends M8tCommand {
|
|
|
22318
22490
|
|
|
22319
22491
|
// src/commands/open.ts
|
|
22320
22492
|
import { spawn as spawn5 } from "child_process";
|
|
22321
|
-
import { Command as
|
|
22493
|
+
import { Command as Command45, Option as Option42 } from "clipanion";
|
|
22322
22494
|
|
|
22323
22495
|
// src/lib/open-targets.ts
|
|
22324
22496
|
init_errors();
|
|
@@ -22364,14 +22536,14 @@ function openUrl(url) {
|
|
|
22364
22536
|
}
|
|
22365
22537
|
var OpenCommand = class extends M8tCommand {
|
|
22366
22538
|
static paths = [["open"]];
|
|
22367
|
-
static usage =
|
|
22539
|
+
static usage = Command45.Usage({
|
|
22368
22540
|
description: "Open the deployed webapp (default), the Foundry portal, or the resource group.",
|
|
22369
22541
|
details: "Targets: webapp (deployed app, default) | foundry (ai.azure.com) | portal (resource group in the Azure portal). Pass --print to emit the URL instead of launching a browser (also the default when stdout isn't a TTY)."
|
|
22370
22542
|
});
|
|
22371
|
-
target =
|
|
22372
|
-
print =
|
|
22373
|
-
output =
|
|
22374
|
-
resourceGroup =
|
|
22543
|
+
target = Option42.String({ required: false });
|
|
22544
|
+
print = Option42.Boolean("--print", false);
|
|
22545
|
+
output = Option42.String("--output");
|
|
22546
|
+
resourceGroup = Option42.String("--resource-group", {
|
|
22375
22547
|
description: "m8t resource group to disambiguate the gateway (multi-deployment subscriptions)."
|
|
22376
22548
|
});
|
|
22377
22549
|
async executeCommand() {
|
|
@@ -22415,7 +22587,7 @@ var OpenCommand = class extends M8tCommand {
|
|
|
22415
22587
|
};
|
|
22416
22588
|
|
|
22417
22589
|
// src/commands/dream/run.ts
|
|
22418
|
-
import { Command as
|
|
22590
|
+
import { Command as Command46, Option as Option43 } from "clipanion";
|
|
22419
22591
|
import { AzureCliCredential } from "@azure/identity";
|
|
22420
22592
|
import { TableClient as TableClient5 } from "@azure/data-tables";
|
|
22421
22593
|
import { AIProjectClient as AIProjectClient3 } from "@azure/ai-projects";
|
|
@@ -22760,7 +22932,7 @@ var TableCursor = class {
|
|
|
22760
22932
|
* Point-read the canonical worker's cursor row. Catches BOTH the
|
|
22761
22933
|
* missing-table (TableNotFound) and missing-row (ResourceNotFound) 404s and
|
|
22762
22934
|
* returns an absent (from-the-beginning) cursor WITHOUT creating the table or
|
|
22763
|
-
* writing anything
|
|
22935
|
+
* writing anything.
|
|
22764
22936
|
* Any other error (e.g. 403 RBAC) propagates raw.
|
|
22765
22937
|
*/
|
|
22766
22938
|
async read(worker) {
|
|
@@ -22786,9 +22958,9 @@ var TableCursor = class {
|
|
|
22786
22958
|
}
|
|
22787
22959
|
/**
|
|
22788
22960
|
* Persist the cursor for the canonical worker. This is the ONLY place that
|
|
22789
|
-
* creates the BrainDreamCursor table
|
|
22790
|
-
* TableAlreadyExists race is benign. The non-dry
|
|
22791
|
-
*
|
|
22961
|
+
* creates the BrainDreamCursor table; a
|
|
22962
|
+
* TableAlreadyExists race is benign. The non-dry path calls this, already
|
|
22963
|
+
* wired and unit-tested. The per-PK watermark map is serialized to JSON
|
|
22792
22964
|
* (Table cells are scalar — same rationale as agent-ledger's `artifacts`).
|
|
22793
22965
|
*/
|
|
22794
22966
|
async advance(worker, cursor) {
|
|
@@ -22921,6 +23093,35 @@ function makeLedgerSource(read) {
|
|
|
22921
23093
|
// ../../packages/brain/engine/dist/esm/conversation-source.js
|
|
22922
23094
|
var TRANSIENT = 500;
|
|
22923
23095
|
var MAX_ATTEMPTS = 5;
|
|
23096
|
+
var VOICE_PREFIX = "[[m8t:voice-transcript]] ";
|
|
23097
|
+
var MAX_VOICE_HEADER_BYTES = 4096;
|
|
23098
|
+
function isVoiceEnvelope(value) {
|
|
23099
|
+
if (typeof value !== "object" || value === null)
|
|
23100
|
+
return false;
|
|
23101
|
+
const item = value;
|
|
23102
|
+
return item.v === 1 && typeof item.callId === "string" && item.callId.length > 0 && typeof item.startedAt === "string" && item.startedAt.length > 0 && typeof item.endedAt === "string" && item.endedAt.length > 0 && typeof item.turnAt === "string" && item.turnAt.length > 0;
|
|
23103
|
+
}
|
|
23104
|
+
function stripVoiceEnvelope(value) {
|
|
23105
|
+
if (!value.startsWith(VOICE_PREFIX))
|
|
23106
|
+
return value;
|
|
23107
|
+
const newline = value.indexOf("\n");
|
|
23108
|
+
if (newline < VOICE_PREFIX.length)
|
|
23109
|
+
return value;
|
|
23110
|
+
const header = value.slice(VOICE_PREFIX.length, newline);
|
|
23111
|
+
if (new TextEncoder().encode(header).byteLength > MAX_VOICE_HEADER_BYTES || header.length % 4 === 1 || !/^[A-Za-z0-9_-]+$/.test(header))
|
|
23112
|
+
return value;
|
|
23113
|
+
try {
|
|
23114
|
+
const padded = header.replaceAll("-", "+").replaceAll("_", "/") + "=".repeat((4 - header.length % 4) % 4);
|
|
23115
|
+
const bytes = Uint8Array.from(Buffer.from(padded, "base64"));
|
|
23116
|
+
if (Buffer.from(bytes).toString("base64url") !== header)
|
|
23117
|
+
return value;
|
|
23118
|
+
const json = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
23119
|
+
const parsed = JSON.parse(json);
|
|
23120
|
+
return isVoiceEnvelope(parsed) ? value.slice(newline + 1) : value;
|
|
23121
|
+
} catch {
|
|
23122
|
+
return value;
|
|
23123
|
+
}
|
|
23124
|
+
}
|
|
22924
23125
|
function statusOf(e) {
|
|
22925
23126
|
const err = e;
|
|
22926
23127
|
return err?.statusCode ?? err?.status;
|
|
@@ -22936,7 +23137,7 @@ function mapItems(raw) {
|
|
|
22936
23137
|
continue;
|
|
22937
23138
|
if (item.role !== "user" && item.role !== "assistant")
|
|
22938
23139
|
continue;
|
|
22939
|
-
const text = Array.isArray(item.content) ? item.content.map((c) => typeof c.text === "string" ? c.text : "").filter(Boolean).join("\n\n") : "";
|
|
23140
|
+
const text = Array.isArray(item.content) ? stripVoiceEnvelope(item.content.map((c) => typeof c.text === "string" && c.text.length > 0 ? c.text : typeof c.transcript === "string" && c.transcript.length > 0 ? c.transcript : "").filter(Boolean).join("\n\n")) : "";
|
|
22940
23141
|
const at = typeof item.created_at === "number" ? new Date(item.created_at * 1e3).toISOString() : void 0;
|
|
22941
23142
|
acc.push(at ? { role: item.role, text, at } : { role: item.role, text });
|
|
22942
23143
|
}
|
|
@@ -22970,7 +23171,7 @@ function makeConversationSource(client, opts = {}) {
|
|
|
22970
23171
|
throw new ConvFetchError("terminal", `exhausted retries reading ${conversationId}`);
|
|
22971
23172
|
},
|
|
22972
23173
|
/**
|
|
22973
|
-
* The a2a recovery gate's data source (
|
|
23174
|
+
* The a2a recovery gate's data source (Option A). Reads the
|
|
22974
23175
|
* conversation's own `metadata.app` so the recovery path can HARD-gate on the
|
|
22975
23176
|
* real app tag rather than emit-time ledger tagging. Degrades to null on any
|
|
22976
23177
|
* error → the caller treats an un-provable a2a conv as ungated (skipped).
|
|
@@ -23254,7 +23455,7 @@ async function runPipeline(args) {
|
|
|
23254
23455
|
consumed,
|
|
23255
23456
|
recovered,
|
|
23256
23457
|
skipped,
|
|
23257
|
-
// Wall-clock elapsed around the awaited live I/O
|
|
23458
|
+
// Wall-clock elapsed around the awaited live I/O — measured from the
|
|
23258
23459
|
// real/injected monotonic clock, NOT the pure `now` (which never moves within a run).
|
|
23259
23460
|
latencyMs: Math.round(monotonicNow() - t0)
|
|
23260
23461
|
};
|
|
@@ -23375,11 +23576,11 @@ var WRITER_ALLOWED_PREFIX = /^(memory|inbox|quarantine|artifacts)\//;
|
|
|
23375
23576
|
var isAllowedWritePath = (path37, allowedPrefix) => allowedPrefix.test(path37) && !path37.split("/").includes("..");
|
|
23376
23577
|
var unquote = (s) => s.trim().replace(/^["']|["']$/g, "");
|
|
23377
23578
|
function parseFrontmatter(content) {
|
|
23378
|
-
const m = /^---\n([\s\S]*?)\n---/.exec(content);
|
|
23579
|
+
const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(content);
|
|
23379
23580
|
if (!m)
|
|
23380
23581
|
return {};
|
|
23381
23582
|
const fm = {};
|
|
23382
|
-
const lines = m[1].split(
|
|
23583
|
+
const lines = m[1].split(/\r?\n/);
|
|
23383
23584
|
let pendingKey = null;
|
|
23384
23585
|
for (const line2 of lines) {
|
|
23385
23586
|
const item = /^\s+-\s+(.*)$/.exec(line2);
|
|
@@ -24057,7 +24258,7 @@ function frontmatter(fields) {
|
|
|
24057
24258
|
return lines.join("\n");
|
|
24058
24259
|
}
|
|
24059
24260
|
function injectFrontmatter(body, fields) {
|
|
24060
|
-
const m = /^---\n([\s\S]*?)\n---\n?/.exec(body);
|
|
24261
|
+
const m = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(body);
|
|
24061
24262
|
const inject = Object.entries(fields).map(([k, v]) => Array.isArray(v) ? `${k}:
|
|
24062
24263
|
${v.map((i) => ` - ${i}`).join("\n")}` : `${k}: ${v}`).join("\n");
|
|
24063
24264
|
if (!m)
|
|
@@ -24066,11 +24267,11 @@ ${inject}
|
|
|
24066
24267
|
---
|
|
24067
24268
|
${body}`;
|
|
24068
24269
|
const block = m[1].replace(/\s*$/, "");
|
|
24069
|
-
return
|
|
24270
|
+
return `---
|
|
24070
24271
|
${block}
|
|
24071
24272
|
${inject}
|
|
24072
24273
|
---
|
|
24073
|
-
`);
|
|
24274
|
+
` + body.slice(m[0].length);
|
|
24074
24275
|
}
|
|
24075
24276
|
var indexLine = (path37, title, date, tags) => `- \`${path37}\` \u2014 **${title}**: ${title}. (${date} \xB7 ${tags.join(", ")})`;
|
|
24076
24277
|
function splitIndex(index) {
|
|
@@ -24230,7 +24431,7 @@ function defaultDreamSeams(opts = {}) {
|
|
|
24230
24431
|
const user = buildUserPrompt(input, mem.files);
|
|
24231
24432
|
const res = await propose(deps.model, system, user, {
|
|
24232
24433
|
...opts.sleep ? { sleep: opts.sleep } : {},
|
|
24233
|
-
// The configured model NAME for the cost digest
|
|
24434
|
+
// The configured model NAME for the cost digest. Without
|
|
24234
24435
|
// this, propose falls back to its default and every cost line mis-reports
|
|
24235
24436
|
// the model an operator actually configured (e.g. gpt-5-mini → "gpt-5.4").
|
|
24236
24437
|
...deps.modelName ? { model: deps.modelName } : {}
|
|
@@ -24613,20 +24814,20 @@ function redactTranscripts(input) {
|
|
|
24613
24814
|
}
|
|
24614
24815
|
var DreamRunCommand = class extends M8tCommand {
|
|
24615
24816
|
static paths = [["dream", "run"]];
|
|
24616
|
-
static usage =
|
|
24817
|
+
static usage = Command46.Usage({
|
|
24617
24818
|
description: "Dry-run the brain consumption pipeline for one worker (no model call, no writes).",
|
|
24618
24819
|
details: "Builds AzureCliCredential + resolves the Foundry project, ledger table, and Log Analytics workspace, runs the consumption pipeline, and prints the skip-ledger, the partition invariant, and harvest stats. Transcripts are metadata-only unless --show-transcripts is passed."
|
|
24619
24820
|
});
|
|
24620
|
-
worker =
|
|
24621
|
-
dryRun =
|
|
24622
|
-
since =
|
|
24623
|
-
reset =
|
|
24624
|
-
showTranscripts =
|
|
24821
|
+
worker = Option43.String("--worker", { description: "Worker (canonical name) to harvest. Required." });
|
|
24822
|
+
dryRun = Option43.Boolean("--dry-run", false, { description: "Read-only harvest; no model call, no writes." });
|
|
24823
|
+
since = Option43.String("--since", { description: "ISO-8601 start override (rejected if malformed or future)." });
|
|
24824
|
+
reset = Option43.Boolean("--reset", false, { description: "Ignore the stored cursor; read from the beginning." });
|
|
24825
|
+
showTranscripts = Option43.Boolean("--show-transcripts", false, {
|
|
24625
24826
|
description: "Print transcript bodies (default: metadata only)."
|
|
24626
24827
|
});
|
|
24627
|
-
subscription =
|
|
24628
|
-
endpoint =
|
|
24629
|
-
output =
|
|
24828
|
+
subscription = Option43.String("--subscription");
|
|
24829
|
+
endpoint = Option43.String("--endpoint");
|
|
24830
|
+
output = Option43.String("--output");
|
|
24630
24831
|
// Resolution seam — overridden by tests; built lazily at runtime otherwise.
|
|
24631
24832
|
deps;
|
|
24632
24833
|
async executeCommand() {
|
|
@@ -24882,7 +25083,7 @@ async function buildWriteDeps(context, credential2, cursor) {
|
|
|
24882
25083
|
return {
|
|
24883
25084
|
model: makeFoundryModelClient(openai, model),
|
|
24884
25085
|
modelName: model,
|
|
24885
|
-
// surface the resolved name for the cost digest
|
|
25086
|
+
// surface the resolved name for the cost digest
|
|
24886
25087
|
brain,
|
|
24887
25088
|
cursor,
|
|
24888
25089
|
clock: () => /* @__PURE__ */ new Date(),
|
|
@@ -24974,7 +25175,7 @@ function defaultDeps(overrides) {
|
|
|
24974
25175
|
}
|
|
24975
25176
|
|
|
24976
25177
|
// src/commands/foundry/create.ts
|
|
24977
|
-
import { Command as
|
|
25178
|
+
import { Command as Command47, Option as Option44 } from "clipanion";
|
|
24978
25179
|
|
|
24979
25180
|
// src/lib/foundry-create.ts
|
|
24980
25181
|
init_errors();
|
|
@@ -25212,7 +25413,7 @@ async function createFoundryProject(args) {
|
|
|
25212
25413
|
init_errors();
|
|
25213
25414
|
var FoundryCreateCommand = class extends M8tCommand {
|
|
25214
25415
|
static paths = [["foundry", "create"]];
|
|
25215
|
-
static usage =
|
|
25416
|
+
static usage = Command47.Usage({
|
|
25216
25417
|
description: "Create an AI Foundry (AIServices) account + project + model deployment from scratch.",
|
|
25217
25418
|
details: "Non-interactive and idempotent. Creates the AIServices account (custom subdomain + project management), a project, and a model deployment (default gpt-4.1-mini @ capacity 50). Region must be hosted-agent-eligible. Emits the project endpoint as structured output. Re-run is a clean no-op (account/project skipped if present; deployment capacity converges UP, never down).",
|
|
25218
25419
|
examples: [
|
|
@@ -25221,16 +25422,16 @@ var FoundryCreateCommand = class extends M8tCommand {
|
|
|
25221
25422
|
["Higher capacity for a reasoning model", "$0 foundry create --resource-group rg-m8t-stack --location eastus2 --model gpt-5-mini --capacity 250"]
|
|
25222
25423
|
]
|
|
25223
25424
|
});
|
|
25224
|
-
resourceGroup =
|
|
25225
|
-
location =
|
|
25226
|
-
account =
|
|
25227
|
-
project =
|
|
25228
|
-
model =
|
|
25229
|
-
modelVersion =
|
|
25230
|
-
capacity =
|
|
25231
|
-
subscription =
|
|
25232
|
-
skipQuotaCheck =
|
|
25233
|
-
output =
|
|
25425
|
+
resourceGroup = Option44.String("--resource-group");
|
|
25426
|
+
location = Option44.String("--location");
|
|
25427
|
+
account = Option44.String("--account");
|
|
25428
|
+
project = Option44.String("--project", "m8t");
|
|
25429
|
+
model = Option44.String("--model", "gpt-4.1-mini");
|
|
25430
|
+
modelVersion = Option44.String("--model-version", "2025-04-14");
|
|
25431
|
+
capacity = Option44.String("--capacity", "50");
|
|
25432
|
+
subscription = Option44.String("--subscription");
|
|
25433
|
+
skipQuotaCheck = Option44.Boolean("--skip-quota-check", false);
|
|
25434
|
+
output = Option44.String("--output");
|
|
25234
25435
|
async executeCommand() {
|
|
25235
25436
|
const mode = resolveOutputMode(
|
|
25236
25437
|
this.output,
|
|
@@ -25302,22 +25503,22 @@ var FoundryCreateCommand = class extends M8tCommand {
|
|
|
25302
25503
|
};
|
|
25303
25504
|
|
|
25304
25505
|
// src/commands/foundry/await-ready.ts
|
|
25305
|
-
import { Command as
|
|
25506
|
+
import { Command as Command48, Option as Option45 } from "clipanion";
|
|
25306
25507
|
import { AzureCliCredential as AzureCliCredential2 } from "@azure/identity";
|
|
25307
25508
|
init_errors();
|
|
25308
25509
|
var FoundryAwaitReadyCommand = class extends M8tCommand {
|
|
25309
25510
|
static paths = [["foundry", "await-ready"]];
|
|
25310
|
-
static usage =
|
|
25511
|
+
static usage = Command48.Usage({
|
|
25311
25512
|
description: "Wait until a freshly-created Foundry project's data plane reliably serves it.",
|
|
25312
25513
|
details: "Probes the project (GET /agents) until it returns 200 on a few consecutive tries, or fails clearly after a bounded budget. A newly-created account can serve intermittent 404 'Project not found' for minutes; run this after 'foundry create' and before deploying agents so the worker phase doesn't catch the unstable window.",
|
|
25313
25514
|
examples: [["Wait for a project to be ready", "$0 foundry await-ready --endpoint https://acc.services.ai.azure.com/api/projects/m8t"]]
|
|
25314
25515
|
});
|
|
25315
|
-
endpoint =
|
|
25316
|
-
consecutive =
|
|
25317
|
-
attempts =
|
|
25318
|
-
interval =
|
|
25319
|
-
subscription =
|
|
25320
|
-
output =
|
|
25516
|
+
endpoint = Option45.String("--endpoint");
|
|
25517
|
+
consecutive = Option45.String("--consecutive", "3");
|
|
25518
|
+
attempts = Option45.String("--attempts", "60");
|
|
25519
|
+
interval = Option45.String("--interval", "5");
|
|
25520
|
+
subscription = Option45.String("--subscription");
|
|
25521
|
+
output = Option45.String("--output");
|
|
25321
25522
|
async executeCommand() {
|
|
25322
25523
|
const mode = resolveOutputMode(this.output, this.context.stdout);
|
|
25323
25524
|
const endpoint = typeof this.endpoint === "string" ? this.endpoint : void 0;
|
|
@@ -25351,7 +25552,7 @@ var FoundryAwaitReadyCommand = class extends M8tCommand {
|
|
|
25351
25552
|
};
|
|
25352
25553
|
|
|
25353
25554
|
// src/commands/bootstrap/preflight.ts
|
|
25354
|
-
import { Command as
|
|
25555
|
+
import { Command as Command49, Option as Option46 } from "clipanion";
|
|
25355
25556
|
|
|
25356
25557
|
// ../../packages/telemetry-contract/artifact/tier-map.ts
|
|
25357
25558
|
var EVENT_TIERS = {
|
|
@@ -25451,7 +25652,7 @@ function buildPreflightBanner(who) {
|
|
|
25451
25652
|
// src/commands/bootstrap/preflight.ts
|
|
25452
25653
|
var BootstrapPreflightCommand = class extends M8tCommand {
|
|
25453
25654
|
static paths = [["bootstrap", "preflight"]];
|
|
25454
|
-
static usage =
|
|
25655
|
+
static usage = Command49.Usage({
|
|
25455
25656
|
description: "Loudly verify you can install m8t (Owner/UAA + directory admin) and hard-stop if not.",
|
|
25456
25657
|
details: "Step 1 of `m8t bootstrap`. Prints an unmissable admin-credentials notice, then checks: Owner or User Access Administrator at subscription scope (hard requirement), directory-admin capability to register the app (or pass --client-id), and registers Microsoft.ContainerInstance. Exits non-zero with the exact failing check + remedy.",
|
|
25457
25658
|
examples: [
|
|
@@ -25459,8 +25660,8 @@ var BootstrapPreflightCommand = class extends M8tCommand {
|
|
|
25459
25660
|
["BYO app registration (directory guests)", "$0 bootstrap preflight --client-id <appId>"]
|
|
25460
25661
|
]
|
|
25461
25662
|
});
|
|
25462
|
-
clientId =
|
|
25463
|
-
subscription =
|
|
25663
|
+
clientId = Option46.String("--client-id");
|
|
25664
|
+
subscription = Option46.String("--subscription");
|
|
25464
25665
|
async executeCommand() {
|
|
25465
25666
|
const clientId = typeof this.clientId === "string" ? this.clientId : void 0;
|
|
25466
25667
|
const account = await getAzAccount();
|
|
@@ -25522,7 +25723,7 @@ ${colors.error(" " + why)}
|
|
|
25522
25723
|
import * as fs30 from "fs";
|
|
25523
25724
|
import * as os14 from "os";
|
|
25524
25725
|
import * as path32 from "path";
|
|
25525
|
-
import { Command as
|
|
25726
|
+
import { Command as Command50, Option as Option47 } from "clipanion";
|
|
25526
25727
|
init_errors();
|
|
25527
25728
|
|
|
25528
25729
|
// src/lib/bootstrap-mi.ts
|
|
@@ -25772,12 +25973,12 @@ async function writeBootstrapState(state, home = os13.homedir()) {
|
|
|
25772
25973
|
// src/commands/bootstrap/launch.ts
|
|
25773
25974
|
var DEFAULT_RG = "rg-m8t-stack";
|
|
25774
25975
|
var DEFAULT_INSTALLER = "ghcr.io/m8t-labs/m8t-installer";
|
|
25775
|
-
var DEFAULT_INSTALLER_TAG = "v0.1.
|
|
25976
|
+
var DEFAULT_INSTALLER_TAG = "v0.1.36";
|
|
25776
25977
|
var ACI_NAME = "m8t-installer";
|
|
25777
25978
|
var MI_NAME = "m8t-installer-mi";
|
|
25778
25979
|
var BootstrapLaunchCommand = class extends M8tCommand {
|
|
25779
25980
|
static paths = [["bootstrap", "launch"]];
|
|
25780
|
-
static usage =
|
|
25981
|
+
static usage = Command50.Usage({
|
|
25781
25982
|
description: "Create + authorize the installer managed identity, then kick the cloud installer.",
|
|
25782
25983
|
details: "Step 2 of `m8t bootstrap` (run after `preflight`). Ensures the resource group, creates the m8t app registration (or uses --client-id), creates a user-assigned managed identity granted Owner at subscription scope, and launches the published m8t-installer image as an ACI run-to-completion job under that identity. Writes ~/.m8t/bootstrap.json for `status`/`reap`/`finish`.",
|
|
25783
25984
|
examples: [
|
|
@@ -25787,17 +25988,17 @@ var BootstrapLaunchCommand = class extends M8tCommand {
|
|
|
25787
25988
|
["Override the full installer image ref", "$0 bootstrap launch --location eastus2 --installer-image ghcr.io/m8t-labs/m8t-installer:v0.1.33"]
|
|
25788
25989
|
]
|
|
25789
25990
|
});
|
|
25790
|
-
location =
|
|
25791
|
-
resourceGroup =
|
|
25792
|
-
clientId =
|
|
25793
|
-
subscription =
|
|
25794
|
-
installerTag =
|
|
25991
|
+
location = Option47.String("--location");
|
|
25992
|
+
resourceGroup = Option47.String("--resource-group");
|
|
25993
|
+
clientId = Option47.String("--client-id");
|
|
25994
|
+
subscription = Option47.String("--subscription");
|
|
25995
|
+
installerTag = Option47.String("--installer-tag");
|
|
25795
25996
|
// Full image ref override (registry + repo + tag) — an escape hatch when the
|
|
25796
25997
|
// default org/tag is wrong for the current CLI (e.g. a stale published build).
|
|
25797
25998
|
// Wins over --installer-tag / the pinned default.
|
|
25798
|
-
installerImage =
|
|
25799
|
-
gatewayImageRef =
|
|
25800
|
-
githubAppCreds =
|
|
25999
|
+
installerImage = Option47.String("--installer-image");
|
|
26000
|
+
gatewayImageRef = Option47.String("--gateway-image-ref");
|
|
26001
|
+
githubAppCreds = Option47.String("--github-app-creds");
|
|
25801
26002
|
async executeCommand() {
|
|
25802
26003
|
const location = typeof this.location === "string" ? this.location : void 0;
|
|
25803
26004
|
if (!location) {
|
|
@@ -25901,7 +26102,7 @@ var BootstrapLaunchCommand = class extends M8tCommand {
|
|
|
25901
26102
|
};
|
|
25902
26103
|
|
|
25903
26104
|
// src/commands/bootstrap/status.ts
|
|
25904
|
-
import { Command as
|
|
26105
|
+
import { Command as Command51, Option as Option48 } from "clipanion";
|
|
25905
26106
|
init_errors();
|
|
25906
26107
|
|
|
25907
26108
|
// src/lib/bootstrap-aci-state.ts
|
|
@@ -25929,13 +26130,13 @@ async function getAciState(opts) {
|
|
|
25929
26130
|
// src/commands/bootstrap/status.ts
|
|
25930
26131
|
var BootstrapStatusCommand = class extends M8tCommand {
|
|
25931
26132
|
static paths = [["bootstrap", "status"]];
|
|
25932
|
-
static usage =
|
|
26133
|
+
static usage = Command51.Usage({
|
|
25933
26134
|
description: "Show the cloud installer's live status (phase, progress, result).",
|
|
25934
26135
|
details: "Reads the durable status blob written by the installer. --watch polls until the install reaches done or failed.",
|
|
25935
26136
|
examples: [["One read", "$0 bootstrap status"], ["Watch to completion", "$0 bootstrap status --watch"]]
|
|
25936
26137
|
});
|
|
25937
|
-
watch =
|
|
25938
|
-
output =
|
|
26138
|
+
watch = Option48.Boolean("--watch", false);
|
|
26139
|
+
output = Option48.String("--output");
|
|
25939
26140
|
async executeCommand() {
|
|
25940
26141
|
const state = await readBootstrapState();
|
|
25941
26142
|
if (!state) {
|
|
@@ -26006,7 +26207,7 @@ function formatStatus(d) {
|
|
|
26006
26207
|
}
|
|
26007
26208
|
|
|
26008
26209
|
// src/commands/bootstrap/reap.ts
|
|
26009
|
-
import { Command as
|
|
26210
|
+
import { Command as Command52, Option as Option49 } from "clipanion";
|
|
26010
26211
|
init_errors();
|
|
26011
26212
|
|
|
26012
26213
|
// src/lib/bootstrap-reap.ts
|
|
@@ -26100,14 +26301,14 @@ async function reapInstaller(opts) {
|
|
|
26100
26301
|
// src/commands/bootstrap/reap.ts
|
|
26101
26302
|
var BootstrapReapCommand = class extends M8tCommand {
|
|
26102
26303
|
static paths = [["bootstrap", "reap"]];
|
|
26103
|
-
static usage =
|
|
26304
|
+
static usage = Command52.Usage({
|
|
26104
26305
|
description: "Tear down the installer scaffolding (ACI \u2192 MI \u2192 its role assignments) after a successful install.",
|
|
26105
26306
|
details: "Runs locally on the 'done' signal (the installer can't delete its own identity). The platform RG and the gateway's own assignments persist. A failed install is left intact for diagnosis unless --force.",
|
|
26106
26307
|
examples: [["Reap after done", "$0 bootstrap reap"]]
|
|
26107
26308
|
});
|
|
26108
|
-
force =
|
|
26109
|
-
sweepOrphans =
|
|
26110
|
-
yes =
|
|
26309
|
+
force = Option49.Boolean("--force", false);
|
|
26310
|
+
sweepOrphans = Option49.Boolean("--sweep-orphans", false);
|
|
26311
|
+
yes = Option49.Boolean("--yes", false);
|
|
26111
26312
|
async executeCommand() {
|
|
26112
26313
|
if (this.sweepOrphans === true) {
|
|
26113
26314
|
const { subscriptionId: sub } = await getAzAccount();
|
|
@@ -26204,12 +26405,12 @@ Found ${String(total)} orphaned assignment(s) (${breakdown}) (dry-run). ${colors
|
|
|
26204
26405
|
import * as fs31 from "fs/promises";
|
|
26205
26406
|
import * as os16 from "os";
|
|
26206
26407
|
import * as path34 from "path";
|
|
26207
|
-
import { Command as
|
|
26408
|
+
import { Command as Command53, Option as Option50 } from "clipanion";
|
|
26208
26409
|
init_errors();
|
|
26209
26410
|
|
|
26210
26411
|
// src/lib/company-profile-seed.ts
|
|
26211
26412
|
import { spawn as spawn6 } from "child_process";
|
|
26212
|
-
import { closeSync, openSync, readFileSync as
|
|
26413
|
+
import { closeSync, openSync, readFileSync as readFileSync21 } from "fs";
|
|
26213
26414
|
import * as os15 from "os";
|
|
26214
26415
|
import * as path33 from "path";
|
|
26215
26416
|
init_errors();
|
|
@@ -26394,7 +26595,7 @@ function composeFounderIdentityNote(id) {
|
|
|
26394
26595
|
function readGithubAppCreds(credsPath) {
|
|
26395
26596
|
const p = credsPath ?? path33.join(os15.homedir(), ".m8t", "github-app.json");
|
|
26396
26597
|
try {
|
|
26397
|
-
return JSON.parse(
|
|
26598
|
+
return JSON.parse(readFileSync21(p, "utf8"));
|
|
26398
26599
|
} catch {
|
|
26399
26600
|
return null;
|
|
26400
26601
|
}
|
|
@@ -26422,7 +26623,7 @@ async function resolveSeedContext(opts) {
|
|
|
26422
26623
|
async function applyProfileToBrain(args) {
|
|
26423
26624
|
const token = await mintInstallationTokenFromPem({
|
|
26424
26625
|
appId: args.appCreds.appId,
|
|
26425
|
-
privateKeyPem:
|
|
26626
|
+
privateKeyPem: readFileSync21(args.appCreds.pemPath, "utf8"),
|
|
26426
26627
|
installationId: args.appCreds.installationId,
|
|
26427
26628
|
fetchImpl: args.fetchImpl
|
|
26428
26629
|
});
|
|
@@ -26534,14 +26735,14 @@ function renderInstallSummary(args) {
|
|
|
26534
26735
|
// src/commands/bootstrap/finish.ts
|
|
26535
26736
|
var BootstrapFinishCommand = class extends M8tCommand {
|
|
26536
26737
|
static paths = [["bootstrap", "finish"]];
|
|
26537
|
-
static usage =
|
|
26738
|
+
static usage = Command53.Usage({
|
|
26538
26739
|
description: "Point your local tools at the now-live platform (repo-root marker, discovery cache, next steps).",
|
|
26539
26740
|
details: "Final step of `m8t bootstrap` (after the install reaches done). Writes ~/.m8t/repo-root, points your local tools at the live gateway, and \u2014 if you completed the onboarding questionnaire \u2014 seeds your brain-backed advisor's brain with your company profile (best-effort; never blocks finish). Run `m8t bootstrap seed-profile` to seed manually later.",
|
|
26540
26741
|
examples: [["Finish local", "$0 bootstrap finish --repo-root /path/to/m8t"]]
|
|
26541
26742
|
});
|
|
26542
|
-
repoRoot =
|
|
26543
|
-
subscription =
|
|
26544
|
-
resourceGroup =
|
|
26743
|
+
repoRoot = Option50.String("--repo-root");
|
|
26744
|
+
subscription = Option50.String("--subscription");
|
|
26745
|
+
resourceGroup = Option50.String("--resource-group");
|
|
26545
26746
|
async executeCommand() {
|
|
26546
26747
|
const state = await readBootstrapState();
|
|
26547
26748
|
if (!state) {
|
|
@@ -26644,8 +26845,8 @@ ${colors.field("Then open a brand new chat/session")} \u2014 new skills + MCP se
|
|
|
26644
26845
|
import * as fs33 from "fs";
|
|
26645
26846
|
import * as os18 from "os";
|
|
26646
26847
|
import * as path36 from "path";
|
|
26647
|
-
import { Command as
|
|
26648
|
-
import { DefaultAzureCredential as
|
|
26848
|
+
import { Command as Command54, Option as Option51 } from "clipanion";
|
|
26849
|
+
import { DefaultAzureCredential as DefaultAzureCredential21 } from "@azure/identity";
|
|
26649
26850
|
init_errors();
|
|
26650
26851
|
|
|
26651
26852
|
// src/lib/bootstrap-ui.ts
|
|
@@ -27039,7 +27240,7 @@ function renderDeployFailure(error) {
|
|
|
27039
27240
|
}
|
|
27040
27241
|
var BootstrapUiCommand = class extends M8tCommand {
|
|
27041
27242
|
static paths = [["bootstrap", "ui"]];
|
|
27042
|
-
static usage =
|
|
27243
|
+
static usage = Command54.Usage({
|
|
27043
27244
|
description: "Deploy Simple Stacey + start the local onboarding chat UI in the background (returns immediately).",
|
|
27044
27245
|
details: [
|
|
27045
27246
|
"Run after `m8t bootstrap launch`, in parallel with `status --watch`. Waits for the cloud",
|
|
@@ -27057,15 +27258,15 @@ var BootstrapUiCommand = class extends M8tCommand {
|
|
|
27057
27258
|
["Foreground (blocking, old behaviour)", "$0 bootstrap ui --repo-root /path/to/m8t --foreground"]
|
|
27058
27259
|
]
|
|
27059
27260
|
});
|
|
27060
|
-
repoRoot =
|
|
27061
|
-
port =
|
|
27062
|
-
endpoint =
|
|
27261
|
+
repoRoot = Option51.String("--repo-root");
|
|
27262
|
+
port = Option51.String("--port", "3000");
|
|
27263
|
+
endpoint = Option51.String("--endpoint", {
|
|
27063
27264
|
description: "Foundry project endpoint to target \u2014 disambiguates when the subscription has multiple projects."
|
|
27064
27265
|
});
|
|
27065
|
-
prepOnly =
|
|
27066
|
-
skipInstall =
|
|
27067
|
-
stop =
|
|
27068
|
-
foreground =
|
|
27266
|
+
prepOnly = Option51.Boolean("--prep-only", false);
|
|
27267
|
+
skipInstall = Option51.Boolean("--skip-install", false);
|
|
27268
|
+
stop = Option51.Boolean("--stop", false);
|
|
27269
|
+
foreground = Option51.Boolean("--foreground", false);
|
|
27069
27270
|
async executeCommand() {
|
|
27070
27271
|
if (this.stop === true) {
|
|
27071
27272
|
const stopped = stopOnboardingUi();
|
|
@@ -27101,7 +27302,7 @@ var BootstrapUiCommand = class extends M8tCommand {
|
|
|
27101
27302
|
if (fs33.existsSync(path36.join(os18.homedir(), ".m8t", "config.yaml"))) {
|
|
27102
27303
|
out(colors.error("\u26A0 an existing ~/.m8t/config.yaml will override the onboarding app registration in apps/web \u2014 if Microsoft sign-in fails, move it aside and retry."));
|
|
27103
27304
|
}
|
|
27104
|
-
const credential2 = new
|
|
27305
|
+
const credential2 = new DefaultAzureCredential21();
|
|
27105
27306
|
const account = await getAzAccount();
|
|
27106
27307
|
assertNodeVersion();
|
|
27107
27308
|
out("waiting for Foundry (the installer's foundry-create phase)\u2026");
|
|
@@ -27199,10 +27400,10 @@ var BootstrapUiCommand = class extends M8tCommand {
|
|
|
27199
27400
|
};
|
|
27200
27401
|
|
|
27201
27402
|
// src/commands/bootstrap/seed-profile.ts
|
|
27202
|
-
import { Command as
|
|
27403
|
+
import { Command as Command55, Option as Option52 } from "clipanion";
|
|
27203
27404
|
var BootstrapSeedProfileCommand = class extends M8tCommand {
|
|
27204
27405
|
static paths = [["bootstrap", "seed-profile"]];
|
|
27205
|
-
static usage =
|
|
27406
|
+
static usage = Command55.Usage({
|
|
27206
27407
|
description: "Seed your advisors' brains with the founder + company profile from the onboarding questionnaire.",
|
|
27207
27408
|
details: "Reads the latest stacey-intake conversation, renders memory/founder.md + memory/company-profile.md (+ their MEMORY.md index lines), and commits them to both <org>/stacey-brain and <org>/azzy-brain via the GitHub App. Idempotent. --watch polls until the founder completes the questionnaire.",
|
|
27208
27409
|
examples: [
|
|
@@ -27210,11 +27411,11 @@ var BootstrapSeedProfileCommand = class extends M8tCommand {
|
|
|
27210
27411
|
["Wait for the founder to finish", "$0 bootstrap seed-profile --watch"]
|
|
27211
27412
|
]
|
|
27212
27413
|
});
|
|
27213
|
-
endpoint =
|
|
27214
|
-
brain =
|
|
27215
|
-
watch =
|
|
27216
|
-
timeout =
|
|
27217
|
-
githubAppCreds =
|
|
27414
|
+
endpoint = Option52.String("--endpoint", { description: "Override the Foundry endpoint (else read from the install status)." });
|
|
27415
|
+
brain = Option52.String("--brain", { description: "Override the brain repo (default <org>/stacey-brain)." });
|
|
27416
|
+
watch = Option52.Boolean("--watch", false, { description: "Poll until the questionnaire completes (or --timeout)." });
|
|
27417
|
+
timeout = Option52.String("--timeout", { description: "Watch timeout in minutes (default 20)." });
|
|
27418
|
+
githubAppCreds = Option52.String("--github-app-creds");
|
|
27218
27419
|
async executeCommand() {
|
|
27219
27420
|
const ctx = await resolveSeedContext({
|
|
27220
27421
|
endpointOverride: typeof this.endpoint === "string" ? this.endpoint : void 0,
|
|
@@ -27260,7 +27461,7 @@ var BootstrapSeedProfileCommand = class extends M8tCommand {
|
|
|
27260
27461
|
};
|
|
27261
27462
|
|
|
27262
27463
|
// src/commands/telemetry/enroll.ts
|
|
27263
|
-
import { Command as
|
|
27464
|
+
import { Command as Command56, Option as Option53 } from "clipanion";
|
|
27264
27465
|
init_errors();
|
|
27265
27466
|
|
|
27266
27467
|
// src/lib/telemetry-enroll.ts
|
|
@@ -27318,16 +27519,16 @@ async function resolveKeyVaultName(containerAppResourceId) {
|
|
|
27318
27519
|
}
|
|
27319
27520
|
var TelemetryEnrollCommand = class extends M8tCommand {
|
|
27320
27521
|
static paths = [["telemetry", "enroll"]];
|
|
27321
|
-
static usage =
|
|
27522
|
+
static usage = Command56.Usage({
|
|
27322
27523
|
description: "Enroll this installation for operational telemetry (pre-existing installs).",
|
|
27323
27524
|
details: "Mints an instance id + ingest key from the m8t telemetry ingest and stores the key in your platform Key Vault, the same place the installer writes it on a fresh install. Idempotent: refuses if a key already exists unless --force.",
|
|
27324
27525
|
examples: [["Enroll", "$0 telemetry enroll"]]
|
|
27325
27526
|
});
|
|
27326
|
-
company =
|
|
27327
|
-
contactEmail =
|
|
27328
|
-
subscription =
|
|
27329
|
-
resourceGroup =
|
|
27330
|
-
force =
|
|
27527
|
+
company = Option53.String("--company", { description: "Your company name (optional)." });
|
|
27528
|
+
contactEmail = Option53.String("--contact-email", { description: "Contact email (default: your signed-in az UPN)." });
|
|
27529
|
+
subscription = Option53.String("--subscription", { description: "Azure subscription id (default: your active az subscription)." });
|
|
27530
|
+
resourceGroup = Option53.String("--resource-group", { description: "Resource group to disambiguate discovery, if you have more than one m8t deployment." });
|
|
27531
|
+
force = Option53.Boolean("--force", false, { description: "Re-enroll even if a key is already stored (mints a new instance id)." });
|
|
27331
27532
|
async executeCommand() {
|
|
27332
27533
|
const account = await getAzAccount();
|
|
27333
27534
|
const subscriptionId = (typeof this.subscription === "string" ? this.subscription : void 0) ?? account.subscriptionId;
|
|
@@ -27406,6 +27607,7 @@ cli.register(AzureExecDeployCommand);
|
|
|
27406
27607
|
cli.register(PlatformStatusCommand);
|
|
27407
27608
|
cli.register(PlatformUpdateCommand);
|
|
27408
27609
|
cli.register(PlatformConvergeCommand);
|
|
27610
|
+
cli.register(PlatformSeedStampCommand);
|
|
27409
27611
|
cli.register(PlatformEnableCostReportCommand);
|
|
27410
27612
|
cli.register(PlatformEnableAutoUpdateCommand);
|
|
27411
27613
|
cli.register(DeployCommand);
|