@m8t-stack/cli 0.2.135 → 0.2.137
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 +299 -36
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -310,6 +310,13 @@ var init_ui_directive = __esm({
|
|
|
310
310
|
}
|
|
311
311
|
});
|
|
312
312
|
|
|
313
|
+
// ../../packages/api-contract/dist/esm/teaching.js
|
|
314
|
+
var init_teaching = __esm({
|
|
315
|
+
"../../packages/api-contract/dist/esm/teaching.js"() {
|
|
316
|
+
"use strict";
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
|
|
313
320
|
// ../../packages/api-contract/dist/esm/index.js
|
|
314
321
|
var init_esm = __esm({
|
|
315
322
|
"../../packages/api-contract/dist/esm/index.js"() {
|
|
@@ -329,6 +336,7 @@ var init_esm = __esm({
|
|
|
329
336
|
init_founder_benchmark();
|
|
330
337
|
init_agent_roster();
|
|
331
338
|
init_ui_directive();
|
|
339
|
+
init_teaching();
|
|
332
340
|
}
|
|
333
341
|
});
|
|
334
342
|
|
|
@@ -955,7 +963,9 @@ var init_brain_yaml_mirror = __esm({
|
|
|
955
963
|
` digestRetention: 90d`,
|
|
956
964
|
` costReport:`,
|
|
957
965
|
` enabled: true`,
|
|
958
|
-
` cadenceDays: 14
|
|
966
|
+
` cadenceDays: 14`,
|
|
967
|
+
` teaching:`,
|
|
968
|
+
` enabled: false # operator opt-in; gateway flag and teacher capability are also required`
|
|
959
969
|
].join("\n");
|
|
960
970
|
MIRROR_BANNER = [
|
|
961
971
|
`# \u2500\u2500 MIRROR \u2014 link record convenience copy. NOT the source of truth \u2014`,
|
|
@@ -1454,7 +1464,7 @@ function installFoundryDnsShim() {
|
|
|
1454
1464
|
}
|
|
1455
1465
|
|
|
1456
1466
|
// src/lib/package-version.ts
|
|
1457
|
-
var CLI_VERSION = "0.2.
|
|
1467
|
+
var CLI_VERSION = "0.2.137";
|
|
1458
1468
|
|
|
1459
1469
|
// src/lib/render-error.ts
|
|
1460
1470
|
init_errors();
|
|
@@ -2355,13 +2365,13 @@ function is_non_nullish_primitive(v) {
|
|
|
2355
2365
|
return typeof v === "string" || typeof v === "number" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "bigint";
|
|
2356
2366
|
}
|
|
2357
2367
|
var sentinel = {};
|
|
2358
|
-
function inner_stringify(
|
|
2359
|
-
let obj2 =
|
|
2368
|
+
function inner_stringify(object2, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
|
|
2369
|
+
let obj2 = object2;
|
|
2360
2370
|
let tmp_sc = sideChannel;
|
|
2361
2371
|
let step = 0;
|
|
2362
2372
|
let find_flag = false;
|
|
2363
2373
|
while ((tmp_sc = tmp_sc.get(sentinel)) !== void 0 && !find_flag) {
|
|
2364
|
-
const pos = tmp_sc.get(
|
|
2374
|
+
const pos = tmp_sc.get(object2);
|
|
2365
2375
|
step += 1;
|
|
2366
2376
|
if (typeof pos !== "undefined") {
|
|
2367
2377
|
if (pos === step) {
|
|
@@ -2437,7 +2447,7 @@ function inner_stringify(object, prefix, generateArrayPrefix, commaRoundTrip, al
|
|
|
2437
2447
|
}
|
|
2438
2448
|
const encoded_key = allowDots && encodeDotInKeys ? key2.replace(/\./g, "%2E") : key2;
|
|
2439
2449
|
const key_prefix = isArray(obj2) ? typeof generateArrayPrefix === "function" ? generateArrayPrefix(adjusted_prefix, encoded_key) : adjusted_prefix : adjusted_prefix + (allowDots ? "." + encoded_key : "[" + encoded_key + "]");
|
|
2440
|
-
sideChannel.set(
|
|
2450
|
+
sideChannel.set(object2, step);
|
|
2441
2451
|
const valueSideChannel = /* @__PURE__ */ new WeakMap();
|
|
2442
2452
|
valueSideChannel.set(sentinel, sideChannel);
|
|
2443
2453
|
push_to_array(values, inner_stringify(
|
|
@@ -2526,8 +2536,8 @@ function normalize_stringify_options(opts = defaults) {
|
|
|
2526
2536
|
strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling
|
|
2527
2537
|
};
|
|
2528
2538
|
}
|
|
2529
|
-
function stringify(
|
|
2530
|
-
let obj2 =
|
|
2539
|
+
function stringify(object2, opts = {}) {
|
|
2540
|
+
let obj2 = object2;
|
|
2531
2541
|
const options = normalize_stringify_options(opts);
|
|
2532
2542
|
let obj_keys;
|
|
2533
2543
|
let filter;
|
|
@@ -19540,7 +19550,7 @@ var PINNED_INSTALLER = fromBuild('{"ref":"ghcr.io/m8t-labs/m8t-installer:v0.1.10
|
|
|
19540
19550
|
var PINNED_CODING_AGENT = fromBuild('{"ref":"ghcr.io/m8t-labs/m8t-coding-agent:v0.1.5","registry":"ghcr.io/m8t-labs","image":"m8t-coding-agent","tag":"v0.1.5"}', "ghcr.io/m8t-labs/m8t-coding-agent");
|
|
19541
19551
|
var PINNED_AZURE_EXECUTOR = fromBuild('{"ref":"ghcr.io/m8t-labs/m8t-azure-executor:v0.1.5","registry":"ghcr.io/m8t-labs","image":"m8t-azure-executor","tag":"v0.1.5"}', "ghcr.io/m8t-labs/m8t-azure-executor");
|
|
19542
19552
|
var PINNED_PLATFORM_VERSION = (() => {
|
|
19543
|
-
const raw = "0.8.
|
|
19553
|
+
const raw = "0.8.4";
|
|
19544
19554
|
return /^\d+\.\d+\.\d+$/.test(raw) ? raw : "";
|
|
19545
19555
|
})();
|
|
19546
19556
|
|
|
@@ -29625,7 +29635,12 @@ function mapItems(raw) {
|
|
|
29625
29635
|
continue;
|
|
29626
29636
|
const text = Array.isArray(item.content) ? maskSecrets(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"))) : "";
|
|
29627
29637
|
const at = typeof item.created_at === "number" ? new Date(item.created_at * 1e3).toISOString() : void 0;
|
|
29628
|
-
acc.push(
|
|
29638
|
+
acc.push({
|
|
29639
|
+
...typeof item.id === "string" && item.id.length > 0 ? { id: item.id } : {},
|
|
29640
|
+
role: item.role,
|
|
29641
|
+
text,
|
|
29642
|
+
...at ? { at } : {}
|
|
29643
|
+
});
|
|
29629
29644
|
}
|
|
29630
29645
|
return acc.reverse();
|
|
29631
29646
|
}
|
|
@@ -29796,6 +29811,31 @@ function normalize(group, items, enrichment) {
|
|
|
29796
29811
|
return conv;
|
|
29797
29812
|
}
|
|
29798
29813
|
|
|
29814
|
+
// ../../packages/brain/engine/dist/esm/teaching-exclusion.js
|
|
29815
|
+
var TeachingExclusionUnavailableError = class extends Error {
|
|
29816
|
+
constructor() {
|
|
29817
|
+
super("Authoritative teaching exclusion is unavailable");
|
|
29818
|
+
this.name = "TeachingExclusionUnavailableError";
|
|
29819
|
+
}
|
|
29820
|
+
};
|
|
29821
|
+
async function excludeTeachingItems(source, conversationId, items) {
|
|
29822
|
+
if (!source)
|
|
29823
|
+
return items;
|
|
29824
|
+
let coverage;
|
|
29825
|
+
try {
|
|
29826
|
+
coverage = await source.coverage(conversationId);
|
|
29827
|
+
} catch {
|
|
29828
|
+
throw new TeachingExclusionUnavailableError();
|
|
29829
|
+
}
|
|
29830
|
+
if (!coverage.hasTeachingEpisodes)
|
|
29831
|
+
return items;
|
|
29832
|
+
if (items.some((item) => typeof item.id !== "string" || !/^msg_[A-Za-z0-9_-]+$/.test(item.id))) {
|
|
29833
|
+
return [];
|
|
29834
|
+
}
|
|
29835
|
+
const withheld = new Set(coverage.teachingItemIds);
|
|
29836
|
+
return items.filter((item) => !withheld.has(item.id ?? ""));
|
|
29837
|
+
}
|
|
29838
|
+
|
|
29799
29839
|
// ../../packages/brain/engine/dist/esm/pipeline.js
|
|
29800
29840
|
var isKnownSource = (s) => SOURCES.includes(s);
|
|
29801
29841
|
var MAX_CONV_FETCH_ATTEMPTS = 3;
|
|
@@ -29906,10 +29946,28 @@ async function runPipeline(args) {
|
|
|
29906
29946
|
recoveredVia: didRecover ? "trace" : void 0
|
|
29907
29947
|
};
|
|
29908
29948
|
const grpRows = rowsByGroupKey.get(groupKeyOf(g)) ?? [];
|
|
29909
|
-
(consumedRowsByPk[pk] ??= []).push(...grpRows);
|
|
29910
29949
|
const provRows = grpRows.map((r) => ({ rowKey: rowStorageKey(r), eventTimestamp: r.eventTimestamp }));
|
|
29950
|
+
let teachingFilteredItems;
|
|
29951
|
+
try {
|
|
29952
|
+
teachingFilteredItems = await excludeTeachingItems(sources.teaching, conversationId ?? "", items);
|
|
29953
|
+
} catch (error) {
|
|
29954
|
+
if (!(error instanceof TeachingExclusionUnavailableError))
|
|
29955
|
+
throw error;
|
|
29956
|
+
const id = conversationId ?? "";
|
|
29957
|
+
const next = (cursor.fetchFailures?.[id] ?? 0) + 1;
|
|
29958
|
+
newFailures[id] = next;
|
|
29959
|
+
skips.addSkip("teaching-exclusion-unavailable", sampleId(g), next >= MAX_CONV_FETCH_ATTEMPTS ? `terminal after ${String(next)} cycles \u2014 conversation withheld; watermark released` : error.message);
|
|
29960
|
+
if (next < MAX_CONV_FETCH_ATTEMPTS) {
|
|
29961
|
+
const currentFailure = failedTsByPk[pk];
|
|
29962
|
+
if (!currentFailure || g.startedAt < currentFailure) {
|
|
29963
|
+
failedTsByPk[pk] = g.startedAt;
|
|
29964
|
+
}
|
|
29965
|
+
}
|
|
29966
|
+
continue;
|
|
29967
|
+
}
|
|
29968
|
+
(consumedRowsByPk[pk] ??= []).push(...grpRows);
|
|
29911
29969
|
const trustedOwner = g.source !== "a2a" && g.user.ref !== "unknown" && !g.user.ref.startsWith("svc:");
|
|
29912
|
-
const dreamItems = trustedOwner ?
|
|
29970
|
+
const dreamItems = trustedOwner ? teachingFilteredItems : teachingFilteredItems.map((i) => ({ ...i, text: maskContactStrict(i.text) }));
|
|
29913
29971
|
const conv = normalize(ng, dreamItems, enrichment);
|
|
29914
29972
|
conv.provenance = { pk, rows: provRows };
|
|
29915
29973
|
conversations.push(conv);
|
|
@@ -30058,6 +30116,184 @@ function buildAdvancePlan(worker, cursor, physicalPks, consumedRowsByPk, failedT
|
|
|
30058
30116
|
};
|
|
30059
30117
|
}
|
|
30060
30118
|
|
|
30119
|
+
// ../../packages/brain/engine/dist/esm/teaching-table-source.js
|
|
30120
|
+
var CONVERSATION_ID = /^conv_[A-Za-z0-9_-]+$/;
|
|
30121
|
+
var MESSAGE_ID = /^msg_[A-Za-z0-9_-]+$/;
|
|
30122
|
+
var SURFACE_ID = /^surface_[A-Za-z0-9_-]+$/;
|
|
30123
|
+
var EPISODE_ID = /^teach_[A-Za-z0-9_-]+$/;
|
|
30124
|
+
var EPISODE_STATES = /* @__PURE__ */ new Set([
|
|
30125
|
+
"active",
|
|
30126
|
+
"summarizing",
|
|
30127
|
+
"awaiting_confirmation",
|
|
30128
|
+
"queued",
|
|
30129
|
+
"processing",
|
|
30130
|
+
"pr_open",
|
|
30131
|
+
"merged",
|
|
30132
|
+
"declined",
|
|
30133
|
+
"needs_attention",
|
|
30134
|
+
"cancelled",
|
|
30135
|
+
"expired"
|
|
30136
|
+
]);
|
|
30137
|
+
function object(value) {
|
|
30138
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
30139
|
+
}
|
|
30140
|
+
function optionalMessageId(value) {
|
|
30141
|
+
return value === void 0 || typeof value === "string" && MESSAGE_ID.test(value);
|
|
30142
|
+
}
|
|
30143
|
+
function parseSpan(value, expectedOrdinal) {
|
|
30144
|
+
if (!object(value))
|
|
30145
|
+
throw new Error("Invalid TeachingEpisodes row: malformed span");
|
|
30146
|
+
const { ordinal, conversationId, startAfterItemId, endAtItemId, empty } = value;
|
|
30147
|
+
if (ordinal !== expectedOrdinal || typeof conversationId !== "string" || !CONVERSATION_ID.test(conversationId) || !optionalMessageId(startAfterItemId) || !optionalMessageId(endAtItemId) || empty !== void 0 && empty !== true) {
|
|
30148
|
+
throw new Error("Invalid TeachingEpisodes row: malformed span");
|
|
30149
|
+
}
|
|
30150
|
+
return value;
|
|
30151
|
+
}
|
|
30152
|
+
function parseEpisode(entity) {
|
|
30153
|
+
if (entity.kind !== "episode" || typeof entity.payload !== "string") {
|
|
30154
|
+
throw new Error("Invalid TeachingEpisodes row: expected episode payload");
|
|
30155
|
+
}
|
|
30156
|
+
let parsed;
|
|
30157
|
+
try {
|
|
30158
|
+
parsed = JSON.parse(entity.payload);
|
|
30159
|
+
} catch {
|
|
30160
|
+
throw new Error("Invalid TeachingEpisodes row: payload is not JSON");
|
|
30161
|
+
}
|
|
30162
|
+
if (!object(parsed))
|
|
30163
|
+
throw new Error("Invalid TeachingEpisodes row: payload is not an object");
|
|
30164
|
+
if (parsed.schemaVersion !== 1 || typeof parsed.surfaceId !== "string" || !SURFACE_ID.test(parsed.surfaceId) || typeof parsed.episodeId !== "string" || !EPISODE_ID.test(parsed.episodeId) || typeof parsed.state !== "string" || !EPISODE_STATES.has(parsed.state) || parsed.surfaceId !== entity.partitionKey || parsed.episodeId !== entity.rowKey || parsed.state !== entity.state || !Array.isArray(parsed.spans) || parsed.spans.length === 0) {
|
|
30165
|
+
throw new Error("Invalid TeachingEpisodes row: identity, state, or spans are malformed");
|
|
30166
|
+
}
|
|
30167
|
+
const spans = parsed.spans.map(parseSpan);
|
|
30168
|
+
if (entity.sourceConversationIds !== void 0) {
|
|
30169
|
+
let indexed;
|
|
30170
|
+
try {
|
|
30171
|
+
indexed = typeof entity.sourceConversationIds === "string" ? JSON.parse(entity.sourceConversationIds) : void 0;
|
|
30172
|
+
} catch {
|
|
30173
|
+
indexed = void 0;
|
|
30174
|
+
}
|
|
30175
|
+
const payloadIds = [...new Set(spans.map((span) => span.conversationId))];
|
|
30176
|
+
if (!Array.isArray(indexed) || indexed.length === 0 || indexed.some((value) => typeof value !== "string" || !CONVERSATION_ID.test(value)) || JSON.stringify(indexed) !== JSON.stringify(payloadIds)) {
|
|
30177
|
+
throw new Error("Invalid TeachingEpisodes row: source conversation index does not match payload");
|
|
30178
|
+
}
|
|
30179
|
+
}
|
|
30180
|
+
const emptyIndex = spans.findIndex((span) => span.empty === true);
|
|
30181
|
+
if (emptyIndex >= 0 && (emptyIndex !== spans.length - 1 || parsed.state !== "cancelled" && parsed.state !== "expired")) {
|
|
30182
|
+
throw new Error("Invalid TeachingEpisodes row: empty span is not a terminal tombstone");
|
|
30183
|
+
}
|
|
30184
|
+
return { spans };
|
|
30185
|
+
}
|
|
30186
|
+
function claimsConversation(entity, conversationId) {
|
|
30187
|
+
if (typeof entity.sourceConversationIds === "string") {
|
|
30188
|
+
try {
|
|
30189
|
+
const indexed = JSON.parse(entity.sourceConversationIds);
|
|
30190
|
+
if (Array.isArray(indexed) && indexed.includes(conversationId))
|
|
30191
|
+
return true;
|
|
30192
|
+
} catch {
|
|
30193
|
+
}
|
|
30194
|
+
}
|
|
30195
|
+
if (typeof entity.payload !== "string")
|
|
30196
|
+
return false;
|
|
30197
|
+
let parsed;
|
|
30198
|
+
try {
|
|
30199
|
+
parsed = JSON.parse(entity.payload);
|
|
30200
|
+
} catch {
|
|
30201
|
+
return false;
|
|
30202
|
+
}
|
|
30203
|
+
if (!object(parsed) || !Array.isArray(parsed.spans))
|
|
30204
|
+
return false;
|
|
30205
|
+
return parsed.spans.some((span) => object(span) && span.conversationId === conversationId);
|
|
30206
|
+
}
|
|
30207
|
+
function isInfrastructureRow(entity) {
|
|
30208
|
+
if (entity.kind === "open_guard") {
|
|
30209
|
+
return entity.rowKey === "__open__" && SURFACE_ID.test(entity.partitionKey) && typeof entity.episodeId === "string" && EPISODE_ID.test(entity.episodeId);
|
|
30210
|
+
}
|
|
30211
|
+
if (entity.kind === "proposal_job") {
|
|
30212
|
+
return SURFACE_ID.test(entity.partitionKey) && entity.rowKey.startsWith("job:") && EPISODE_ID.test(entity.rowKey.slice("job:".length));
|
|
30213
|
+
}
|
|
30214
|
+
return false;
|
|
30215
|
+
}
|
|
30216
|
+
function uniqueItemIndex(items) {
|
|
30217
|
+
const positions = /* @__PURE__ */ new Map();
|
|
30218
|
+
for (const [index, item] of items.entries()) {
|
|
30219
|
+
if (typeof item.id !== "string" || !MESSAGE_ID.test(item.id) || positions.has(item.id)) {
|
|
30220
|
+
throw new Error("Teaching exclusion requires unique stable message ids");
|
|
30221
|
+
}
|
|
30222
|
+
positions.set(item.id, index);
|
|
30223
|
+
}
|
|
30224
|
+
return positions;
|
|
30225
|
+
}
|
|
30226
|
+
function addSpanItems(owned, span, items, positions) {
|
|
30227
|
+
if (span.empty === true)
|
|
30228
|
+
return;
|
|
30229
|
+
let start = 0;
|
|
30230
|
+
if (span.startAfterItemId !== void 0) {
|
|
30231
|
+
const boundary = positions.get(span.startAfterItemId);
|
|
30232
|
+
if (boundary === void 0)
|
|
30233
|
+
throw new Error("Teaching exclusion start boundary is absent");
|
|
30234
|
+
start = boundary + 1;
|
|
30235
|
+
}
|
|
30236
|
+
let end = items.length - 1;
|
|
30237
|
+
if (span.endAtItemId !== void 0) {
|
|
30238
|
+
const boundary = positions.get(span.endAtItemId);
|
|
30239
|
+
if (boundary === void 0)
|
|
30240
|
+
throw new Error("Teaching exclusion end boundary is absent");
|
|
30241
|
+
end = boundary;
|
|
30242
|
+
}
|
|
30243
|
+
if (start > items.length || span.endAtItemId !== void 0 && start > end) {
|
|
30244
|
+
throw new Error("Teaching exclusion span boundary is absent or out of order");
|
|
30245
|
+
}
|
|
30246
|
+
for (let index = start; index <= end; index += 1) {
|
|
30247
|
+
const id = items[index]?.id;
|
|
30248
|
+
if (!id)
|
|
30249
|
+
throw new Error("Teaching exclusion span resolved to an id-less item");
|
|
30250
|
+
owned.add(id);
|
|
30251
|
+
}
|
|
30252
|
+
}
|
|
30253
|
+
function createTeachingExclusionSource(table, transcriptSnapshot) {
|
|
30254
|
+
return {
|
|
30255
|
+
async coverage(conversationId) {
|
|
30256
|
+
if (!CONVERSATION_ID.test(conversationId)) {
|
|
30257
|
+
throw new Error("Teaching exclusion requires a stable conversation id");
|
|
30258
|
+
}
|
|
30259
|
+
const matchingSpans = [];
|
|
30260
|
+
let yielded = false;
|
|
30261
|
+
try {
|
|
30262
|
+
for await (const entity of table.listEntities()) {
|
|
30263
|
+
yielded = true;
|
|
30264
|
+
if (isInfrastructureRow(entity))
|
|
30265
|
+
continue;
|
|
30266
|
+
if (!claimsConversation(entity, conversationId))
|
|
30267
|
+
continue;
|
|
30268
|
+
const episode = parseEpisode(entity);
|
|
30269
|
+
matchingSpans.push(...episode.spans.filter((span) => span.conversationId === conversationId));
|
|
30270
|
+
}
|
|
30271
|
+
} catch (error) {
|
|
30272
|
+
const status = error?.statusCode;
|
|
30273
|
+
const code = error?.code;
|
|
30274
|
+
if (yielded || status !== 404 && code !== "TableNotFound")
|
|
30275
|
+
throw error;
|
|
30276
|
+
}
|
|
30277
|
+
if (matchingSpans.length === 0)
|
|
30278
|
+
return { hasTeachingEpisodes: false, teachingItemIds: [] };
|
|
30279
|
+
if (matchingSpans.every((span) => span.empty === true)) {
|
|
30280
|
+
return { hasTeachingEpisodes: true, teachingItemIds: [] };
|
|
30281
|
+
}
|
|
30282
|
+
const items = transcriptSnapshot(conversationId);
|
|
30283
|
+
if (!items)
|
|
30284
|
+
throw new Error("Teaching transcript snapshot is unavailable");
|
|
30285
|
+
const positions = uniqueItemIndex(items);
|
|
30286
|
+
const owned = /* @__PURE__ */ new Set();
|
|
30287
|
+
for (const span of matchingSpans)
|
|
30288
|
+
addSpanItems(owned, span, items, positions);
|
|
30289
|
+
return {
|
|
30290
|
+
hasTeachingEpisodes: true,
|
|
30291
|
+
teachingItemIds: items.flatMap((item) => item.id && owned.has(item.id) ? [item.id] : [])
|
|
30292
|
+
};
|
|
30293
|
+
}
|
|
30294
|
+
};
|
|
30295
|
+
}
|
|
30296
|
+
|
|
30061
30297
|
// ../../packages/brain/engine/dist/esm/dream/writer.js
|
|
30062
30298
|
var API2 = "https://api.github.com";
|
|
30063
30299
|
var WRITER_ALLOWED_PREFIX = /^(memory|inbox|quarantine|artifacts)\//;
|
|
@@ -30318,7 +30554,7 @@ function renderDigestMarkdown(digest, opts) {
|
|
|
30318
30554
|
push("## Changed", `- \`${e.path}\` \u2014 **${e.verb.toUpperCase()}**${fmtEvidence(e.evidence)}`);
|
|
30319
30555
|
break;
|
|
30320
30556
|
case "flagged":
|
|
30321
|
-
push("## Flagged (
|
|
30557
|
+
push("## Flagged (protected origin \u2014 not edited)", `- \`${e.path}\` \u2014 ${e.tension}${fmtEvidence(e.evidence)}`);
|
|
30322
30558
|
break;
|
|
30323
30559
|
case "quarantined":
|
|
30324
30560
|
push("## Quarantined", `- \`${e.path}\` \u2014 ${e.reason}${fmtEvidence(e.evidence)}`);
|
|
@@ -30369,7 +30605,7 @@ function renderDigestMarkdown(digest, opts) {
|
|
|
30369
30605
|
}
|
|
30370
30606
|
const order = [
|
|
30371
30607
|
"## Changed",
|
|
30372
|
-
"## Flagged (
|
|
30608
|
+
"## Flagged (protected origin \u2014 not edited)",
|
|
30373
30609
|
"## Quarantined",
|
|
30374
30610
|
"## Capture gaps (dreamer-judged proxy, not outcome-grounded)",
|
|
30375
30611
|
"## Skipped (ledger reconcile)",
|
|
@@ -30610,7 +30846,7 @@ function buildSystemPrompt() {
|
|
|
30610
30846
|
"## Do-not-capture (memory write discipline)",
|
|
30611
30847
|
DO_NOT_CAPTURE,
|
|
30612
30848
|
"## What you may capture",
|
|
30613
|
-
"Durable, recurring business facts and decisions that serve the worker's standing function; contradictions of standing memory (propose supersede/retract for worker/dream-origin targets, flag for operator-origin); skill-worthy repeated plays (as skill-seed).",
|
|
30849
|
+
"Durable, recurring business facts and decisions that serve the worker's standing function; contradictions of standing memory (propose supersede/retract for worker/dream-origin targets, flag for protected operator/taught-origin targets); skill-worthy repeated plays (as skill-seed).",
|
|
30614
30850
|
"## Output",
|
|
30615
30851
|
PROPOSAL_SCHEMA
|
|
30616
30852
|
].join("\n\n");
|
|
@@ -30755,6 +30991,9 @@ async function checkOriginTier(delta, lookup) {
|
|
|
30755
30991
|
const editable = origin === "worker" || origin === "dream";
|
|
30756
30992
|
if (editable)
|
|
30757
30993
|
return { ok: true };
|
|
30994
|
+
if (origin === "taught") {
|
|
30995
|
+
return { ok: false, flagged: { kind: "flagged", path: path47, tension: `taught-origin; flag-only`, evidence } };
|
|
30996
|
+
}
|
|
30758
30997
|
const removesOperatorTarget = delta.verb === "retract" || delta.verb === "supersede" && delta.oldPath !== delta.newPath;
|
|
30759
30998
|
if (removesOperatorTarget) {
|
|
30760
30999
|
throw new BatchAbort(path47, `supersede/retract OLD target ${path47} is origin: ${origin} \u2014 aborting batch (never half-apply)`);
|
|
@@ -31344,15 +31583,18 @@ function parseDreamerConfig(rawYaml, env) {
|
|
|
31344
31583
|
};
|
|
31345
31584
|
}
|
|
31346
31585
|
|
|
31586
|
+
// ../../packages/brain/engine/dist/esm/teach/gates.js
|
|
31587
|
+
import { createHash as createHash5 } from "crypto";
|
|
31588
|
+
|
|
31589
|
+
// ../../packages/brain/engine/dist/esm/librarian/janitor/frontmatter.js
|
|
31590
|
+
import { parse as parseYaml14, stringify as stringifyYaml5 } from "yaml";
|
|
31591
|
+
|
|
31347
31592
|
// ../../packages/brain/engine/dist/esm/cost-report/config.js
|
|
31348
|
-
import { parse as
|
|
31593
|
+
import { parse as parseYaml15 } from "yaml";
|
|
31349
31594
|
|
|
31350
31595
|
// ../../packages/brain/engine/dist/esm/librarian/codify/persistence-guard.js
|
|
31351
31596
|
var ZERO_WIDTH_RE = new RegExp("\u200B|\u200C|\u200D|\uFEFF", "g");
|
|
31352
31597
|
|
|
31353
|
-
// ../../packages/brain/engine/dist/esm/librarian/janitor/frontmatter.js
|
|
31354
|
-
import { parse as parseYaml15, stringify as stringifyYaml5 } from "yaml";
|
|
31355
|
-
|
|
31356
31598
|
// ../../packages/brain/engine/dist/esm/librarian/config.js
|
|
31357
31599
|
import { parse as parseYaml16 } from "yaml";
|
|
31358
31600
|
|
|
@@ -31761,13 +32003,32 @@ function buildLiveSources(context, credential2) {
|
|
|
31761
32003
|
)
|
|
31762
32004
|
);
|
|
31763
32005
|
const openai = new AIProjectClient3(context.projectEndpoint, credential2).getOpenAIClient();
|
|
31764
|
-
const
|
|
32006
|
+
const baseConversations = makeConversationSource(openai);
|
|
32007
|
+
const snapshots = /* @__PURE__ */ new Map();
|
|
32008
|
+
const retrieveApp = baseConversations.retrieveApp?.bind(baseConversations);
|
|
32009
|
+
const conversations = {
|
|
32010
|
+
async items(conversationId) {
|
|
32011
|
+
const items = await baseConversations.items(conversationId);
|
|
32012
|
+
snapshots.set(conversationId, items);
|
|
32013
|
+
return items;
|
|
32014
|
+
},
|
|
32015
|
+
...retrieveApp ? { retrieveApp: (conversationId) => retrieveApp(conversationId) } : {}
|
|
32016
|
+
};
|
|
32017
|
+
const teachingTable = new TableClient8(
|
|
32018
|
+
context.ledgerTableEndpoint,
|
|
32019
|
+
"TeachingEpisodes",
|
|
32020
|
+
credential2
|
|
32021
|
+
);
|
|
32022
|
+
const teaching = createTeachingExclusionSource(
|
|
32023
|
+
teachingTable,
|
|
32024
|
+
(conversationId) => snapshots.get(conversationId)
|
|
32025
|
+
);
|
|
31765
32026
|
const traces = makeTraceSource({
|
|
31766
32027
|
enrichFn: (respIds, from, to) => fetchEnrichment(credential2, context.workspaceId, respIds, from, to),
|
|
31767
32028
|
convIdFn: makeConvIdFn(credential2, context.workspaceId)
|
|
31768
32029
|
});
|
|
31769
32030
|
const cursor = makeTableCursor(credential2, context.ledgerTableEndpoint);
|
|
31770
|
-
return { ledger, conversations, traces, cursor };
|
|
32031
|
+
return { ledger, conversations, traces, cursor, teaching };
|
|
31771
32032
|
}
|
|
31772
32033
|
async function buildWriteDeps(context, credential2, cursor) {
|
|
31773
32034
|
const agent = await getAgentVersion({
|
|
@@ -31864,7 +32125,8 @@ function defaultDeps(overrides) {
|
|
|
31864
32125
|
ledger: opts.ledger,
|
|
31865
32126
|
conversations: opts.conversations,
|
|
31866
32127
|
trace: opts.traces,
|
|
31867
|
-
cursor: opts.cursor
|
|
32128
|
+
cursor: opts.cursor,
|
|
32129
|
+
teaching: opts.teaching
|
|
31868
32130
|
}
|
|
31869
32131
|
});
|
|
31870
32132
|
},
|
|
@@ -31917,7 +32179,8 @@ function defaultDeps(overrides) {
|
|
|
31917
32179
|
ledger: opts.ledger,
|
|
31918
32180
|
conversations: opts.conversations,
|
|
31919
32181
|
trace: opts.traces,
|
|
31920
|
-
cursor: opts.cursor
|
|
32182
|
+
cursor: opts.cursor,
|
|
32183
|
+
teaching: opts.teaching
|
|
31921
32184
|
}
|
|
31922
32185
|
});
|
|
31923
32186
|
const writeDeps = await buildWriteDeps(cached.context, credential2, opts.cursor);
|
|
@@ -31929,7 +32192,7 @@ function defaultDeps(overrides) {
|
|
|
31929
32192
|
}
|
|
31930
32193
|
|
|
31931
32194
|
// src/commands/conversations/sweep.ts
|
|
31932
|
-
import { createHash as
|
|
32195
|
+
import { createHash as createHash6 } from "crypto";
|
|
31933
32196
|
import { Command as Command57, Option as Option54 } from "clipanion";
|
|
31934
32197
|
import { AzureCliCredential as AzureCliCredential2 } from "@azure/identity";
|
|
31935
32198
|
import { TableClient as TableClient9 } from "@azure/data-tables";
|
|
@@ -31939,7 +32202,7 @@ var LEDGER_TABLE_NAME2 = "AgentLedger";
|
|
|
31939
32202
|
var KEY_LIFETIME_DAYS = 30;
|
|
31940
32203
|
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
31941
32204
|
function ownerDigest(nativeUserKey) {
|
|
31942
|
-
return
|
|
32205
|
+
return createHash6("sha256").update(nativeUserKey).digest("base64url");
|
|
31943
32206
|
}
|
|
31944
32207
|
function svcPrincipal(svcRef) {
|
|
31945
32208
|
return svcRef.split(":")[1] ?? "";
|
|
@@ -32219,9 +32482,9 @@ import { Command as Command58, Option as Option55 } from "clipanion";
|
|
|
32219
32482
|
|
|
32220
32483
|
// src/lib/foundry-create.ts
|
|
32221
32484
|
init_errors();
|
|
32222
|
-
import { createHash as
|
|
32485
|
+
import { createHash as createHash7 } from "crypto";
|
|
32223
32486
|
function deriveAccountName(subscriptionId) {
|
|
32224
|
-
const h =
|
|
32487
|
+
const h = createHash7("sha256").update(subscriptionId).digest("hex").slice(0, 12);
|
|
32225
32488
|
return `m8t${h}`;
|
|
32226
32489
|
}
|
|
32227
32490
|
function assertHostedRegion(location) {
|
|
@@ -33160,13 +33423,13 @@ async function kickInstaller(s) {
|
|
|
33160
33423
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
33161
33424
|
|
|
33162
33425
|
// src/lib/bootstrap-status.ts
|
|
33163
|
-
import { createHash as
|
|
33426
|
+
import { createHash as createHash8, randomUUID as randomUUID3 } from "crypto";
|
|
33164
33427
|
import * as fs32 from "fs/promises";
|
|
33165
33428
|
import * as os13 from "os";
|
|
33166
33429
|
import * as path35 from "path";
|
|
33167
33430
|
init_errors();
|
|
33168
33431
|
function deriveStatusSaName(resourceGroup, subscriptionId) {
|
|
33169
|
-
const hex =
|
|
33432
|
+
const hex = createHash8("sha256").update(resourceGroup + subscriptionId).digest("hex").slice(0, 12);
|
|
33170
33433
|
return `m8tinst${hex}`;
|
|
33171
33434
|
}
|
|
33172
33435
|
function statusBlobUrl(saName) {
|
|
@@ -33565,10 +33828,10 @@ function assertManifestSelfConsistent(sealedManifest, expected) {
|
|
|
33565
33828
|
|
|
33566
33829
|
// src/lib/manifest-seal.ts
|
|
33567
33830
|
import * as fs34 from "fs";
|
|
33568
|
-
import { createHash as
|
|
33831
|
+
import { createHash as createHash9 } from "crypto";
|
|
33569
33832
|
init_errors();
|
|
33570
33833
|
function manifestDigestOf(raw) {
|
|
33571
|
-
return `sha256:${
|
|
33834
|
+
return `sha256:${createHash9("sha256").update(raw, "utf8").digest("hex")}`;
|
|
33572
33835
|
}
|
|
33573
33836
|
async function fetchSealedManifest(source, deps = {}) {
|
|
33574
33837
|
const readFile10 = deps.readFile ?? ((p) => fs34.readFileSync(p, "utf8"));
|
|
@@ -34881,7 +35144,7 @@ import { randomUUID as randomUUID5 } from "crypto";
|
|
|
34881
35144
|
import { execFile as execFile2, spawn as spawn7 } from "child_process";
|
|
34882
35145
|
|
|
34883
35146
|
// src/lib/companion-artifact.ts
|
|
34884
|
-
import { createHash as
|
|
35147
|
+
import { createHash as createHash10 } from "crypto";
|
|
34885
35148
|
import { constants } from "fs";
|
|
34886
35149
|
import * as fs37 from "fs/promises";
|
|
34887
35150
|
import * as path40 from "path";
|
|
@@ -34919,7 +35182,7 @@ function canonicalEntry(entry) {
|
|
|
34919
35182
|
`;
|
|
34920
35183
|
}
|
|
34921
35184
|
function artifactTreeSha256(entries) {
|
|
34922
|
-
const hash =
|
|
35185
|
+
const hash = createHash10("sha256");
|
|
34923
35186
|
const ordered = [...entries].sort(
|
|
34924
35187
|
(left, right) => left.path.localeCompare(right.path)
|
|
34925
35188
|
);
|
|
@@ -34989,7 +35252,7 @@ function parseArtifactManifest(value) {
|
|
|
34989
35252
|
};
|
|
34990
35253
|
}
|
|
34991
35254
|
async function sha256File2(filePath) {
|
|
34992
|
-
return
|
|
35255
|
+
return createHash10("sha256").update(await fs37.readFile(filePath)).digest("hex");
|
|
34993
35256
|
}
|
|
34994
35257
|
async function walk2(root, relative4 = "") {
|
|
34995
35258
|
const directory = path40.join(root, ...relative4.split("/").filter(Boolean));
|
|
@@ -35157,7 +35420,7 @@ async function copyArtifactPayload(sourceRoot, targetRoot, manifest) {
|
|
|
35157
35420
|
}
|
|
35158
35421
|
|
|
35159
35422
|
// src/lib/companion-download.ts
|
|
35160
|
-
import { createHash as
|
|
35423
|
+
import { createHash as createHash11 } from "crypto";
|
|
35161
35424
|
import { execFile } from "child_process";
|
|
35162
35425
|
import { createReadStream } from "fs";
|
|
35163
35426
|
import * as fs38 from "fs/promises";
|
|
@@ -35231,7 +35494,7 @@ async function sweepForeignPartials(directory, keep) {
|
|
|
35231
35494
|
}
|
|
35232
35495
|
function sha256File3(filePath) {
|
|
35233
35496
|
return new Promise((resolve6, reject) => {
|
|
35234
|
-
const hash =
|
|
35497
|
+
const hash = createHash11("sha256");
|
|
35235
35498
|
const stream = createReadStream(filePath);
|
|
35236
35499
|
stream.on("error", reject);
|
|
35237
35500
|
stream.on("data", (chunk) => hash.update(chunk));
|