host/js: regenerate all bundles after merging T52, T56, T57, T58
This commit is contained in:
File diff suppressed because it is too large
Load Diff
+16
-16
@@ -28,9 +28,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
||||
mod
|
||||
));
|
||||
|
||||
// host/js/node_modules/partial-json/dist/options.js
|
||||
// node_modules/partial-json/dist/options.js
|
||||
var require_options = __commonJS({
|
||||
"host/js/node_modules/partial-json/dist/options.js"(exports) {
|
||||
"node_modules/partial-json/dist/options.js"(exports) {
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Allow = exports.ALL = exports.COLLECTION = exports.ATOM = exports.SPECIAL = exports.INF = exports._INFINITY = exports.INFINITY = exports.NAN = exports.BOOL = exports.NULL = exports.OBJ = exports.ARR = exports.NUM = exports.STR = void 0;
|
||||
@@ -53,9 +53,9 @@ var require_options = __commonJS({
|
||||
}
|
||||
});
|
||||
|
||||
// host/js/node_modules/partial-json/dist/index.js
|
||||
// node_modules/partial-json/dist/index.js
|
||||
var require_dist = __commonJS({
|
||||
"host/js/node_modules/partial-json/dist/index.js"(exports) {
|
||||
"node_modules/partial-json/dist/index.js"(exports) {
|
||||
"use strict";
|
||||
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === void 0) k2 = k;
|
||||
@@ -264,7 +264,7 @@ var require_dist = __commonJS({
|
||||
}
|
||||
});
|
||||
|
||||
// host/js/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js
|
||||
// node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js
|
||||
var FifoQueue = class {
|
||||
incoming = [];
|
||||
outgoing = [];
|
||||
@@ -375,7 +375,7 @@ function createAssistantMessageEventStream() {
|
||||
return new AssistantMessageEventStream();
|
||||
}
|
||||
|
||||
// host/js/node_modules/@earendil-works/pi-ai/dist/api/lazy.js
|
||||
// node_modules/@earendil-works/pi-ai/dist/api/lazy.js
|
||||
function createSetupErrorMessage(model, error, timestamp) {
|
||||
return {
|
||||
role: "assistant",
|
||||
@@ -435,7 +435,7 @@ function lazyStream(model, setup, observer) {
|
||||
return outer;
|
||||
}
|
||||
|
||||
// host/js/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.js
|
||||
// node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.js
|
||||
function formatThrownValue(value) {
|
||||
if (value instanceof Error)
|
||||
return value.message || value.name;
|
||||
@@ -444,7 +444,7 @@ function formatThrownValue(value) {
|
||||
return String(value);
|
||||
}
|
||||
|
||||
// host/js/node_modules/@earendil-works/pi-ai/dist/utils/models-error.js
|
||||
// node_modules/@earendil-works/pi-ai/dist/utils/models-error.js
|
||||
var ModelsError = class extends Error {
|
||||
code;
|
||||
constructor(code, message, options) {
|
||||
@@ -462,10 +462,10 @@ function withCauseDetail(message, cause) {
|
||||
return `${message}: ${detail}`;
|
||||
}
|
||||
|
||||
// host/js/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js
|
||||
// node_modules/@earendil-works/pi-ai/dist/auth/resolve.js
|
||||
var DEFAULT_OAUTH_MINIMUM_VALIDITY_MS = 5 * 60 * 1e3;
|
||||
|
||||
// host/js/node_modules/@earendil-works/pi-ai/dist/utils/text.js
|
||||
// node_modules/@earendil-works/pi-ai/dist/utils/text.js
|
||||
function contentText(content, separator = "\n") {
|
||||
if (typeof content === "string")
|
||||
return content;
|
||||
@@ -480,7 +480,7 @@ function getSystemMessageText(message) {
|
||||
return parts.filter((part) => part.length > 0).join("\n\n");
|
||||
}
|
||||
|
||||
// host/js/node_modules/@earendil-works/pi-ai/dist/utils/model-operations.js
|
||||
// node_modules/@earendil-works/pi-ai/dist/utils/model-operations.js
|
||||
function getModelType(model) {
|
||||
return model.type ?? "chat";
|
||||
}
|
||||
@@ -510,7 +510,7 @@ function classifierErrorResult(model, error, aborted = false) {
|
||||
};
|
||||
}
|
||||
|
||||
// host/js/node_modules/@earendil-works/pi-ai/dist/models.js
|
||||
// node_modules/@earendil-works/pi-ai/dist/models.js
|
||||
var KNOWN_MODEL_TYPES = { chat: true, image: true, classifier: true };
|
||||
function hasKnownModelType(model) {
|
||||
return Object.hasOwn(KNOWN_MODEL_TYPES, getModelType(model));
|
||||
@@ -626,7 +626,7 @@ function createProvider(input) {
|
||||
return provider;
|
||||
}
|
||||
|
||||
// host/js/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.js
|
||||
// node_modules/@earendil-works/pi-ai/dist/utils/json-parse.js
|
||||
var import_partial_json = __toESM(require_dist(), 1);
|
||||
var VALID_JSON_ESCAPES = /* @__PURE__ */ new Set(['"', "\\", "/", "b", "f", "n", "r", "t"]);
|
||||
function isControlCharacter(char) {
|
||||
@@ -723,7 +723,7 @@ ${json}`
|
||||
}
|
||||
}
|
||||
|
||||
// host/js/node_modules/@earendil-works/pi-ai/dist/utils/streaming-json.js
|
||||
// node_modules/@earendil-works/pi-ai/dist/utils/streaming-json.js
|
||||
var MAX_REPORTED_DEPTH = 32;
|
||||
var ROOT_SLOT = { kind: "root" };
|
||||
var CREDIT_PER_APPEND = 256;
|
||||
@@ -1162,7 +1162,7 @@ function setMember(members, key, value) {
|
||||
}
|
||||
}
|
||||
|
||||
// host/js/node_modules/@earendil-works/pi-ai/dist/providers/faux.js
|
||||
// node_modules/@earendil-works/pi-ai/dist/providers/faux.js
|
||||
var DEFAULT_API = "faux";
|
||||
var DEFAULT_PROVIDER = "faux";
|
||||
var DEFAULT_MODEL_ID = "faux-1";
|
||||
@@ -1634,7 +1634,7 @@ function fauxProvider(options = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
// host/js/p4-test.ts
|
||||
// p4-test.ts
|
||||
var main = `fn greeting(name: &str) -> String { format!("hello {name}") }
|
||||
fn main() {
|
||||
let Some(name) = std::env::args().nth(1) else { std::process::exit(7) };
|
||||
|
||||
@@ -8946,27 +8946,27 @@ var REPLACE_TAKE = { kind: "replace" };
|
||||
var PendingOps = class {
|
||||
#state = EMPTY;
|
||||
/** Queue the ops of one commit. */
|
||||
push(ops2) {
|
||||
if (ops2.length === 0)
|
||||
push(ops3) {
|
||||
if (ops3.length === 0)
|
||||
return;
|
||||
const state = this.#state;
|
||||
if (ops2[0][0] === "r") {
|
||||
this.#state = { kind: "batch", ops: ops2 };
|
||||
if (ops3[0][0] === "r") {
|
||||
this.#state = { kind: "batch", ops: ops3 };
|
||||
return;
|
||||
}
|
||||
switch (state.kind) {
|
||||
case "empty":
|
||||
this.#state = { kind: "batch", ops: ops2 };
|
||||
this.#state = { kind: "batch", ops: ops3 };
|
||||
return;
|
||||
case "batch": {
|
||||
const folding = { kind: "folding", ops: [], leaves: /* @__PURE__ */ new Map() };
|
||||
this.#state = folding;
|
||||
if (this.#fold(state.ops, folding))
|
||||
this.#fold(ops2, folding);
|
||||
this.#fold(ops3, folding);
|
||||
return;
|
||||
}
|
||||
case "folding":
|
||||
this.#fold(ops2, state);
|
||||
this.#fold(ops3, state);
|
||||
return;
|
||||
case "replace":
|
||||
return;
|
||||
@@ -8997,8 +8997,8 @@ var PendingOps = class {
|
||||
}
|
||||
}
|
||||
/** Fold `ops` into `folding`; false once the queue overflowed into `replace`. */
|
||||
#fold(ops2, folding) {
|
||||
for (const op2 of ops2) {
|
||||
#fold(ops3, folding) {
|
||||
for (const op2 of ops3) {
|
||||
switch (op2[0]) {
|
||||
case "r":
|
||||
folding.ops.length = 0;
|
||||
@@ -9267,12 +9267,12 @@ var PathError = class extends Error {
|
||||
this.name = "PathError";
|
||||
}
|
||||
};
|
||||
function apply(target, ops2) {
|
||||
return applyOps(target, ops2);
|
||||
function apply(target, ops3) {
|
||||
return applyOps(target, ops3);
|
||||
}
|
||||
function applyOps(target, ops2) {
|
||||
function applyOps(target, ops3) {
|
||||
let root2 = target;
|
||||
for (const op2 of ops2) {
|
||||
for (const op2 of ops3) {
|
||||
assertValidOp(op2);
|
||||
if (op2[0] === "r") {
|
||||
root2 = op2[1];
|
||||
@@ -9341,14 +9341,14 @@ function applyOps(target, ops2) {
|
||||
}
|
||||
return root2;
|
||||
}
|
||||
function applyImmutable(target, ops2) {
|
||||
return applyImmutableBatches(target, [ops2]);
|
||||
function applyImmutable(target, ops3) {
|
||||
return applyImmutableBatches(target, [ops3]);
|
||||
}
|
||||
function applyImmutableBatches(target, batches) {
|
||||
let root2 = target;
|
||||
const owned = /* @__PURE__ */ new WeakSet();
|
||||
for (const ops2 of batches) {
|
||||
for (const op2 of ops2) {
|
||||
for (const ops3 of batches) {
|
||||
for (const op2 of ops3) {
|
||||
assertValidOp(op2);
|
||||
if (op2[0] === "r") {
|
||||
root2 = op2[1];
|
||||
@@ -9462,10 +9462,10 @@ function encoder() {
|
||||
let nextId = 0;
|
||||
let previous;
|
||||
return {
|
||||
encode(ops2) {
|
||||
encode(ops3) {
|
||||
previous = void 0;
|
||||
const out = [];
|
||||
for (const op2 of ops2) {
|
||||
for (const op2 of ops3) {
|
||||
if (op2[0] === "r") {
|
||||
out.push(op2);
|
||||
seen.clear();
|
||||
@@ -9715,9 +9715,9 @@ var Source = class {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
function unbox(ops2, value2) {
|
||||
function unbox(ops3, value2) {
|
||||
const result = [];
|
||||
for (const op2 of ops2) {
|
||||
for (const op2 of ops3) {
|
||||
if (op2[0] === "r" || op2[1].length === 0)
|
||||
return [["r", value2]];
|
||||
const path = op2[1].slice(1);
|
||||
@@ -9811,8 +9811,8 @@ var Cell = class extends Source {
|
||||
throw notReady(`state ${this.key} (its init has not run)`);
|
||||
const before = this.value;
|
||||
const diff = options.diff ?? sharesStructure(before, value2);
|
||||
const ops2 = diff ? diffRevisions(before, value2) : void 0;
|
||||
this.#publish(this.#tracker.prepareReplace({ v: value2 }), "ops", true, ops2);
|
||||
const ops3 = diff ? diffRevisions(before, value2) : void 0;
|
||||
this.#publish(this.#tracker.prepareReplace({ v: value2 }), "ops", true, ops3);
|
||||
}
|
||||
/**
|
||||
* Installs a migrated value and its schema (reload commit). The caller validated the value and the derivations
|
||||
@@ -9823,7 +9823,7 @@ var Cell = class extends Source {
|
||||
this.#publish(this.#tracker.prepareReplace({ v: value2 }), "reset", false);
|
||||
}
|
||||
/** Adopts this revision and every derived one, then queues all notifications (cell first, then derivations). */
|
||||
#publish(prepared, type, validate2 = true, ops2) {
|
||||
#publish(prepared, type, validate2 = true, ops3) {
|
||||
if (prepared.ops.length === 0 && type === "ops") {
|
||||
this.#tracker.adopt(prepared);
|
||||
return;
|
||||
@@ -9840,7 +9840,7 @@ var Cell = class extends Source {
|
||||
}
|
||||
holdPublications(() => {
|
||||
this.#tracker.adopt(prepared);
|
||||
const published = ops2 !== void 0 && ops2.length > 0 ? ops2 : unbox(prepared.ops, value2);
|
||||
const published = ops3 !== void 0 && ops3.length > 0 ? ops3 : unbox(prepared.ops, value2);
|
||||
this.fanout.emit(type === "reset" ? { type, value: value2 } : { type, ops: published, value: value2 });
|
||||
for (const [derived, next] of candidates)
|
||||
derived.install(next);
|
||||
@@ -9953,9 +9953,9 @@ var Derived = class extends Source {
|
||||
install(next) {
|
||||
const before = this.#value;
|
||||
this.#value = next;
|
||||
const ops2 = before === void 0 || next === void 0 ? [["r", next ?? null]] : diffRevisions(before, next);
|
||||
if (ops2.length > 0)
|
||||
this.fanout.emit({ type: "ops", ops: ops2, value: next });
|
||||
const ops3 = before === void 0 || next === void 0 ? [["r", next ?? null]] : diffRevisions(before, next);
|
||||
if (ops3.length > 0)
|
||||
this.fanout.emit({ type: "ops", ops: ops3, value: next });
|
||||
}
|
||||
};
|
||||
var isSource = (value2) => value2 instanceof Source;
|
||||
@@ -14008,10 +14008,10 @@ var RemoteBinding = class {
|
||||
const target = pending?.values.get(name) ?? this.members.get(name);
|
||||
if (target === void 0)
|
||||
return;
|
||||
const ops2 = target.decoder.decode(frame.ops ?? []);
|
||||
target.value = applyImmutable(target.value, ops2);
|
||||
const ops3 = target.decoder.decode(frame.ops ?? []);
|
||||
target.value = applyImmutable(target.value, ops3);
|
||||
if (target === this.members.get(name))
|
||||
this.#deliver(name, { type: "ops", ops: ops2, value: target.value });
|
||||
this.#deliver(name, { type: "ops", ops: ops3, value: target.value });
|
||||
return;
|
||||
}
|
||||
const fresh = { value: frame.value, decoder: decoder() };
|
||||
@@ -15835,8 +15835,8 @@ var Watch = class extends WatchLifecycle {
|
||||
this.#retired = false;
|
||||
if (lone !== void 0)
|
||||
return lone;
|
||||
const ops2 = batch.kind === "ops" ? batch.ops : [["r", value2]];
|
||||
return { kind: "value", value: value2, ops: ops2, retired };
|
||||
const ops3 = batch.kind === "ops" ? batch.ops : [["r", value2]];
|
||||
return { kind: "value", value: value2, ops: ops3, retired };
|
||||
}
|
||||
/** The pending failure, or the value after one as a root replacement (no ops were kept since the failure). */
|
||||
#nextAfterFailure() {
|
||||
@@ -17601,7 +17601,7 @@ function describe(plan, record2) {
|
||||
const change = plan.change;
|
||||
if (change === void 0 || !publishes(plan))
|
||||
return void 0;
|
||||
const ops2 = change.loaded === void 0 ? EMPTY_OPERATIONS : change.prepared.ops;
|
||||
const ops3 = change.loaded === void 0 ? EMPTY_OPERATIONS : change.prepared.ops;
|
||||
return {
|
||||
type: "document",
|
||||
kind: "change",
|
||||
@@ -17609,11 +17609,11 @@ function describe(plan, record2) {
|
||||
conversationId,
|
||||
version: change.version,
|
||||
value: change.prepared.value,
|
||||
ops: ops2
|
||||
ops: ops3
|
||||
};
|
||||
}
|
||||
function storeHeld(hold, ops2, value2, version) {
|
||||
hold.pending.push(ops2);
|
||||
function storeHeld(hold, ops3, value2, version) {
|
||||
hold.pending.push(ops3);
|
||||
const taken = hold.pending.take();
|
||||
if (taken.kind === "replace")
|
||||
return { content: { version, kind: "base", value: value2 }, ops: [["r", value2]] };
|
||||
@@ -18694,7 +18694,7 @@ var SessionImpl = class {
|
||||
return { kind: "adoption", error };
|
||||
}
|
||||
const deadline = this.#clock() + withinMs;
|
||||
for (const { loaded, ops: ops2, base } of held2) {
|
||||
for (const { loaded, ops: ops3, base } of held2) {
|
||||
const id = loaded.record.id;
|
||||
let hold = this.#holds.get(id);
|
||||
if (hold === void 0) {
|
||||
@@ -18702,7 +18702,7 @@ var SessionImpl = class {
|
||||
hold = { loaded, pending: new PendingOps(), base: false, deadline, unpin };
|
||||
this.#holds.set(id, hold);
|
||||
}
|
||||
hold.pending.push(ops2);
|
||||
hold.pending.push(ops3);
|
||||
if (base)
|
||||
hold.base = true;
|
||||
if (deadline < hold.deadline)
|
||||
@@ -26917,14 +26917,14 @@ var TaskGraphView = class {
|
||||
const mount = this.#mount;
|
||||
if (mount === void 0)
|
||||
return;
|
||||
const ops2 = [];
|
||||
const ops3 = [];
|
||||
for (const [key, record2] of mount.records) {
|
||||
const blocked = this.#blocking.blocked(record2);
|
||||
if (blocked === mount.value.tasks[key]?.blocked)
|
||||
continue;
|
||||
ops2.push(blocked === void 0 ? ["d", ["tasks", key, "blocked"]] : ["s", ["tasks", key, "blocked"], blocked]);
|
||||
ops3.push(blocked === void 0 ? ["d", ["tasks", key, "blocked"]] : ["s", ["tasks", key, "blocked"], blocked]);
|
||||
}
|
||||
publish(mount, ops2, BACKGROUND_CONTEXT, (error) => this.#session.report(error));
|
||||
publish(mount, ops3, BACKGROUND_CONTEXT, (error) => this.#session.report(error));
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
@@ -26948,7 +26948,7 @@ var TaskGraphView = class {
|
||||
}
|
||||
};
|
||||
function advance(mount, publication, context, blocked, report2) {
|
||||
const ops2 = [];
|
||||
const ops3 = [];
|
||||
const changed = /* @__PURE__ */ new Map();
|
||||
const node = (key) => changed.has(key) ? changed.get(key) : mount.value.tasks[key];
|
||||
for (const change of publication.changes) {
|
||||
@@ -26961,7 +26961,7 @@ function advance(mount, publication, context, blocked, report2) {
|
||||
mount.records.delete(key);
|
||||
if (previous === void 0)
|
||||
continue;
|
||||
ops2.push(["d", ["tasks", key]]);
|
||||
ops3.push(["d", ["tasks", key]]);
|
||||
changed.set(key, void 0);
|
||||
continue;
|
||||
}
|
||||
@@ -26970,7 +26970,7 @@ function advance(mount, publication, context, blocked, report2) {
|
||||
const next = nodeOf2(record2, previous?.conversations ?? [], blocked(subject));
|
||||
if (previous !== void 0 && JSON.stringify(next) === JSON.stringify(previous))
|
||||
continue;
|
||||
ops2.push(["s", ["tasks", key], next]);
|
||||
ops3.push(["s", ["tasks", key], next]);
|
||||
changed.set(key, next);
|
||||
}
|
||||
const created = /* @__PURE__ */ new Map();
|
||||
@@ -26983,16 +26983,16 @@ function advance(mount, publication, context, blocked, report2) {
|
||||
}
|
||||
for (const [key, ids] of created) {
|
||||
const conversations = [...node(key).conversations, ...ids].sort((a, b) => a - b);
|
||||
ops2.push(["s", ["tasks", key, "conversations"], conversations]);
|
||||
ops3.push(["s", ["tasks", key, "conversations"], conversations]);
|
||||
}
|
||||
publish(mount, ops2, context, report2);
|
||||
publish(mount, ops3, context, report2);
|
||||
}
|
||||
function publish(mount, ops2, context, report2) {
|
||||
if (ops2.length === 0)
|
||||
function publish(mount, ops3, context, report2) {
|
||||
if (ops3.length === 0)
|
||||
return;
|
||||
mount.value = applyImmutable(mount.value, ops2);
|
||||
mount.value = applyImmutable(mount.value, ops3);
|
||||
const frameContext = withoutAbortSignal(context);
|
||||
const call2 = { kind: "value", value: mount.value, ops: ops2, retired: false };
|
||||
const call2 = { kind: "value", value: mount.value, ops: ops3, retired: false };
|
||||
for (const observer of [...mount.observers])
|
||||
contained(() => observer.advance(call2, frameContext), report2);
|
||||
}
|
||||
@@ -27218,19 +27218,19 @@ function advance2(id, mount, publication, context, report2) {
|
||||
const previous = windowed.value;
|
||||
let entries2 = previous.entries;
|
||||
let before = previous.before;
|
||||
let ops2 = docOps;
|
||||
let ops3 = docOps;
|
||||
if (appended.length > 0) {
|
||||
ops2 = [...docOps, ["p", ["entries"], entries2.length, 0, inserted]];
|
||||
ops3 = [...docOps, ["p", ["entries"], entries2.length, 0, inserted]];
|
||||
entries2 = entries2.concat(appended);
|
||||
if (entries2.length > windowed.max) {
|
||||
const drop = entries2.length - windowed.min;
|
||||
before = entries2[drop - 1].id;
|
||||
entries2 = entries2.slice(drop);
|
||||
ops2.push(["p", ["entries"], 0, drop, []], ["s", ["before"], before]);
|
||||
ops3.push(["p", ["entries"], 0, drop, []], ["s", ["before"], before]);
|
||||
}
|
||||
}
|
||||
windowed.value = view(mount.conversation, entries2, before, mount.docs);
|
||||
const call2 = { kind: "value", value: windowed.value, ops: ops2, retired: false };
|
||||
const call2 = { kind: "value", value: windowed.value, ops: ops3, retired: false };
|
||||
contained(() => windowed.observer.advance(call2, frameContext), report2);
|
||||
}
|
||||
}
|
||||
@@ -30428,14 +30428,51 @@ function eventLog(harness2) {
|
||||
}
|
||||
}
|
||||
|
||||
// extensions.ts
|
||||
// environment.ts
|
||||
var CodingTools2 = { ...CodingTools, tools: CodingTools.tools.map((tool) => ({
|
||||
...tool,
|
||||
execute: (args, api, context) => tool.execute(args, { ...api, env: api.env.forTool(api.callId, tool.name) }, context)
|
||||
})) };
|
||||
var Started = defineDoc({
|
||||
kind: "board.started",
|
||||
version: 1,
|
||||
checkpointWhen: () => false,
|
||||
scope: "conversation",
|
||||
history: "latest",
|
||||
fork: "initial",
|
||||
initial: () => ({})
|
||||
});
|
||||
function conversationChains(harness2, context) {
|
||||
const cache = /* @__PURE__ */ new Map();
|
||||
const chain = (id) => {
|
||||
let result = cache.get(id);
|
||||
if (!result) {
|
||||
result = (async () => {
|
||||
const record2 = await harness2.commit((tx) => tx.conversation(id), context);
|
||||
const up = record2?.owner?.conversationId ?? record2?.parent?.conversationId;
|
||||
const starter = (await harness2.snapshot(Started, id, context))?.by;
|
||||
return [.../* @__PURE__ */ new Set([
|
||||
String(id),
|
||||
...up === void 0 ? [] : await chain(up),
|
||||
...starter === void 0 ? [] : await chain(starter)
|
||||
])];
|
||||
})();
|
||||
cache.set(id, result);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
return chain;
|
||||
}
|
||||
var ops = Deno.core.ops;
|
||||
|
||||
// extensions.ts
|
||||
var ops2 = Deno.core.ops;
|
||||
var encoder4 = new TextEncoder();
|
||||
var decoder4 = new TextDecoder();
|
||||
var ExtensionState = defineDoc({ kind: "sausage.extensions", version: 1, scope: "session", checkpointWhen: () => false, initial: () => ({ good: null, current: null, error: null }) });
|
||||
var Metadata = defineDoc({ kind: "sausage.metadata", version: 1, scope: "conversation", history: "latest", fork: "current", initial: () => ({ label: "", title: "" }), checkpointWhen: () => false });
|
||||
async function file(kind, path, bytes2 = []) {
|
||||
const result = await ops.op_file(kind, path, bytes2);
|
||||
const result = await ops2.op_file(kind, path, bytes2);
|
||||
if (!result.ok) throw Object.assign(new Error(result.error.message), result.error);
|
||||
return result.value;
|
||||
}
|
||||
@@ -30458,14 +30495,14 @@ async function exec(command, options) {
|
||||
program: `extension:${options.extension}`,
|
||||
conversations: options.conversations ?? []
|
||||
} : void 0;
|
||||
const rid = ops.op_exec(command, options.cwd, options.timeout, void 0, options.env, options.conversations, tag);
|
||||
const rid = ops2.op_exec(command, options.cwd, options.timeout, void 0, options.env, options.conversations, tag);
|
||||
const abort = () => Deno.core.close(rid);
|
||||
options.signal?.addEventListener("abort", abort, { once: true });
|
||||
const decoders = { stdout: new TextDecoder(), stderr: new TextDecoder() };
|
||||
const result = { code: 0, stdout: "", stderr: "" };
|
||||
try {
|
||||
for (; ; ) {
|
||||
const chunk = await ops.op_exec_next(rid);
|
||||
const chunk = await ops2.op_exec_next(rid);
|
||||
if (!chunk.stream) {
|
||||
if (chunk.error) throw new Error(chunk.error);
|
||||
result.code = chunk.exitCode;
|
||||
@@ -30492,11 +30529,12 @@ async function git(cwd, ...args) {
|
||||
function registerModules() {
|
||||
const modules = { "@earendil-works/sausage-events": events_exports, "@earendil-works/pi-schema": dist_exports, "@earendil-works/pi-durable": dist_exports3, "@earendil-works/pi-durable/tools": tools_exports, "@earendil-works/pi-ai": dist_exports4, "@earendil-works/pi-ai/models": models_exports, "@earendil-works/chord": dist_exports2, "@earendil-works/chord/context": context_exports };
|
||||
globalThis.__sausage = { modules };
|
||||
ops.op_modules(Object.fromEntries(Object.entries(modules).map(([name, value2]) => [name, Object.keys(value2)])));
|
||||
ops2.op_modules(Object.fromEntries(Object.entries(modules).map(([name, value2]) => [name, Object.keys(value2)])));
|
||||
}
|
||||
async function loadExtensions(harness2, registry2, storage2, models2, context, builtins = []) {
|
||||
registerModules();
|
||||
const eventService = eventLog(() => harness2);
|
||||
const chain = conversationChains(harness2, context);
|
||||
const repo = "/src/sausage";
|
||||
let providers = /* @__PURE__ */ new Map();
|
||||
const resources = /* @__PURE__ */ new Map();
|
||||
@@ -30507,7 +30545,7 @@ async function loadExtensions(harness2, registry2, storage2, models2, context, b
|
||||
let queue2 = Promise.resolve();
|
||||
const publish2 = async () => {
|
||||
await harness2.commit(async (tx) => Object.assign(await tx.doc(ExtensionState), state), context);
|
||||
ops.op_extension_status(JSON.stringify(state));
|
||||
ops2.op_extension_status(JSON.stringify(state));
|
||||
await fs.write("/src/sausage/.git/sausage-last-good", state.good ?? "");
|
||||
};
|
||||
const dispose = async (entries2) => {
|
||||
@@ -30515,7 +30553,7 @@ async function loadExtensions(harness2, registry2, storage2, models2, context, b
|
||||
try {
|
||||
await cleanup();
|
||||
} catch (error) {
|
||||
ops.op_output(`Extension cleanup: ${String(error)}
|
||||
ops2.op_output(`Extension cleanup: ${String(error)}
|
||||
`);
|
||||
}
|
||||
}
|
||||
@@ -30548,6 +30586,7 @@ async function loadExtensions(harness2, registry2, storage2, models2, context, b
|
||||
fs,
|
||||
exec: (command, options) => exec(command, { ...options, extension: name }),
|
||||
git,
|
||||
chain,
|
||||
implement: (api, value2) => {
|
||||
staged.set(api.name, value2);
|
||||
},
|
||||
@@ -30570,12 +30609,12 @@ async function loadExtensions(harness2, registry2, storage2, models2, context, b
|
||||
onClose: (cb) => close.push(cb),
|
||||
notice: (message) => {
|
||||
state.notice = `${name}: ${message}`;
|
||||
ops.op_extension_status(JSON.stringify(state));
|
||||
ops.op_output(`${name}: ${message}
|
||||
ops2.op_extension_status(JSON.stringify(state));
|
||||
ops2.op_output(`${name}: ${message}
|
||||
`);
|
||||
if (!notices.has(message)) {
|
||||
notices.add(message);
|
||||
void harness2.commit((tx) => eventService.emit(tx, NoticeEvent, { extension: name, message, level: "warning" }), context).catch((error) => ops.op_output(`Recording a notice failed: ${String(error)}
|
||||
void harness2.commit((tx) => eventService.emit(tx, NoticeEvent, { extension: name, message, level: "warning" }), context).catch((error) => ops2.op_output(`Recording a notice failed: ${String(error)}
|
||||
`));
|
||||
}
|
||||
}
|
||||
@@ -30654,7 +30693,7 @@ async function loadExtensions(harness2, registry2, storage2, models2, context, b
|
||||
tip = await git(repo, "rev-parse", "refs/heads/main");
|
||||
} catch (error) {
|
||||
state.error = String(error);
|
||||
ops.op_extension_status(JSON.stringify(state));
|
||||
ops2.op_extension_status(JSON.stringify(state));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -30663,8 +30702,8 @@ async function loadExtensions(harness2, registry2, storage2, models2, context, b
|
||||
if (error.code === "not_found") settings = {};
|
||||
else {
|
||||
state.notice = `Settings: ${String(error)}`;
|
||||
ops.op_extension_status(JSON.stringify(state));
|
||||
ops.op_output(`${state.notice}
|
||||
ops2.op_extension_status(JSON.stringify(state));
|
||||
ops2.op_output(`${state.notice}
|
||||
`);
|
||||
}
|
||||
}
|
||||
@@ -30680,11 +30719,11 @@ Last good: ${fallback}` : failed;
|
||||
await publish2();
|
||||
};
|
||||
const enqueue2 = () => queue2 = queue2.then(reload);
|
||||
const rid = ops.op_watch([`${repo}/.git/refs/heads/main`, `${repo}/.git/packed-refs`, `${repo}/settings.json`]);
|
||||
const rid = ops2.op_watch([`${repo}/.git/refs/heads/main`, `${repo}/.git/packed-refs`, `${repo}/settings.json`]);
|
||||
await enqueue2();
|
||||
const pending = (async () => {
|
||||
while (active) {
|
||||
await ops.op_watch_next(rid);
|
||||
await ops2.op_watch_next(rid);
|
||||
if (active) await enqueue2();
|
||||
}
|
||||
})();
|
||||
@@ -31702,9 +31741,9 @@ var call = async (tool, args) => {
|
||||
return result;
|
||||
};
|
||||
var submit = async (id) => {
|
||||
const { Started } = await import(`file:///run/sausage/extensions/${await fs.read("/src/sausage/.git/sausage-last-good")}/extensions/messages/addresses.ts`);
|
||||
const { Started: Started2 } = await import(`file:///run/sausage/extensions/${await fs.read("/src/sausage/.git/sausage-last-good")}/extensions/messages/addresses.ts`);
|
||||
await harness.commit(async (tx) => {
|
||||
(await tx.doc(Started, id)).by = root.id;
|
||||
(await tx.doc(Started2, id)).by = root.id;
|
||||
}, BACKGROUND_CONTEXT);
|
||||
const child = await harness.conversation(id, BACKGROUND_CONTEXT);
|
||||
await (await child.submit({ type: "input", content: `CALL ${JSON.stringify({ tool: "workspace", args: { action: "submit", divergence: "None" } })}` }, BACKGROUND_CONTEXT)).wait(BACKGROUND_CONTEXT);
|
||||
|
||||
Reference in New Issue
Block a user