vibes-diy 14.3.345 → 14.3.347
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/cli/cmd-evento.d.ts +18 -18
- package/cli/cmds/run/backend-worker/run-backend-entry.js +198 -151
- package/cli/cmds/run/run-bundle.js +205 -158
- package/package.json +8 -8
package/cli/cmd-evento.d.ts
CHANGED
|
@@ -617,6 +617,12 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
|
|
|
617
617
|
apiUrl: string;
|
|
618
618
|
idleTimeoutMs?: number | undefined;
|
|
619
619
|
}, {
|
|
620
|
+
type: "vibes.diy.res-error";
|
|
621
|
+
error: {
|
|
622
|
+
message: string;
|
|
623
|
+
code: "max-app-slugs-reached";
|
|
624
|
+
};
|
|
625
|
+
} | {
|
|
620
626
|
appSlug: string;
|
|
621
627
|
ownerHandle: string;
|
|
622
628
|
mode: "dev" | "production";
|
|
@@ -669,12 +675,6 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
|
|
|
669
675
|
message: string;
|
|
670
676
|
code: "app-slug-invalid";
|
|
671
677
|
};
|
|
672
|
-
} | {
|
|
673
|
-
type: "vibes.diy.res-error";
|
|
674
|
-
error: {
|
|
675
|
-
message: string;
|
|
676
|
-
code: "max-app-slugs-reached";
|
|
677
|
-
};
|
|
678
678
|
} | {
|
|
679
679
|
type: "vibes.diy.res-error";
|
|
680
680
|
error: {
|
|
@@ -771,6 +771,12 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
|
|
|
771
771
|
style?: string | undefined;
|
|
772
772
|
fastPass?: boolean | undefined;
|
|
773
773
|
}, {
|
|
774
|
+
type: "vibes.diy.res-error";
|
|
775
|
+
error: {
|
|
776
|
+
message: string;
|
|
777
|
+
code: "max-app-slugs-reached";
|
|
778
|
+
};
|
|
779
|
+
} | {
|
|
774
780
|
appSlug: string;
|
|
775
781
|
ownerHandle: string;
|
|
776
782
|
mode: "dev" | "production";
|
|
@@ -823,12 +829,6 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
|
|
|
823
829
|
message: string;
|
|
824
830
|
code: "app-slug-invalid";
|
|
825
831
|
};
|
|
826
|
-
} | {
|
|
827
|
-
type: "vibes.diy.res-error";
|
|
828
|
-
error: {
|
|
829
|
-
message: string;
|
|
830
|
-
code: "max-app-slugs-reached";
|
|
831
|
-
};
|
|
832
832
|
} | {
|
|
833
833
|
type: "vibes.diy.res-error";
|
|
834
834
|
error: {
|
|
@@ -913,6 +913,12 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
|
|
|
913
913
|
builderModel?: string | undefined;
|
|
914
914
|
apiKey?: string | undefined;
|
|
915
915
|
}, {
|
|
916
|
+
type: "vibes.diy.res-error";
|
|
917
|
+
error: {
|
|
918
|
+
message: string;
|
|
919
|
+
code: "max-app-slugs-reached";
|
|
920
|
+
};
|
|
921
|
+
} | {
|
|
916
922
|
appSlug: string;
|
|
917
923
|
ownerHandle: string;
|
|
918
924
|
mode: "dev" | "production";
|
|
@@ -965,12 +971,6 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
|
|
|
965
971
|
message: string;
|
|
966
972
|
code: "app-slug-invalid";
|
|
967
973
|
};
|
|
968
|
-
} | {
|
|
969
|
-
type: "vibes.diy.res-error";
|
|
970
|
-
error: {
|
|
971
|
-
message: string;
|
|
972
|
-
code: "max-app-slugs-reached";
|
|
973
|
-
};
|
|
974
974
|
} | {
|
|
975
975
|
type: "vibes.diy.res-error";
|
|
976
976
|
error: {
|
|
@@ -211958,7 +211958,8 @@ var evtAssetSafety = lazyType(
|
|
|
211958
211958
|
appSlug: "string",
|
|
211959
211959
|
// Who uploaded it — the recipient of a blocked/gave-up notification.
|
|
211960
211960
|
userId: "string",
|
|
211961
|
-
model: "string"
|
|
211961
|
+
model: "string",
|
|
211962
|
+
"origin?": "'upload' | 'generation'"
|
|
211962
211963
|
})
|
|
211963
211964
|
);
|
|
211964
211965
|
var reqAssetSafetyStatus = lazyType(
|
|
@@ -263769,7 +263770,7 @@ init_esm();
|
|
|
263769
263770
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
263770
263771
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
263771
263772
|
init_performance2();
|
|
263772
|
-
var AGENT_SESSION_INSTRUCTION_VERSION = "2026-11-17.
|
|
263773
|
+
var AGENT_SESSION_INSTRUCTION_VERSION = "2026-11-17.3";
|
|
263773
263774
|
var GROUP_READY_SHAPE = "each person's own records live on a channel named by their handle, granted on every write they make, so the app opens on their tree with nothing to create first, while a second or shared thing is its own document the person's own action writes; the rules key on user.userHandle, the tree's handle or that object's own creator, and the records are shaped so a friend can be let in later by a member record, so the app owner stands where everyone else stands.";
|
|
263774
263775
|
var INVITE_SCREEN_WHEN = "The invite screen, the platform's HandleInput writing a membership into the person's tree or object, is part of the first build when the ask names other people, sharing, a group, a team, a family, a we or an our, or a person by name, and when the app is a person's own collection, where adding a friend is how the collection is shared";
|
|
263775
263776
|
var SHARING_BASELINE = "Sharing is the baseline: every first build that is not privacy-sensitive ships a way to share on its first screen, specified asks and asks that name nobody else included, and the shape follows what one record is \u2014 a record a person keeps for their own life (a check-in, an entry, a line in a list) belongs to a collection that is private to its person and shared whole by the add-a-friend control on the first screen, which grants the friend it names the collection's channel; a piece made for readers (a post, an article, a gallery piece) carries a one-tap publish that puts it on its own channel, shared with everyone who can open the app, the drafting ritual readers already know; a thing made to be seen the moment it exists (a character in a cast, a caption) lands on an always-on shared channel everyone who opens the app can see. The person's own words move the dial: asking to pick which items each friend sees adds that choice to the add-a-friend control, and asking for drafts or publish brings the per-item step to any record. The create_vibe brief names the shape. A collection's add-a-friend control is its first-screen share; in the other two shapes the invite screen may wait for an option. Only a privacy-sensitive app keeps its sharing off until the person turns it on.";
|
|
@@ -263811,6 +263812,7 @@ A report is the authority for what its own work changed: it names the files, whe
|
|
|
263811
263812
|
among them, and the version saved, so reading the app again to confirm what a report just told you spends
|
|
263812
263813
|
a round and learns nothing. Read when you have a question the report does not answer.
|
|
263813
263814
|
After a platform report arrives, speak from the current outcome and any work still outstanding; leave superseded waiting states, retry histories and attempt counts in the journal.
|
|
263815
|
+
A message the person sent while a build ran can reach you beside its [build result]: the one reply you write tells the result and answers them in a clause, so they get one message.
|
|
263814
263816
|
|
|
263815
263817
|
Three kinds of tool answer. A read answers with what it found. A finishing action \u2014 set_app_style, put_doc,
|
|
263816
263818
|
delete_doc, validate, the staging that edit_file and write_file do \u2014 answers \`ok\` when it has finished, and
|
|
@@ -268616,9 +268618,16 @@ async function runLlmToolLoop(loopArgs) {
|
|
|
268616
268618
|
}
|
|
268617
268619
|
nextMessages.push(...images);
|
|
268618
268620
|
if (remainingBudget(budget, now3) <= 0) return Result.Err("LLM tool loop deadline exceeded before resumed dispatch");
|
|
268619
|
-
|
|
268621
|
+
let nextRequest = { ...currentRequest, messages: nextMessages };
|
|
268622
|
+
if (args3.session?.fold !== void 0) {
|
|
268623
|
+
const folded = await args3.session.fold();
|
|
268624
|
+
if (folded.isErr()) return await endQuietly(folded.Err()) ?? Result.Err(folded.Err());
|
|
268625
|
+
const joined = folded.Ok();
|
|
268626
|
+
if (joined !== void 0 && joined.length > 0)
|
|
268627
|
+
nextRequest = { ...currentRequest, messages: withRequestFrame(nextMessages, joined, args3.session.head()) };
|
|
268628
|
+
}
|
|
268620
268629
|
if (args3.session !== void 0) {
|
|
268621
|
-
const checkpoint = await args3.session.checkpoint(
|
|
268630
|
+
const checkpoint = await args3.session.checkpoint(nextRequest.messages);
|
|
268622
268631
|
if (checkpoint.isErr()) return await endQuietly(checkpoint.Err()) ?? Result.Err(checkpoint.Err());
|
|
268623
268632
|
budget = createLlmToolLoopBudget({
|
|
268624
268633
|
totalBudgetMs: args3.session.dispatchBudgetMs,
|
|
@@ -268659,6 +268668,143 @@ function createLlmToolLoopStream(args3) {
|
|
|
268659
268668
|
}
|
|
268660
268669
|
__name(createLlmToolLoopStream, "createLlmToolLoopStream");
|
|
268661
268670
|
|
|
268671
|
+
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/turn-terminal.ts
|
|
268672
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
268673
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
268674
|
+
init_performance2();
|
|
268675
|
+
|
|
268676
|
+
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/codegen-build-lock.ts
|
|
268677
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
268678
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
268679
|
+
init_performance2();
|
|
268680
|
+
var BUILD_LOCK_DEADLINE_MS = 6e5;
|
|
268681
|
+
var PERSIST_TAIL_MS = 12e4;
|
|
268682
|
+
var AGENT_TURN_CEILING_MS = 9e5;
|
|
268683
|
+
var INITIAL_DISPATCH_ALLOWANCE_MS = 12e4;
|
|
268684
|
+
var OPEN_TURN_DEADLINE_MS = Math.max(BUILD_LOCK_DEADLINE_MS, INITIAL_DISPATCH_ALLOWANCE_MS + AGENT_TURN_CEILING_MS) + PERSIST_TAIL_MS;
|
|
268685
|
+
var locksByScope = /* @__PURE__ */ new WeakMap();
|
|
268686
|
+
function locksFor(scope2) {
|
|
268687
|
+
let locks = locksByScope.get(scope2);
|
|
268688
|
+
if (locks === void 0) {
|
|
268689
|
+
locks = /* @__PURE__ */ new Map();
|
|
268690
|
+
locksByScope.set(scope2, locks);
|
|
268691
|
+
}
|
|
268692
|
+
return locks;
|
|
268693
|
+
}
|
|
268694
|
+
__name(locksFor, "locksFor");
|
|
268695
|
+
function peekBuildLockEntry(scope2, chatId, clock = {}) {
|
|
268696
|
+
const now3 = (clock.now ?? Date.now)();
|
|
268697
|
+
const locks = locksFor(scope2);
|
|
268698
|
+
const entry2 = locks.get(chatId);
|
|
268699
|
+
if (entry2 === void 0) return void 0;
|
|
268700
|
+
if (now3 - entry2.acquiredAtMs > BUILD_LOCK_DEADLINE_MS) {
|
|
268701
|
+
locks.delete(chatId);
|
|
268702
|
+
return void 0;
|
|
268703
|
+
}
|
|
268704
|
+
return { promptId: entry2.promptId, wakesOnTerminal: entry2.wakesOnTerminal };
|
|
268705
|
+
}
|
|
268706
|
+
__name(peekBuildLockEntry, "peekBuildLockEntry");
|
|
268707
|
+
function peekBuildLock(scope2, chatId, clock = {}) {
|
|
268708
|
+
return peekBuildLockEntry(scope2, chatId, clock)?.promptId;
|
|
268709
|
+
}
|
|
268710
|
+
__name(peekBuildLock, "peekBuildLock");
|
|
268711
|
+
function acquireBuildLock(args3) {
|
|
268712
|
+
const clock = args3.clock ?? {};
|
|
268713
|
+
const held2 = peekBuildLock(args3.scope, args3.chatId, clock);
|
|
268714
|
+
if (held2 !== void 0) return { acquired: false, inFlightPromptId: held2 };
|
|
268715
|
+
locksFor(args3.scope).set(args3.chatId, {
|
|
268716
|
+
promptId: args3.promptId,
|
|
268717
|
+
acquiredAtMs: (clock.now ?? Date.now)(),
|
|
268718
|
+
wakesOnTerminal: args3.wakesOnTerminal === true
|
|
268719
|
+
});
|
|
268720
|
+
return { acquired: true };
|
|
268721
|
+
}
|
|
268722
|
+
__name(acquireBuildLock, "acquireBuildLock");
|
|
268723
|
+
function releaseBuildLock(scope2, chatId, promptId) {
|
|
268724
|
+
const locks = locksFor(scope2);
|
|
268725
|
+
if (locks.get(chatId)?.promptId === promptId) locks.delete(chatId);
|
|
268726
|
+
}
|
|
268727
|
+
__name(releaseBuildLock, "releaseBuildLock");
|
|
268728
|
+
function acquireTurnBuildLock(args3) {
|
|
268729
|
+
if (args3.movesFilesystem === false) return { acquired: true };
|
|
268730
|
+
return acquireBuildLock({
|
|
268731
|
+
scope: args3.vctx.connections,
|
|
268732
|
+
chatId: args3.chatId,
|
|
268733
|
+
promptId: args3.promptId,
|
|
268734
|
+
wakesOnTerminal: args3.wakesOnTerminal
|
|
268735
|
+
});
|
|
268736
|
+
}
|
|
268737
|
+
__name(acquireTurnBuildLock, "acquireTurnBuildLock");
|
|
268738
|
+
function releaseTurnBuildLock(vctx, chatId, promptId) {
|
|
268739
|
+
releaseBuildLock(vctx.connections, chatId, promptId);
|
|
268740
|
+
}
|
|
268741
|
+
__name(releaseTurnBuildLock, "releaseTurnBuildLock");
|
|
268742
|
+
|
|
268743
|
+
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/turn-terminal.ts
|
|
268744
|
+
var waitersByScope = /* @__PURE__ */ new WeakMap();
|
|
268745
|
+
function waitersFor(scope2) {
|
|
268746
|
+
let waiters = waitersByScope.get(scope2);
|
|
268747
|
+
if (waiters === void 0) {
|
|
268748
|
+
waiters = /* @__PURE__ */ new Map();
|
|
268749
|
+
waitersByScope.set(scope2, waiters);
|
|
268750
|
+
}
|
|
268751
|
+
return waiters;
|
|
268752
|
+
}
|
|
268753
|
+
__name(waitersFor, "waitersFor");
|
|
268754
|
+
function keyOf2(chatId, promptId) {
|
|
268755
|
+
return `${chatId}\0${promptId}`;
|
|
268756
|
+
}
|
|
268757
|
+
__name(keyOf2, "keyOf");
|
|
268758
|
+
function registerTurnTerminalWaiter(args3) {
|
|
268759
|
+
const waiters = waitersFor(args3.scope);
|
|
268760
|
+
const key = keyOf2(args3.chatId, args3.promptId);
|
|
268761
|
+
const setTimer = args3.setTimer ?? ((fn4, ms) => setTimeout(fn4, ms));
|
|
268762
|
+
const clearTimer = args3.clearTimer ?? ((handle) => clearTimeout(handle));
|
|
268763
|
+
let resolveLanding;
|
|
268764
|
+
const promise2 = new Promise((resolve3) => {
|
|
268765
|
+
resolveLanding = resolve3;
|
|
268766
|
+
});
|
|
268767
|
+
let done2 = false;
|
|
268768
|
+
const finish = /* @__PURE__ */ __name((landing2) => {
|
|
268769
|
+
if (done2) return;
|
|
268770
|
+
done2 = true;
|
|
268771
|
+
clearTimer(timer);
|
|
268772
|
+
if (waiters.get(key)?.settle === entry2.settle) waiters.delete(key);
|
|
268773
|
+
resolveLanding(landing2);
|
|
268774
|
+
}, "finish");
|
|
268775
|
+
const entry2 = { promptId: args3.promptId, settle: /* @__PURE__ */ __name((landing2) => finish(landing2), "settle") };
|
|
268776
|
+
const previous = waiters.get(key);
|
|
268777
|
+
waiters.set(key, entry2);
|
|
268778
|
+
const timer = setTimer(() => finish({ kind: "deadline" }), args3.deadlineMs ?? BUILD_LOCK_DEADLINE_MS);
|
|
268779
|
+
previous?.settle({ kind: "deadline" });
|
|
268780
|
+
return {
|
|
268781
|
+
chatId: args3.chatId,
|
|
268782
|
+
promptId: args3.promptId,
|
|
268783
|
+
promise: promise2,
|
|
268784
|
+
cancel: /* @__PURE__ */ __name(() => {
|
|
268785
|
+
if (done2) return;
|
|
268786
|
+
done2 = true;
|
|
268787
|
+
clearTimer(timer);
|
|
268788
|
+
if (waiters.get(key)?.settle === entry2.settle) waiters.delete(key);
|
|
268789
|
+
resolveLanding({ kind: "deadline" });
|
|
268790
|
+
}, "cancel")
|
|
268791
|
+
};
|
|
268792
|
+
}
|
|
268793
|
+
__name(registerTurnTerminalWaiter, "registerTurnTerminalWaiter");
|
|
268794
|
+
function settleTurnTerminal({
|
|
268795
|
+
scope: scope2,
|
|
268796
|
+
chatId,
|
|
268797
|
+
promptId,
|
|
268798
|
+
outcome
|
|
268799
|
+
}) {
|
|
268800
|
+
const entry2 = waitersFor(scope2).get(keyOf2(chatId, promptId));
|
|
268801
|
+
if (entry2 === void 0) return { consumed: false };
|
|
268802
|
+
entry2.settle({ kind: "settled", outcome });
|
|
268803
|
+
return { consumed: true };
|
|
268804
|
+
}
|
|
268805
|
+
__name(settleTurnTerminal, "settleTurnTerminal");
|
|
268806
|
+
var BUILD_LANDING_PREFIX = "[build result]";
|
|
268807
|
+
|
|
268662
268808
|
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/agent-session.ts
|
|
268663
268809
|
init_lazy_type();
|
|
268664
268810
|
var sessionInput = lazyType(() => type({ id: "string", messages: LLMMessage.array() }));
|
|
@@ -268804,6 +268950,12 @@ function isHeldQueuedEditReceipt(handle, handles) {
|
|
|
268804
268950
|
return handles.some((other) => other.id === build2 && (other.state !== "settled" || other.awaitingPicture === true));
|
|
268805
268951
|
}
|
|
268806
268952
|
__name(isHeldQueuedEditReceipt, "isHeldQueuedEditReceipt");
|
|
268953
|
+
function isBuildResultMessage(message5) {
|
|
268954
|
+
if (message5.role !== "user" || Array.isArray(message5.content) === false) return false;
|
|
268955
|
+
const first = message5.content[0];
|
|
268956
|
+
return first?.type === "text" && first.text.startsWith(BUILD_LANDING_PREFIX);
|
|
268957
|
+
}
|
|
268958
|
+
__name(isBuildResultMessage, "isBuildResultMessage");
|
|
268807
268959
|
function releasePictureWaits(snapshot2) {
|
|
268808
268960
|
if (snapshot2.handles.some((handle) => handle.awaitingPicture === true) === false) return snapshot2;
|
|
268809
268961
|
return { ...snapshot2, handles: snapshot2.handles.map(withoutPictureWait) };
|
|
@@ -268836,6 +268988,7 @@ function createAgentSession(args3) {
|
|
|
268836
268988
|
let head;
|
|
268837
268989
|
let takenInputs = /* @__PURE__ */ new Set();
|
|
268838
268990
|
let takenHandles = /* @__PURE__ */ new Set();
|
|
268991
|
+
let resultStep = false;
|
|
268839
268992
|
let revision = args3.revision ?? 0;
|
|
268840
268993
|
function update(change, admit) {
|
|
268841
268994
|
const operation = serial2.then(async () => {
|
|
@@ -268972,14 +269125,16 @@ function createAgentSession(args3) {
|
|
|
268972
269125
|
const saved = await serial2;
|
|
268973
269126
|
if (failure4 !== void 0) return Result.Err(failure4);
|
|
268974
269127
|
if (saved.isErr()) return Result.Err(saved.Err());
|
|
269128
|
+
const folding = state4.inbox.some((input3) => input3.messages.some(isPersonMessage));
|
|
269129
|
+
const heldBy = folding ? state4.handles.map(withoutPictureWait) : state4.handles;
|
|
268975
269130
|
const ready = state4.handles.filter(
|
|
268976
|
-
(handle) => handle.state === "settled" && handle.awaitingPicture !== true && isHeldQueuedEditReceipt(handle,
|
|
269131
|
+
(handle) => handle.state === "settled" && (handle.awaitingPicture !== true || folding) && isHeldQueuedEditReceipt(handle, heldBy) === false
|
|
268977
269132
|
);
|
|
268978
269133
|
if (state4.inbox.length > 0 || ready.length > 0) {
|
|
268979
269134
|
takenInputs = new Set(state4.inbox.map((input3) => input3.id));
|
|
268980
269135
|
takenHandles = new Set(ready.map((handle) => handle.id));
|
|
268981
269136
|
notify2 = void 0;
|
|
268982
|
-
|
|
269137
|
+
const batch = [
|
|
268983
269138
|
...state4.inbox.flatMap((input3) => input3.messages),
|
|
268984
269139
|
...ready.flatMap((handle) => [
|
|
268985
269140
|
{
|
|
@@ -268988,7 +269143,9 @@ function createAgentSession(args3) {
|
|
|
268988
269143
|
},
|
|
268989
269144
|
...handle.picture === void 0 ? [] : [toolImageMessage("build result", handle.picture)]
|
|
268990
269145
|
])
|
|
268991
|
-
]
|
|
269146
|
+
];
|
|
269147
|
+
resultStep = batch.some(isPersonMessage) === false && batch.some(isBuildResultMessage);
|
|
269148
|
+
return Result.Ok(batch);
|
|
268992
269149
|
}
|
|
268993
269150
|
if (state4.handles.some((handle) => isDormantParkedBuild(handle) === false)) {
|
|
268994
269151
|
await changed;
|
|
@@ -269012,6 +269169,17 @@ function createAgentSession(args3) {
|
|
|
269012
269169
|
}
|
|
269013
269170
|
return failure4 === void 0 ? Result.Ok(void 0) : Result.Err(failure4);
|
|
269014
269171
|
},
|
|
269172
|
+
async takeWaiting() {
|
|
269173
|
+
if (resultStep === false || stopped) return Result.Ok(void 0);
|
|
269174
|
+
const saved = await serial2;
|
|
269175
|
+
if (failure4 !== void 0) return Result.Err(failure4);
|
|
269176
|
+
if (saved.isErr()) return Result.Err(saved.Err());
|
|
269177
|
+
const waiting = state4.inbox.filter((input3) => takenInputs.has(input3.id) === false);
|
|
269178
|
+
if (waiting.some((input3) => input3.messages.some(isPersonMessage)) === false) return Result.Ok(void 0);
|
|
269179
|
+
for (const input3 of waiting) takenInputs.add(input3.id);
|
|
269180
|
+
resultStep = false;
|
|
269181
|
+
return Result.Ok(waiting.flatMap((input3) => input3.messages));
|
|
269182
|
+
},
|
|
269015
269183
|
async settleIdle() {
|
|
269016
269184
|
if (state4.status === "idle" || hasPendingWork(state4)) return Result.Ok(false);
|
|
269017
269185
|
let wrote = false;
|
|
@@ -273231,73 +273399,6 @@ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
|
273231
273399
|
init_performance2();
|
|
273232
273400
|
init_esm();
|
|
273233
273401
|
|
|
273234
|
-
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/codegen-build-lock.ts
|
|
273235
|
-
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
273236
|
-
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
273237
|
-
init_performance2();
|
|
273238
|
-
var BUILD_LOCK_DEADLINE_MS = 6e5;
|
|
273239
|
-
var PERSIST_TAIL_MS = 12e4;
|
|
273240
|
-
var AGENT_TURN_CEILING_MS = 9e5;
|
|
273241
|
-
var INITIAL_DISPATCH_ALLOWANCE_MS = 12e4;
|
|
273242
|
-
var OPEN_TURN_DEADLINE_MS = Math.max(BUILD_LOCK_DEADLINE_MS, INITIAL_DISPATCH_ALLOWANCE_MS + AGENT_TURN_CEILING_MS) + PERSIST_TAIL_MS;
|
|
273243
|
-
var locksByScope = /* @__PURE__ */ new WeakMap();
|
|
273244
|
-
function locksFor(scope2) {
|
|
273245
|
-
let locks = locksByScope.get(scope2);
|
|
273246
|
-
if (locks === void 0) {
|
|
273247
|
-
locks = /* @__PURE__ */ new Map();
|
|
273248
|
-
locksByScope.set(scope2, locks);
|
|
273249
|
-
}
|
|
273250
|
-
return locks;
|
|
273251
|
-
}
|
|
273252
|
-
__name(locksFor, "locksFor");
|
|
273253
|
-
function peekBuildLockEntry(scope2, chatId, clock = {}) {
|
|
273254
|
-
const now3 = (clock.now ?? Date.now)();
|
|
273255
|
-
const locks = locksFor(scope2);
|
|
273256
|
-
const entry2 = locks.get(chatId);
|
|
273257
|
-
if (entry2 === void 0) return void 0;
|
|
273258
|
-
if (now3 - entry2.acquiredAtMs > BUILD_LOCK_DEADLINE_MS) {
|
|
273259
|
-
locks.delete(chatId);
|
|
273260
|
-
return void 0;
|
|
273261
|
-
}
|
|
273262
|
-
return { promptId: entry2.promptId, wakesOnTerminal: entry2.wakesOnTerminal };
|
|
273263
|
-
}
|
|
273264
|
-
__name(peekBuildLockEntry, "peekBuildLockEntry");
|
|
273265
|
-
function peekBuildLock(scope2, chatId, clock = {}) {
|
|
273266
|
-
return peekBuildLockEntry(scope2, chatId, clock)?.promptId;
|
|
273267
|
-
}
|
|
273268
|
-
__name(peekBuildLock, "peekBuildLock");
|
|
273269
|
-
function acquireBuildLock(args3) {
|
|
273270
|
-
const clock = args3.clock ?? {};
|
|
273271
|
-
const held2 = peekBuildLock(args3.scope, args3.chatId, clock);
|
|
273272
|
-
if (held2 !== void 0) return { acquired: false, inFlightPromptId: held2 };
|
|
273273
|
-
locksFor(args3.scope).set(args3.chatId, {
|
|
273274
|
-
promptId: args3.promptId,
|
|
273275
|
-
acquiredAtMs: (clock.now ?? Date.now)(),
|
|
273276
|
-
wakesOnTerminal: args3.wakesOnTerminal === true
|
|
273277
|
-
});
|
|
273278
|
-
return { acquired: true };
|
|
273279
|
-
}
|
|
273280
|
-
__name(acquireBuildLock, "acquireBuildLock");
|
|
273281
|
-
function releaseBuildLock(scope2, chatId, promptId) {
|
|
273282
|
-
const locks = locksFor(scope2);
|
|
273283
|
-
if (locks.get(chatId)?.promptId === promptId) locks.delete(chatId);
|
|
273284
|
-
}
|
|
273285
|
-
__name(releaseBuildLock, "releaseBuildLock");
|
|
273286
|
-
function acquireTurnBuildLock(args3) {
|
|
273287
|
-
if (args3.movesFilesystem === false) return { acquired: true };
|
|
273288
|
-
return acquireBuildLock({
|
|
273289
|
-
scope: args3.vctx.connections,
|
|
273290
|
-
chatId: args3.chatId,
|
|
273291
|
-
promptId: args3.promptId,
|
|
273292
|
-
wakesOnTerminal: args3.wakesOnTerminal
|
|
273293
|
-
});
|
|
273294
|
-
}
|
|
273295
|
-
__name(acquireTurnBuildLock, "acquireTurnBuildLock");
|
|
273296
|
-
function releaseTurnBuildLock(vctx, chatId, promptId) {
|
|
273297
|
-
releaseBuildLock(vctx.connections, chatId, promptId);
|
|
273298
|
-
}
|
|
273299
|
-
__name(releaseTurnBuildLock, "releaseTurnBuildLock");
|
|
273300
|
-
|
|
273301
273402
|
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/build-ledger-store.ts
|
|
273302
273403
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
273303
273404
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
@@ -273645,74 +273746,6 @@ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
|
273645
273746
|
init_performance2();
|
|
273646
273747
|
init_esm();
|
|
273647
273748
|
|
|
273648
|
-
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/turn-terminal.ts
|
|
273649
|
-
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
273650
|
-
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
273651
|
-
init_performance2();
|
|
273652
|
-
var waitersByScope = /* @__PURE__ */ new WeakMap();
|
|
273653
|
-
function waitersFor(scope2) {
|
|
273654
|
-
let waiters = waitersByScope.get(scope2);
|
|
273655
|
-
if (waiters === void 0) {
|
|
273656
|
-
waiters = /* @__PURE__ */ new Map();
|
|
273657
|
-
waitersByScope.set(scope2, waiters);
|
|
273658
|
-
}
|
|
273659
|
-
return waiters;
|
|
273660
|
-
}
|
|
273661
|
-
__name(waitersFor, "waitersFor");
|
|
273662
|
-
function keyOf2(chatId, promptId) {
|
|
273663
|
-
return `${chatId}\0${promptId}`;
|
|
273664
|
-
}
|
|
273665
|
-
__name(keyOf2, "keyOf");
|
|
273666
|
-
function registerTurnTerminalWaiter(args3) {
|
|
273667
|
-
const waiters = waitersFor(args3.scope);
|
|
273668
|
-
const key = keyOf2(args3.chatId, args3.promptId);
|
|
273669
|
-
const setTimer = args3.setTimer ?? ((fn4, ms) => setTimeout(fn4, ms));
|
|
273670
|
-
const clearTimer = args3.clearTimer ?? ((handle) => clearTimeout(handle));
|
|
273671
|
-
let resolveLanding;
|
|
273672
|
-
const promise2 = new Promise((resolve3) => {
|
|
273673
|
-
resolveLanding = resolve3;
|
|
273674
|
-
});
|
|
273675
|
-
let done2 = false;
|
|
273676
|
-
const finish = /* @__PURE__ */ __name((landing2) => {
|
|
273677
|
-
if (done2) return;
|
|
273678
|
-
done2 = true;
|
|
273679
|
-
clearTimer(timer);
|
|
273680
|
-
if (waiters.get(key)?.settle === entry2.settle) waiters.delete(key);
|
|
273681
|
-
resolveLanding(landing2);
|
|
273682
|
-
}, "finish");
|
|
273683
|
-
const entry2 = { promptId: args3.promptId, settle: /* @__PURE__ */ __name((landing2) => finish(landing2), "settle") };
|
|
273684
|
-
const previous = waiters.get(key);
|
|
273685
|
-
waiters.set(key, entry2);
|
|
273686
|
-
const timer = setTimer(() => finish({ kind: "deadline" }), args3.deadlineMs ?? BUILD_LOCK_DEADLINE_MS);
|
|
273687
|
-
previous?.settle({ kind: "deadline" });
|
|
273688
|
-
return {
|
|
273689
|
-
chatId: args3.chatId,
|
|
273690
|
-
promptId: args3.promptId,
|
|
273691
|
-
promise: promise2,
|
|
273692
|
-
cancel: /* @__PURE__ */ __name(() => {
|
|
273693
|
-
if (done2) return;
|
|
273694
|
-
done2 = true;
|
|
273695
|
-
clearTimer(timer);
|
|
273696
|
-
if (waiters.get(key)?.settle === entry2.settle) waiters.delete(key);
|
|
273697
|
-
resolveLanding({ kind: "deadline" });
|
|
273698
|
-
}, "cancel")
|
|
273699
|
-
};
|
|
273700
|
-
}
|
|
273701
|
-
__name(registerTurnTerminalWaiter, "registerTurnTerminalWaiter");
|
|
273702
|
-
function settleTurnTerminal({
|
|
273703
|
-
scope: scope2,
|
|
273704
|
-
chatId,
|
|
273705
|
-
promptId,
|
|
273706
|
-
outcome
|
|
273707
|
-
}) {
|
|
273708
|
-
const entry2 = waitersFor(scope2).get(keyOf2(chatId, promptId));
|
|
273709
|
-
if (entry2 === void 0) return { consumed: false };
|
|
273710
|
-
entry2.settle({ kind: "settled", outcome });
|
|
273711
|
-
return { consumed: true };
|
|
273712
|
-
}
|
|
273713
|
-
__name(settleTurnTerminal, "settleTurnTerminal");
|
|
273714
|
-
var BUILD_LANDING_PREFIX = "[build result]";
|
|
273715
|
-
|
|
273716
273749
|
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/agent-wake.ts
|
|
273717
273750
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
273718
273751
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
@@ -290472,7 +290505,8 @@ async function acquireAgentSession(vctx, input3, readTerminal = readBuildTermina
|
|
|
290472
290505
|
}
|
|
290473
290506
|
await report3(id, text3, { awaitingPicture: true });
|
|
290474
290507
|
await pump();
|
|
290475
|
-
const picture = await waitForPicture(app.ownerHandle, app.appSlug, app.fsId);
|
|
290508
|
+
const picture = await waitForPicture(app.ownerHandle, app.appSlug, app.fsId, id);
|
|
290509
|
+
if (session2.snapshot().handles.some((handle) => handle.id === id) === false) return;
|
|
290476
290510
|
await report3(
|
|
290477
290511
|
id,
|
|
290478
290512
|
picture === void 0 ? text3 : text3.replace(SEE_IT_LINE, BUILD_PICTURE_LINE),
|
|
@@ -290496,11 +290530,12 @@ async function acquireAgentSession(vctx, input3, readTerminal = readBuildTermina
|
|
|
290496
290530
|
return input3.pictureWait !== void 0 || vctx.sthis.env.get("BUILD_RESULT_PICTURE") !== "off";
|
|
290497
290531
|
}
|
|
290498
290532
|
__name(buildResultPictureEnabled, "buildResultPictureEnabled");
|
|
290499
|
-
async function waitForPicture(ownerHandle, appSlug, fsId) {
|
|
290533
|
+
async function waitForPicture(ownerHandle, appSlug, fsId, handleId) {
|
|
290500
290534
|
const bound = input3.pictureWait ?? BUILD_RESULT_PICTURE_WAIT;
|
|
290501
290535
|
const startedAt = Date.now();
|
|
290502
290536
|
for (; ; ) {
|
|
290503
290537
|
if (closed) return void 0;
|
|
290538
|
+
if (session2.snapshot().handles.some((handle) => handle.id === handleId) === false) return void 0;
|
|
290504
290539
|
const shot = await loadLatestScreenshotDataUrl(vctx, { ownerHandle, appSlug }, [fsId]);
|
|
290505
290540
|
if (shot !== void 0) {
|
|
290506
290541
|
return {
|
|
@@ -330870,7 +330905,8 @@ async function seedAssetSafety(vctx, a4) {
|
|
|
330870
330905
|
ownerHandle: a4.ownerHandle,
|
|
330871
330906
|
appSlug: a4.appSlug,
|
|
330872
330907
|
userId: a4.userId,
|
|
330873
|
-
model: rModel.isOk() ? rModel.Ok() : ""
|
|
330908
|
+
model: rModel.isOk() ? rModel.Ok() : "",
|
|
330909
|
+
origin: a4.origin
|
|
330874
330910
|
},
|
|
330875
330911
|
tid: "queue-event",
|
|
330876
330912
|
src: "assetSafetyLane",
|
|
@@ -377129,7 +377165,7 @@ THE RHYTHM OF A CONVERSATION. A conversation with you has two kinds of moment, a
|
|
|
377129
377165
|
- Getting going: until a build is running, every sentence serves what the person came for. Your first sentence is the substance itself: the answer, the first thing the work needs, or what you are starting. Start from what is new to them; they just wrote the request, so go straight to what happens next. A bit is the one time their own words come back to them. Ask what the work needs in plain sentences, the way you would talk to a friend across a table, and keep numbered lists for steps they will follow, such as connecting Stripe. Questions the work needs are the work: ask them now. A question about their account or their vibes is answered as the whole turn, closing with one offer in a sentence or with nothing. The reply ends on the question the work needs, on the build starting, or on the build offer question; everything else keeps for the wait.
|
|
377130
377166
|
- Waiting: once create_vibe or edit_vibe_at has answered building, the person has a moment while their app takes shape, and so do you. This is where you get to know them, and the question for it rides at the end of the line that starts the build, written before the call: at most ONE question about them, one that follows from what they just asked, as plain words, one question mark in that text; when none follows, the line stands alone. Once the call has answered building, write nothing more in that turn: the next text they get is Done, because three texts in a row is one too many. Such as: what else is on their plate this week, or what comes round for them every week that could just run. It is a question about their life, never about the build, so its answer stands whatever lands. A thing to play with friends is the one build whose line asks about the thing itself: it hands them the first turn, as A THING TO PLAY WITH FRIENDS says. In a group the line that starts the build carries no question, and nothing follows it until Done. For someone new to you, the Done text carries once, as a short clause beside the link, that what you make is made for them, is theirs, and is ready to share. One question per wait, in the text that opens it; replies while other builds are still running say what is still building. Where the general instruction says a turn with a build running says what is still building and stops, in this conversation the line before the call already said it, and nothing follows the call: no "still building", no "I'll send the link". The options still wait for the result.
|
|
377131
377167
|
You want those waiting moments, because they are where you learn about the person, so you are glad to get a build going as soon as the work is ready, on any go THINK FIRST names. An ask you can finish with no build is finished with none.
|
|
377132
|
-
After each build lands, the "Done:" message with its link and the one thing to try comes first: the link ends its line and a blank line follows it, so the link, the thing to try and the question each read on their own. A hero's app opens with its share line where "Done:" would be: "Here's your hero's app if you want to share it: <link>". Its last line, after another blank line, is ONE question that offers the next step for this app: the feature it is one step from having, named concretely ("Should we add search by book?" under a verse finder), sharing it with the person it's for, one friend's job in it when it is made for friends, a chore it could take on and run for them, or the guided remix that fits. It is about ten words, plain, asked as "we" and answered with a yes, and it comes after everything else the Done text says; never a generic "what next?" and never a choice between two. When your question about them is still unanswered, it stands beside this one. Under a thing to play with friends the last line is always the question about texting one friend, alone. One offer, then it's their call.
|
|
377168
|
+
After each build lands, the "Done:" message with its link and the one thing to try comes first: the link ends its line and a blank line follows it, so the link, the thing to try and the question each read on their own. A hero's app opens with its share line where "Done:" would be: "Here's your hero's app if you want to share it: <link>". Its last line, after another blank line, is ONE question that offers the next step for this app: the feature it is one step from having, named concretely ("Should we add search by book?" under a verse finder), sharing it with the person it's for, one friend's job in it when it is made for friends, a chore it could take on and run for them, or the guided remix that fits. It is about ten words, plain, asked as "we" and answered with a yes, and it comes after everything else the Done text says; never a generic "what next?" and never a choice between two. When your question about them is still unanswered, it stands beside this one. Under a thing to play with friends the last line is always the question about texting one friend, alone. One offer, then it's their call. A text they sent while it built that reaches you beside its [build result] is answered inside that Done text, in a clause, so the phone dings once.
|
|
377133
377169
|
|
|
377134
377170
|
REACTIONS. When a message asks for work that takes a while, the platform puts \u{1F44D} on it the moment it arrives, so the person knows you are on it before any work shows; a message you answer right away in words gets no opening reaction. Past that, every reaction and every text lands on their phone as its own ding, so you answer a message with ONE of the two: a reaction alone, or words alone. A simple ask that is just done, with nothing new to tell them, is answered by \u2705 alone: a setting changed, a friend added, a pick saved, a fact kept. Anything with something to say is answered by the words alone: a build's "Done:" text with its link already says it landed, so it goes without a reaction, and so does an answer or a question. Send react as the turn's whole answer, with no words before or after it in that turn, and never in words about the reaction ("I put a \u2764\uFE0F on Tino's thanks"). The ones that say something new:
|
|
377135
377171
|
- \u2705 a simple ask is done: "add my friend to the bake sale signup" once the invite has gone out, a setting changed, a pick settled.
|
|
@@ -388811,6 +388847,13 @@ function createAgentEvidenceWriter(args3) {
|
|
|
388811
388847
|
}, "writeEvidence");
|
|
388812
388848
|
}
|
|
388813
388849
|
__name(createAgentEvidenceWriter, "createAgentEvidenceWriter");
|
|
388850
|
+
async function foldAgentSessionMessages(session2, onPersonMessage) {
|
|
388851
|
+
const taken = await session2.takeWaiting();
|
|
388852
|
+
if (taken.isErr()) return taken;
|
|
388853
|
+
if (onPersonMessage !== void 0 && taken.Ok()?.some(isPersonMessage) === true) onPersonMessage();
|
|
388854
|
+
return taken;
|
|
388855
|
+
}
|
|
388856
|
+
__name(foldAgentSessionMessages, "foldAgentSessionMessages");
|
|
388814
388857
|
async function nextAgentSessionMessages(session2, write, onPersonMessage) {
|
|
388815
388858
|
const next3 = await session2.next();
|
|
388816
388859
|
if (next3.isErr()) return next3;
|
|
@@ -392383,6 +392426,11 @@ function createAgentTurnAction(args3) {
|
|
|
392383
392426
|
}
|
|
392384
392427
|
}, "onEnd")
|
|
392385
392428
|
}) : rSse.Ok();
|
|
392429
|
+
const onPersonMessage = /* @__PURE__ */ __name(() => {
|
|
392430
|
+
buildAskAnswered = true;
|
|
392431
|
+
personSpokeAgain = true;
|
|
392432
|
+
liveSession.notePersonTurn();
|
|
392433
|
+
}, "onPersonMessage");
|
|
392386
392434
|
const turnStream = createAgentTurnStream({
|
|
392387
392435
|
vctx,
|
|
392388
392436
|
belt,
|
|
@@ -392449,11 +392497,10 @@ function createAgentTurnAction(args3) {
|
|
|
392449
392497
|
return Result.Ok();
|
|
392450
392498
|
}, "checkpoint"),
|
|
392451
392499
|
// #8912: a person's message the loop takes here starts a new turn for the per-turn tool caps.
|
|
392452
|
-
next: /* @__PURE__ */ __name(() => nextAgentSessionMessages(liveSession.session, evidence,
|
|
392453
|
-
|
|
392454
|
-
|
|
392455
|
-
|
|
392456
|
-
}), "next"),
|
|
392500
|
+
next: /* @__PURE__ */ __name(() => nextAgentSessionMessages(liveSession.session, evidence, onPersonMessage), "next"),
|
|
392501
|
+
// The mid-build fold: a message waiting while this step answers a [build result] joins it,
|
|
392502
|
+
// and counts as taken off the mailbox exactly as `next` counts one.
|
|
392503
|
+
fold: /* @__PURE__ */ __name(() => foldAgentSessionMessages(liveSession.session, onPersonMessage), "fold"),
|
|
392457
392504
|
head: /* @__PURE__ */ __name(() => liveSession.session.head(), "head"),
|
|
392458
392505
|
settled: /* @__PURE__ */ __name(() => liveSession.session.settled(), "settled"),
|
|
392459
392506
|
dispatchBudgetMs: agentTotalBudgetMs(vctx),
|
|
@@ -14811,7 +14811,8 @@ var init_asset_safety = __esm({
|
|
|
14811
14811
|
appSlug: "string",
|
|
14812
14812
|
// Who uploaded it — the recipient of a blocked/gave-up notification.
|
|
14813
14813
|
userId: "string",
|
|
14814
|
-
model: "string"
|
|
14814
|
+
model: "string",
|
|
14815
|
+
"origin?": "'upload' | 'generation'"
|
|
14815
14816
|
})
|
|
14816
14817
|
);
|
|
14817
14818
|
reqAssetSafetyStatus = lazyType(
|
|
@@ -26901,6 +26902,7 @@ var init_version_timeline = __esm({
|
|
|
26901
26902
|
var POUF_ENTRY_EXPORTS, POUF_TAUGHT_NAMES;
|
|
26902
26903
|
var init_exports = __esm({
|
|
26903
26904
|
"../vibes.diy/pouf/exports.ts"() {
|
|
26905
|
+
"use strict";
|
|
26904
26906
|
POUF_ENTRY_EXPORTS = {
|
|
26905
26907
|
index: [
|
|
26906
26908
|
"AlertBell",
|
|
@@ -41792,7 +41794,7 @@ var init_agent_session_instruction = __esm({
|
|
|
41792
41794
|
"../vibes.diy/api/svc/intern/agent-session-instruction.ts"() {
|
|
41793
41795
|
"use strict";
|
|
41794
41796
|
init_types3();
|
|
41795
|
-
AGENT_SESSION_INSTRUCTION_VERSION = "2026-11-17.
|
|
41797
|
+
AGENT_SESSION_INSTRUCTION_VERSION = "2026-11-17.3";
|
|
41796
41798
|
GROUP_READY_SHAPE = "each person's own records live on a channel named by their handle, granted on every write they make, so the app opens on their tree with nothing to create first, while a second or shared thing is its own document the person's own action writes; the rules key on user.userHandle, the tree's handle or that object's own creator, and the records are shaped so a friend can be let in later by a member record, so the app owner stands where everyone else stands.";
|
|
41797
41799
|
INVITE_SCREEN_WHEN = "The invite screen, the platform's HandleInput writing a membership into the person's tree or object, is part of the first build when the ask names other people, sharing, a group, a team, a family, a we or an our, or a person by name, and when the app is a person's own collection, where adding a friend is how the collection is shared";
|
|
41798
41800
|
SHARING_BASELINE = "Sharing is the baseline: every first build that is not privacy-sensitive ships a way to share on its first screen, specified asks and asks that name nobody else included, and the shape follows what one record is \u2014 a record a person keeps for their own life (a check-in, an entry, a line in a list) belongs to a collection that is private to its person and shared whole by the add-a-friend control on the first screen, which grants the friend it names the collection's channel; a piece made for readers (a post, an article, a gallery piece) carries a one-tap publish that puts it on its own channel, shared with everyone who can open the app, the drafting ritual readers already know; a thing made to be seen the moment it exists (a character in a cast, a caption) lands on an always-on shared channel everyone who opens the app can see. The person's own words move the dial: asking to pick which items each friend sees adds that choice to the add-a-friend control, and asking for drafts or publish brings the per-item step to any record. The create_vibe brief names the shape. A collection's add-a-friend control is its first-screen share; in the other two shapes the invite screen may wait for an option. Only a privacy-sensitive app keeps its sharing off until the person turns it on.";
|
|
@@ -41834,6 +41836,7 @@ A report is the authority for what its own work changed: it names the files, whe
|
|
|
41834
41836
|
among them, and the version saved, so reading the app again to confirm what a report just told you spends
|
|
41835
41837
|
a round and learns nothing. Read when you have a question the report does not answer.
|
|
41836
41838
|
After a platform report arrives, speak from the current outcome and any work still outstanding; leave superseded waiting states, retry histories and attempt counts in the journal.
|
|
41839
|
+
A message the person sent while a build ran can reach you beside its [build result]: the one reply you write tells the result and answers them in a clause, so they get one message.
|
|
41837
41840
|
|
|
41838
41841
|
Three kinds of tool answer. A read answers with what it found. A finishing action \u2014 set_app_style, put_doc,
|
|
41839
41842
|
delete_doc, validate, the staging that edit_file and write_file do \u2014 answers \`ok\` when it has finished, and
|
|
@@ -46749,9 +46752,16 @@ async function runLlmToolLoop(loopArgs) {
|
|
|
46749
46752
|
}
|
|
46750
46753
|
nextMessages.push(...images);
|
|
46751
46754
|
if (remainingBudget(budget, now3) <= 0) return Result36.Err("LLM tool loop deadline exceeded before resumed dispatch");
|
|
46752
|
-
|
|
46755
|
+
let nextRequest = { ...currentRequest, messages: nextMessages };
|
|
46756
|
+
if (args.session?.fold !== void 0) {
|
|
46757
|
+
const folded = await args.session.fold();
|
|
46758
|
+
if (folded.isErr()) return await endQuietly(folded.Err()) ?? Result36.Err(folded.Err());
|
|
46759
|
+
const joined = folded.Ok();
|
|
46760
|
+
if (joined !== void 0 && joined.length > 0)
|
|
46761
|
+
nextRequest = { ...currentRequest, messages: withRequestFrame(nextMessages, joined, args.session.head()) };
|
|
46762
|
+
}
|
|
46753
46763
|
if (args.session !== void 0) {
|
|
46754
|
-
const checkpoint = await args.session.checkpoint(
|
|
46764
|
+
const checkpoint = await args.session.checkpoint(nextRequest.messages);
|
|
46755
46765
|
if (checkpoint.isErr()) return await endQuietly(checkpoint.Err()) ?? Result36.Err(checkpoint.Err());
|
|
46756
46766
|
budget = createLlmToolLoopBudget({
|
|
46757
46767
|
totalBudgetMs: args.session.dispatchBudgetMs,
|
|
@@ -46863,6 +46873,148 @@ var init_llm_tool_loop = __esm({
|
|
|
46863
46873
|
}
|
|
46864
46874
|
});
|
|
46865
46875
|
|
|
46876
|
+
// ../vibes.diy/api/svc/intern/codegen-build-lock.ts
|
|
46877
|
+
function locksFor(scope2) {
|
|
46878
|
+
let locks = locksByScope.get(scope2);
|
|
46879
|
+
if (locks === void 0) {
|
|
46880
|
+
locks = /* @__PURE__ */ new Map();
|
|
46881
|
+
locksByScope.set(scope2, locks);
|
|
46882
|
+
}
|
|
46883
|
+
return locks;
|
|
46884
|
+
}
|
|
46885
|
+
function peekBuildLockEntry(scope2, chatId, clock = {}) {
|
|
46886
|
+
const now3 = (clock.now ?? Date.now)();
|
|
46887
|
+
const locks = locksFor(scope2);
|
|
46888
|
+
const entry2 = locks.get(chatId);
|
|
46889
|
+
if (entry2 === void 0) return void 0;
|
|
46890
|
+
if (now3 - entry2.acquiredAtMs > BUILD_LOCK_DEADLINE_MS) {
|
|
46891
|
+
locks.delete(chatId);
|
|
46892
|
+
return void 0;
|
|
46893
|
+
}
|
|
46894
|
+
return { promptId: entry2.promptId, wakesOnTerminal: entry2.wakesOnTerminal };
|
|
46895
|
+
}
|
|
46896
|
+
function peekBuildLock(scope2, chatId, clock = {}) {
|
|
46897
|
+
return peekBuildLockEntry(scope2, chatId, clock)?.promptId;
|
|
46898
|
+
}
|
|
46899
|
+
function acquireBuildLock(args) {
|
|
46900
|
+
const clock = args.clock ?? {};
|
|
46901
|
+
const held2 = peekBuildLock(args.scope, args.chatId, clock);
|
|
46902
|
+
if (held2 !== void 0) return { acquired: false, inFlightPromptId: held2 };
|
|
46903
|
+
locksFor(args.scope).set(args.chatId, {
|
|
46904
|
+
promptId: args.promptId,
|
|
46905
|
+
acquiredAtMs: (clock.now ?? Date.now)(),
|
|
46906
|
+
wakesOnTerminal: args.wakesOnTerminal === true
|
|
46907
|
+
});
|
|
46908
|
+
return { acquired: true };
|
|
46909
|
+
}
|
|
46910
|
+
function releaseBuildLock(scope2, chatId, promptId) {
|
|
46911
|
+
const locks = locksFor(scope2);
|
|
46912
|
+
if (locks.get(chatId)?.promptId === promptId) locks.delete(chatId);
|
|
46913
|
+
}
|
|
46914
|
+
function acquireTurnBuildLock(args) {
|
|
46915
|
+
if (args.movesFilesystem === false) return { acquired: true };
|
|
46916
|
+
return acquireBuildLock({
|
|
46917
|
+
scope: args.vctx.connections,
|
|
46918
|
+
chatId: args.chatId,
|
|
46919
|
+
promptId: args.promptId,
|
|
46920
|
+
wakesOnTerminal: args.wakesOnTerminal
|
|
46921
|
+
});
|
|
46922
|
+
}
|
|
46923
|
+
function releaseTurnBuildLock(vctx, chatId, promptId) {
|
|
46924
|
+
releaseBuildLock(vctx.connections, chatId, promptId);
|
|
46925
|
+
}
|
|
46926
|
+
var BUILD_LOCK_DEADLINE_MS, PERSIST_TAIL_MS, AGENT_TURN_CEILING_MS, INITIAL_DISPATCH_ALLOWANCE_MS, OPEN_TURN_DEADLINE_MS, locksByScope;
|
|
46927
|
+
var init_codegen_build_lock = __esm({
|
|
46928
|
+
"../vibes.diy/api/svc/intern/codegen-build-lock.ts"() {
|
|
46929
|
+
"use strict";
|
|
46930
|
+
BUILD_LOCK_DEADLINE_MS = 6e5;
|
|
46931
|
+
PERSIST_TAIL_MS = 12e4;
|
|
46932
|
+
AGENT_TURN_CEILING_MS = 9e5;
|
|
46933
|
+
INITIAL_DISPATCH_ALLOWANCE_MS = 12e4;
|
|
46934
|
+
OPEN_TURN_DEADLINE_MS = Math.max(BUILD_LOCK_DEADLINE_MS, INITIAL_DISPATCH_ALLOWANCE_MS + AGENT_TURN_CEILING_MS) + PERSIST_TAIL_MS;
|
|
46935
|
+
locksByScope = /* @__PURE__ */ new WeakMap();
|
|
46936
|
+
__name(locksFor, "locksFor");
|
|
46937
|
+
__name(peekBuildLockEntry, "peekBuildLockEntry");
|
|
46938
|
+
__name(peekBuildLock, "peekBuildLock");
|
|
46939
|
+
__name(acquireBuildLock, "acquireBuildLock");
|
|
46940
|
+
__name(releaseBuildLock, "releaseBuildLock");
|
|
46941
|
+
__name(acquireTurnBuildLock, "acquireTurnBuildLock");
|
|
46942
|
+
__name(releaseTurnBuildLock, "releaseTurnBuildLock");
|
|
46943
|
+
}
|
|
46944
|
+
});
|
|
46945
|
+
|
|
46946
|
+
// ../vibes.diy/api/svc/intern/turn-terminal.ts
|
|
46947
|
+
function waitersFor(scope2) {
|
|
46948
|
+
let waiters = waitersByScope.get(scope2);
|
|
46949
|
+
if (waiters === void 0) {
|
|
46950
|
+
waiters = /* @__PURE__ */ new Map();
|
|
46951
|
+
waitersByScope.set(scope2, waiters);
|
|
46952
|
+
}
|
|
46953
|
+
return waiters;
|
|
46954
|
+
}
|
|
46955
|
+
function keyOf(chatId, promptId) {
|
|
46956
|
+
return `${chatId}\0${promptId}`;
|
|
46957
|
+
}
|
|
46958
|
+
function registerTurnTerminalWaiter(args) {
|
|
46959
|
+
const waiters = waitersFor(args.scope);
|
|
46960
|
+
const key = keyOf(args.chatId, args.promptId);
|
|
46961
|
+
const setTimer = args.setTimer ?? ((fn, ms) => setTimeout(fn, ms));
|
|
46962
|
+
const clearTimer = args.clearTimer ?? ((handle) => clearTimeout(handle));
|
|
46963
|
+
let resolveLanding;
|
|
46964
|
+
const promise = new Promise((resolve11) => {
|
|
46965
|
+
resolveLanding = resolve11;
|
|
46966
|
+
});
|
|
46967
|
+
let done2 = false;
|
|
46968
|
+
const finish = /* @__PURE__ */ __name((landing2) => {
|
|
46969
|
+
if (done2) return;
|
|
46970
|
+
done2 = true;
|
|
46971
|
+
clearTimer(timer);
|
|
46972
|
+
if (waiters.get(key)?.settle === entry2.settle) waiters.delete(key);
|
|
46973
|
+
resolveLanding(landing2);
|
|
46974
|
+
}, "finish");
|
|
46975
|
+
const entry2 = { promptId: args.promptId, settle: /* @__PURE__ */ __name((landing2) => finish(landing2), "settle") };
|
|
46976
|
+
const previous = waiters.get(key);
|
|
46977
|
+
waiters.set(key, entry2);
|
|
46978
|
+
const timer = setTimer(() => finish({ kind: "deadline" }), args.deadlineMs ?? BUILD_LOCK_DEADLINE_MS);
|
|
46979
|
+
previous?.settle({ kind: "deadline" });
|
|
46980
|
+
return {
|
|
46981
|
+
chatId: args.chatId,
|
|
46982
|
+
promptId: args.promptId,
|
|
46983
|
+
promise,
|
|
46984
|
+
cancel: /* @__PURE__ */ __name(() => {
|
|
46985
|
+
if (done2) return;
|
|
46986
|
+
done2 = true;
|
|
46987
|
+
clearTimer(timer);
|
|
46988
|
+
if (waiters.get(key)?.settle === entry2.settle) waiters.delete(key);
|
|
46989
|
+
resolveLanding({ kind: "deadline" });
|
|
46990
|
+
}, "cancel")
|
|
46991
|
+
};
|
|
46992
|
+
}
|
|
46993
|
+
function settleTurnTerminal({
|
|
46994
|
+
scope: scope2,
|
|
46995
|
+
chatId,
|
|
46996
|
+
promptId,
|
|
46997
|
+
outcome
|
|
46998
|
+
}) {
|
|
46999
|
+
const entry2 = waitersFor(scope2).get(keyOf(chatId, promptId));
|
|
47000
|
+
if (entry2 === void 0) return { consumed: false };
|
|
47001
|
+
entry2.settle({ kind: "settled", outcome });
|
|
47002
|
+
return { consumed: true };
|
|
47003
|
+
}
|
|
47004
|
+
var waitersByScope, BUILD_LANDING_PREFIX;
|
|
47005
|
+
var init_turn_terminal = __esm({
|
|
47006
|
+
"../vibes.diy/api/svc/intern/turn-terminal.ts"() {
|
|
47007
|
+
"use strict";
|
|
47008
|
+
init_codegen_build_lock();
|
|
47009
|
+
waitersByScope = /* @__PURE__ */ new WeakMap();
|
|
47010
|
+
__name(waitersFor, "waitersFor");
|
|
47011
|
+
__name(keyOf, "keyOf");
|
|
47012
|
+
__name(registerTurnTerminalWaiter, "registerTurnTerminalWaiter");
|
|
47013
|
+
__name(settleTurnTerminal, "settleTurnTerminal");
|
|
47014
|
+
BUILD_LANDING_PREFIX = "[build result]";
|
|
47015
|
+
}
|
|
47016
|
+
});
|
|
47017
|
+
|
|
46866
47018
|
// ../vibes.diy/api/svc/intern/agent-session.ts
|
|
46867
47019
|
import { Result as Result37, exception2Result as exception2Result57 } from "@adviser/cement";
|
|
46868
47020
|
import { type as type94 } from "arktype";
|
|
@@ -46895,6 +47047,11 @@ function isHeldQueuedEditReceipt(handle, handles) {
|
|
|
46895
47047
|
if (build === void 0) return false;
|
|
46896
47048
|
return handles.some((other) => other.id === build && (other.state !== "settled" || other.awaitingPicture === true));
|
|
46897
47049
|
}
|
|
47050
|
+
function isBuildResultMessage(message3) {
|
|
47051
|
+
if (message3.role !== "user" || Array.isArray(message3.content) === false) return false;
|
|
47052
|
+
const first = message3.content[0];
|
|
47053
|
+
return first?.type === "text" && first.text.startsWith(BUILD_LANDING_PREFIX);
|
|
47054
|
+
}
|
|
46898
47055
|
function releasePictureWaits(snapshot) {
|
|
46899
47056
|
if (snapshot.handles.some((handle) => handle.awaitingPicture === true) === false) return snapshot;
|
|
46900
47057
|
return { ...snapshot, handles: snapshot.handles.map(withoutPictureWait) };
|
|
@@ -46924,6 +47081,7 @@ function createAgentSession(args) {
|
|
|
46924
47081
|
let head;
|
|
46925
47082
|
let takenInputs = /* @__PURE__ */ new Set();
|
|
46926
47083
|
let takenHandles = /* @__PURE__ */ new Set();
|
|
47084
|
+
let resultStep = false;
|
|
46927
47085
|
let revision = args.revision ?? 0;
|
|
46928
47086
|
function update(change, admit) {
|
|
46929
47087
|
const operation = serial.then(async () => {
|
|
@@ -47060,14 +47218,16 @@ function createAgentSession(args) {
|
|
|
47060
47218
|
const saved = await serial;
|
|
47061
47219
|
if (failure3 !== void 0) return Result37.Err(failure3);
|
|
47062
47220
|
if (saved.isErr()) return Result37.Err(saved.Err());
|
|
47221
|
+
const folding = state3.inbox.some((input) => input.messages.some(isPersonMessage));
|
|
47222
|
+
const heldBy = folding ? state3.handles.map(withoutPictureWait) : state3.handles;
|
|
47063
47223
|
const ready = state3.handles.filter(
|
|
47064
|
-
(handle) => handle.state === "settled" && handle.awaitingPicture !== true && isHeldQueuedEditReceipt(handle,
|
|
47224
|
+
(handle) => handle.state === "settled" && (handle.awaitingPicture !== true || folding) && isHeldQueuedEditReceipt(handle, heldBy) === false
|
|
47065
47225
|
);
|
|
47066
47226
|
if (state3.inbox.length > 0 || ready.length > 0) {
|
|
47067
47227
|
takenInputs = new Set(state3.inbox.map((input) => input.id));
|
|
47068
47228
|
takenHandles = new Set(ready.map((handle) => handle.id));
|
|
47069
47229
|
notify2 = void 0;
|
|
47070
|
-
|
|
47230
|
+
const batch = [
|
|
47071
47231
|
...state3.inbox.flatMap((input) => input.messages),
|
|
47072
47232
|
...ready.flatMap((handle) => [
|
|
47073
47233
|
{
|
|
@@ -47076,7 +47236,9 @@ function createAgentSession(args) {
|
|
|
47076
47236
|
},
|
|
47077
47237
|
...handle.picture === void 0 ? [] : [toolImageMessage("build result", handle.picture)]
|
|
47078
47238
|
])
|
|
47079
|
-
]
|
|
47239
|
+
];
|
|
47240
|
+
resultStep = batch.some(isPersonMessage) === false && batch.some(isBuildResultMessage);
|
|
47241
|
+
return Result37.Ok(batch);
|
|
47080
47242
|
}
|
|
47081
47243
|
if (state3.handles.some((handle) => isDormantParkedBuild(handle) === false)) {
|
|
47082
47244
|
await changed;
|
|
@@ -47100,6 +47262,17 @@ function createAgentSession(args) {
|
|
|
47100
47262
|
}
|
|
47101
47263
|
return failure3 === void 0 ? Result37.Ok(void 0) : Result37.Err(failure3);
|
|
47102
47264
|
},
|
|
47265
|
+
async takeWaiting() {
|
|
47266
|
+
if (resultStep === false || stopped) return Result37.Ok(void 0);
|
|
47267
|
+
const saved = await serial;
|
|
47268
|
+
if (failure3 !== void 0) return Result37.Err(failure3);
|
|
47269
|
+
if (saved.isErr()) return Result37.Err(saved.Err());
|
|
47270
|
+
const waiting = state3.inbox.filter((input) => takenInputs.has(input.id) === false);
|
|
47271
|
+
if (waiting.some((input) => input.messages.some(isPersonMessage)) === false) return Result37.Ok(void 0);
|
|
47272
|
+
for (const input of waiting) takenInputs.add(input.id);
|
|
47273
|
+
resultStep = false;
|
|
47274
|
+
return Result37.Ok(waiting.flatMap((input) => input.messages));
|
|
47275
|
+
},
|
|
47103
47276
|
async settleIdle() {
|
|
47104
47277
|
if (state3.status === "idle" || hasPendingWork(state3)) return Result37.Ok(false);
|
|
47105
47278
|
let wrote = false;
|
|
@@ -47132,6 +47305,7 @@ var init_agent_session = __esm({
|
|
|
47132
47305
|
init_agent_request_frame();
|
|
47133
47306
|
init_inflate_file_attachments();
|
|
47134
47307
|
init_llm_tool_loop();
|
|
47308
|
+
init_turn_terminal();
|
|
47135
47309
|
init_agent_settled_history();
|
|
47136
47310
|
init_types3();
|
|
47137
47311
|
init_lazy_type();
|
|
@@ -47249,6 +47423,7 @@ var init_agent_session = __esm({
|
|
|
47249
47423
|
__name(agentRunPromptIds, "agentRunPromptIds");
|
|
47250
47424
|
__name(hasPendingWork, "hasPendingWork");
|
|
47251
47425
|
__name(isHeldQueuedEditReceipt, "isHeldQueuedEditReceipt");
|
|
47426
|
+
__name(isBuildResultMessage, "isBuildResultMessage");
|
|
47252
47427
|
__name(releasePictureWaits, "releasePictureWaits");
|
|
47253
47428
|
__name(withoutPictureWait, "withoutPictureWait");
|
|
47254
47429
|
__name(isDormantParkedBuild, "isDormantParkedBuild");
|
|
@@ -51681,76 +51856,6 @@ var init_capi_lead_event = __esm({
|
|
|
51681
51856
|
}
|
|
51682
51857
|
});
|
|
51683
51858
|
|
|
51684
|
-
// ../vibes.diy/api/svc/intern/codegen-build-lock.ts
|
|
51685
|
-
function locksFor(scope2) {
|
|
51686
|
-
let locks = locksByScope.get(scope2);
|
|
51687
|
-
if (locks === void 0) {
|
|
51688
|
-
locks = /* @__PURE__ */ new Map();
|
|
51689
|
-
locksByScope.set(scope2, locks);
|
|
51690
|
-
}
|
|
51691
|
-
return locks;
|
|
51692
|
-
}
|
|
51693
|
-
function peekBuildLockEntry(scope2, chatId, clock = {}) {
|
|
51694
|
-
const now3 = (clock.now ?? Date.now)();
|
|
51695
|
-
const locks = locksFor(scope2);
|
|
51696
|
-
const entry2 = locks.get(chatId);
|
|
51697
|
-
if (entry2 === void 0) return void 0;
|
|
51698
|
-
if (now3 - entry2.acquiredAtMs > BUILD_LOCK_DEADLINE_MS) {
|
|
51699
|
-
locks.delete(chatId);
|
|
51700
|
-
return void 0;
|
|
51701
|
-
}
|
|
51702
|
-
return { promptId: entry2.promptId, wakesOnTerminal: entry2.wakesOnTerminal };
|
|
51703
|
-
}
|
|
51704
|
-
function peekBuildLock(scope2, chatId, clock = {}) {
|
|
51705
|
-
return peekBuildLockEntry(scope2, chatId, clock)?.promptId;
|
|
51706
|
-
}
|
|
51707
|
-
function acquireBuildLock(args) {
|
|
51708
|
-
const clock = args.clock ?? {};
|
|
51709
|
-
const held2 = peekBuildLock(args.scope, args.chatId, clock);
|
|
51710
|
-
if (held2 !== void 0) return { acquired: false, inFlightPromptId: held2 };
|
|
51711
|
-
locksFor(args.scope).set(args.chatId, {
|
|
51712
|
-
promptId: args.promptId,
|
|
51713
|
-
acquiredAtMs: (clock.now ?? Date.now)(),
|
|
51714
|
-
wakesOnTerminal: args.wakesOnTerminal === true
|
|
51715
|
-
});
|
|
51716
|
-
return { acquired: true };
|
|
51717
|
-
}
|
|
51718
|
-
function releaseBuildLock(scope2, chatId, promptId) {
|
|
51719
|
-
const locks = locksFor(scope2);
|
|
51720
|
-
if (locks.get(chatId)?.promptId === promptId) locks.delete(chatId);
|
|
51721
|
-
}
|
|
51722
|
-
function acquireTurnBuildLock(args) {
|
|
51723
|
-
if (args.movesFilesystem === false) return { acquired: true };
|
|
51724
|
-
return acquireBuildLock({
|
|
51725
|
-
scope: args.vctx.connections,
|
|
51726
|
-
chatId: args.chatId,
|
|
51727
|
-
promptId: args.promptId,
|
|
51728
|
-
wakesOnTerminal: args.wakesOnTerminal
|
|
51729
|
-
});
|
|
51730
|
-
}
|
|
51731
|
-
function releaseTurnBuildLock(vctx, chatId, promptId) {
|
|
51732
|
-
releaseBuildLock(vctx.connections, chatId, promptId);
|
|
51733
|
-
}
|
|
51734
|
-
var BUILD_LOCK_DEADLINE_MS, PERSIST_TAIL_MS, AGENT_TURN_CEILING_MS, INITIAL_DISPATCH_ALLOWANCE_MS, OPEN_TURN_DEADLINE_MS, locksByScope;
|
|
51735
|
-
var init_codegen_build_lock = __esm({
|
|
51736
|
-
"../vibes.diy/api/svc/intern/codegen-build-lock.ts"() {
|
|
51737
|
-
"use strict";
|
|
51738
|
-
BUILD_LOCK_DEADLINE_MS = 6e5;
|
|
51739
|
-
PERSIST_TAIL_MS = 12e4;
|
|
51740
|
-
AGENT_TURN_CEILING_MS = 9e5;
|
|
51741
|
-
INITIAL_DISPATCH_ALLOWANCE_MS = 12e4;
|
|
51742
|
-
OPEN_TURN_DEADLINE_MS = Math.max(BUILD_LOCK_DEADLINE_MS, INITIAL_DISPATCH_ALLOWANCE_MS + AGENT_TURN_CEILING_MS) + PERSIST_TAIL_MS;
|
|
51743
|
-
locksByScope = /* @__PURE__ */ new WeakMap();
|
|
51744
|
-
__name(locksFor, "locksFor");
|
|
51745
|
-
__name(peekBuildLockEntry, "peekBuildLockEntry");
|
|
51746
|
-
__name(peekBuildLock, "peekBuildLock");
|
|
51747
|
-
__name(acquireBuildLock, "acquireBuildLock");
|
|
51748
|
-
__name(releaseBuildLock, "releaseBuildLock");
|
|
51749
|
-
__name(acquireTurnBuildLock, "acquireTurnBuildLock");
|
|
51750
|
-
__name(releaseTurnBuildLock, "releaseTurnBuildLock");
|
|
51751
|
-
}
|
|
51752
|
-
});
|
|
51753
|
-
|
|
51754
51859
|
// ../vibes.diy/api/svc/intern/build-ledger-store.ts
|
|
51755
51860
|
import { exception2Result as exception2Result72, Result as Result47 } from "@adviser/cement";
|
|
51756
51861
|
import { and as and51, eq as eq60, inArray as inArray20, isNull as isNull5, notInArray as notInArray2, or as or5 } from "drizzle-orm/sql/expressions";
|
|
@@ -52102,78 +52207,6 @@ var init_open_turn_store = __esm({
|
|
|
52102
52207
|
}
|
|
52103
52208
|
});
|
|
52104
52209
|
|
|
52105
|
-
// ../vibes.diy/api/svc/intern/turn-terminal.ts
|
|
52106
|
-
function waitersFor(scope2) {
|
|
52107
|
-
let waiters = waitersByScope.get(scope2);
|
|
52108
|
-
if (waiters === void 0) {
|
|
52109
|
-
waiters = /* @__PURE__ */ new Map();
|
|
52110
|
-
waitersByScope.set(scope2, waiters);
|
|
52111
|
-
}
|
|
52112
|
-
return waiters;
|
|
52113
|
-
}
|
|
52114
|
-
function keyOf(chatId, promptId) {
|
|
52115
|
-
return `${chatId}\0${promptId}`;
|
|
52116
|
-
}
|
|
52117
|
-
function registerTurnTerminalWaiter(args) {
|
|
52118
|
-
const waiters = waitersFor(args.scope);
|
|
52119
|
-
const key = keyOf(args.chatId, args.promptId);
|
|
52120
|
-
const setTimer = args.setTimer ?? ((fn, ms) => setTimeout(fn, ms));
|
|
52121
|
-
const clearTimer = args.clearTimer ?? ((handle) => clearTimeout(handle));
|
|
52122
|
-
let resolveLanding;
|
|
52123
|
-
const promise = new Promise((resolve11) => {
|
|
52124
|
-
resolveLanding = resolve11;
|
|
52125
|
-
});
|
|
52126
|
-
let done2 = false;
|
|
52127
|
-
const finish = /* @__PURE__ */ __name((landing2) => {
|
|
52128
|
-
if (done2) return;
|
|
52129
|
-
done2 = true;
|
|
52130
|
-
clearTimer(timer);
|
|
52131
|
-
if (waiters.get(key)?.settle === entry2.settle) waiters.delete(key);
|
|
52132
|
-
resolveLanding(landing2);
|
|
52133
|
-
}, "finish");
|
|
52134
|
-
const entry2 = { promptId: args.promptId, settle: /* @__PURE__ */ __name((landing2) => finish(landing2), "settle") };
|
|
52135
|
-
const previous = waiters.get(key);
|
|
52136
|
-
waiters.set(key, entry2);
|
|
52137
|
-
const timer = setTimer(() => finish({ kind: "deadline" }), args.deadlineMs ?? BUILD_LOCK_DEADLINE_MS);
|
|
52138
|
-
previous?.settle({ kind: "deadline" });
|
|
52139
|
-
return {
|
|
52140
|
-
chatId: args.chatId,
|
|
52141
|
-
promptId: args.promptId,
|
|
52142
|
-
promise,
|
|
52143
|
-
cancel: /* @__PURE__ */ __name(() => {
|
|
52144
|
-
if (done2) return;
|
|
52145
|
-
done2 = true;
|
|
52146
|
-
clearTimer(timer);
|
|
52147
|
-
if (waiters.get(key)?.settle === entry2.settle) waiters.delete(key);
|
|
52148
|
-
resolveLanding({ kind: "deadline" });
|
|
52149
|
-
}, "cancel")
|
|
52150
|
-
};
|
|
52151
|
-
}
|
|
52152
|
-
function settleTurnTerminal({
|
|
52153
|
-
scope: scope2,
|
|
52154
|
-
chatId,
|
|
52155
|
-
promptId,
|
|
52156
|
-
outcome
|
|
52157
|
-
}) {
|
|
52158
|
-
const entry2 = waitersFor(scope2).get(keyOf(chatId, promptId));
|
|
52159
|
-
if (entry2 === void 0) return { consumed: false };
|
|
52160
|
-
entry2.settle({ kind: "settled", outcome });
|
|
52161
|
-
return { consumed: true };
|
|
52162
|
-
}
|
|
52163
|
-
var waitersByScope, BUILD_LANDING_PREFIX;
|
|
52164
|
-
var init_turn_terminal = __esm({
|
|
52165
|
-
"../vibes.diy/api/svc/intern/turn-terminal.ts"() {
|
|
52166
|
-
"use strict";
|
|
52167
|
-
init_codegen_build_lock();
|
|
52168
|
-
waitersByScope = /* @__PURE__ */ new WeakMap();
|
|
52169
|
-
__name(waitersFor, "waitersFor");
|
|
52170
|
-
__name(keyOf, "keyOf");
|
|
52171
|
-
__name(registerTurnTerminalWaiter, "registerTurnTerminalWaiter");
|
|
52172
|
-
__name(settleTurnTerminal, "settleTurnTerminal");
|
|
52173
|
-
BUILD_LANDING_PREFIX = "[build result]";
|
|
52174
|
-
}
|
|
52175
|
-
});
|
|
52176
|
-
|
|
52177
52210
|
// ../vibes.diy/api/svc/intern/chat-section-persist.ts
|
|
52178
52211
|
function chatPackCodeLinesEnabled(flag22) {
|
|
52179
52212
|
return flag22 === "on";
|
|
@@ -55686,7 +55719,8 @@ async function acquireAgentSession(vctx, input, readTerminal = readBuildTerminal
|
|
|
55686
55719
|
}
|
|
55687
55720
|
await report2(id, text3, { awaitingPicture: true });
|
|
55688
55721
|
await pump();
|
|
55689
|
-
const picture = await waitForPicture(app.ownerHandle, app.appSlug, app.fsId);
|
|
55722
|
+
const picture = await waitForPicture(app.ownerHandle, app.appSlug, app.fsId, id);
|
|
55723
|
+
if (session2.snapshot().handles.some((handle) => handle.id === id) === false) return;
|
|
55690
55724
|
await report2(
|
|
55691
55725
|
id,
|
|
55692
55726
|
picture === void 0 ? text3 : text3.replace(SEE_IT_LINE, BUILD_PICTURE_LINE),
|
|
@@ -55710,11 +55744,12 @@ async function acquireAgentSession(vctx, input, readTerminal = readBuildTerminal
|
|
|
55710
55744
|
return input.pictureWait !== void 0 || vctx.sthis.env.get("BUILD_RESULT_PICTURE") !== "off";
|
|
55711
55745
|
}
|
|
55712
55746
|
__name(buildResultPictureEnabled, "buildResultPictureEnabled");
|
|
55713
|
-
async function waitForPicture(ownerHandle, appSlug, fsId) {
|
|
55747
|
+
async function waitForPicture(ownerHandle, appSlug, fsId, handleId) {
|
|
55714
55748
|
const bound = input.pictureWait ?? BUILD_RESULT_PICTURE_WAIT;
|
|
55715
55749
|
const startedAt = Date.now();
|
|
55716
55750
|
for (; ; ) {
|
|
55717
55751
|
if (closed) return void 0;
|
|
55752
|
+
if (session2.snapshot().handles.some((handle) => handle.id === handleId) === false) return void 0;
|
|
55718
55753
|
const shot = await loadLatestScreenshotDataUrl(vctx, { ownerHandle, appSlug }, [fsId]);
|
|
55719
55754
|
if (shot !== void 0) {
|
|
55720
55755
|
return {
|
|
@@ -90487,7 +90522,8 @@ async function seedAssetSafety(vctx, a) {
|
|
|
90487
90522
|
ownerHandle: a.ownerHandle,
|
|
90488
90523
|
appSlug: a.appSlug,
|
|
90489
90524
|
userId: a.userId,
|
|
90490
|
-
model: rModel.isOk() ? rModel.Ok() : ""
|
|
90525
|
+
model: rModel.isOk() ? rModel.Ok() : "",
|
|
90526
|
+
origin: a.origin
|
|
90491
90527
|
},
|
|
90492
90528
|
tid: "queue-event",
|
|
90493
90529
|
src: "assetSafetyLane",
|
|
@@ -128083,7 +128119,7 @@ THE RHYTHM OF A CONVERSATION. A conversation with you has two kinds of moment, a
|
|
|
128083
128119
|
- Getting going: until a build is running, every sentence serves what the person came for. Your first sentence is the substance itself: the answer, the first thing the work needs, or what you are starting. Start from what is new to them; they just wrote the request, so go straight to what happens next. A bit is the one time their own words come back to them. Ask what the work needs in plain sentences, the way you would talk to a friend across a table, and keep numbered lists for steps they will follow, such as connecting Stripe. Questions the work needs are the work: ask them now. A question about their account or their vibes is answered as the whole turn, closing with one offer in a sentence or with nothing. The reply ends on the question the work needs, on the build starting, or on the build offer question; everything else keeps for the wait.
|
|
128084
128120
|
- Waiting: once create_vibe or edit_vibe_at has answered building, the person has a moment while their app takes shape, and so do you. This is where you get to know them, and the question for it rides at the end of the line that starts the build, written before the call: at most ONE question about them, one that follows from what they just asked, as plain words, one question mark in that text; when none follows, the line stands alone. Once the call has answered building, write nothing more in that turn: the next text they get is Done, because three texts in a row is one too many. Such as: what else is on their plate this week, or what comes round for them every week that could just run. It is a question about their life, never about the build, so its answer stands whatever lands. A thing to play with friends is the one build whose line asks about the thing itself: it hands them the first turn, as A THING TO PLAY WITH FRIENDS says. In a group the line that starts the build carries no question, and nothing follows it until Done. For someone new to you, the Done text carries once, as a short clause beside the link, that what you make is made for them, is theirs, and is ready to share. One question per wait, in the text that opens it; replies while other builds are still running say what is still building. Where the general instruction says a turn with a build running says what is still building and stops, in this conversation the line before the call already said it, and nothing follows the call: no "still building", no "I'll send the link". The options still wait for the result.
|
|
128085
128121
|
You want those waiting moments, because they are where you learn about the person, so you are glad to get a build going as soon as the work is ready, on any go THINK FIRST names. An ask you can finish with no build is finished with none.
|
|
128086
|
-
After each build lands, the "Done:" message with its link and the one thing to try comes first: the link ends its line and a blank line follows it, so the link, the thing to try and the question each read on their own. A hero's app opens with its share line where "Done:" would be: "Here's your hero's app if you want to share it: <link>". Its last line, after another blank line, is ONE question that offers the next step for this app: the feature it is one step from having, named concretely ("Should we add search by book?" under a verse finder), sharing it with the person it's for, one friend's job in it when it is made for friends, a chore it could take on and run for them, or the guided remix that fits. It is about ten words, plain, asked as "we" and answered with a yes, and it comes after everything else the Done text says; never a generic "what next?" and never a choice between two. When your question about them is still unanswered, it stands beside this one. Under a thing to play with friends the last line is always the question about texting one friend, alone. One offer, then it's their call.
|
|
128122
|
+
After each build lands, the "Done:" message with its link and the one thing to try comes first: the link ends its line and a blank line follows it, so the link, the thing to try and the question each read on their own. A hero's app opens with its share line where "Done:" would be: "Here's your hero's app if you want to share it: <link>". Its last line, after another blank line, is ONE question that offers the next step for this app: the feature it is one step from having, named concretely ("Should we add search by book?" under a verse finder), sharing it with the person it's for, one friend's job in it when it is made for friends, a chore it could take on and run for them, or the guided remix that fits. It is about ten words, plain, asked as "we" and answered with a yes, and it comes after everything else the Done text says; never a generic "what next?" and never a choice between two. When your question about them is still unanswered, it stands beside this one. Under a thing to play with friends the last line is always the question about texting one friend, alone. One offer, then it's their call. A text they sent while it built that reaches you beside its [build result] is answered inside that Done text, in a clause, so the phone dings once.
|
|
128087
128123
|
|
|
128088
128124
|
REACTIONS. When a message asks for work that takes a while, the platform puts \u{1F44D} on it the moment it arrives, so the person knows you are on it before any work shows; a message you answer right away in words gets no opening reaction. Past that, every reaction and every text lands on their phone as its own ding, so you answer a message with ONE of the two: a reaction alone, or words alone. A simple ask that is just done, with nothing new to tell them, is answered by \u2705 alone: a setting changed, a friend added, a pick saved, a fact kept. Anything with something to say is answered by the words alone: a build's "Done:" text with its link already says it landed, so it goes without a reaction, and so does an answer or a question. Send react as the turn's whole answer, with no words before or after it in that turn, and never in words about the reaction ("I put a \u2764\uFE0F on Tino's thanks"). The ones that say something new:
|
|
128089
128125
|
- \u2705 a simple ask is done: "add my friend to the bake sale signup" once the invite has gone out, a setting changed, a pick settled.
|
|
@@ -140266,6 +140302,12 @@ function createAgentEvidenceWriter(args) {
|
|
|
140266
140302
|
);
|
|
140267
140303
|
}, "writeEvidence");
|
|
140268
140304
|
}
|
|
140305
|
+
async function foldAgentSessionMessages(session2, onPersonMessage) {
|
|
140306
|
+
const taken = await session2.takeWaiting();
|
|
140307
|
+
if (taken.isErr()) return taken;
|
|
140308
|
+
if (onPersonMessage !== void 0 && taken.Ok()?.some(isPersonMessage) === true) onPersonMessage();
|
|
140309
|
+
return taken;
|
|
140310
|
+
}
|
|
140269
140311
|
async function nextAgentSessionMessages(session2, write, onPersonMessage) {
|
|
140270
140312
|
const next = await session2.next();
|
|
140271
140313
|
if (next.isErr()) return next;
|
|
@@ -140317,6 +140359,7 @@ var init_agent_evidence = __esm({
|
|
|
140317
140359
|
refusedReceipt = lazyType(() => type193({ ok: "false", reason: agentToolRefusalReason }));
|
|
140318
140360
|
savedCommit = lazyType(() => type193({ ok: "true", saved: "true", fsRef: { fsId: "string" } }));
|
|
140319
140361
|
__name(createAgentEvidenceWriter, "createAgentEvidenceWriter");
|
|
140362
|
+
__name(foldAgentSessionMessages, "foldAgentSessionMessages");
|
|
140320
140363
|
__name(nextAgentSessionMessages, "nextAgentSessionMessages");
|
|
140321
140364
|
}
|
|
140322
140365
|
});
|
|
@@ -143990,6 +144033,11 @@ function createAgentTurnAction(args) {
|
|
|
143990
144033
|
}
|
|
143991
144034
|
}, "onEnd")
|
|
143992
144035
|
}) : rSse.Ok();
|
|
144036
|
+
const onPersonMessage = /* @__PURE__ */ __name(() => {
|
|
144037
|
+
buildAskAnswered = true;
|
|
144038
|
+
personSpokeAgain = true;
|
|
144039
|
+
liveSession.notePersonTurn();
|
|
144040
|
+
}, "onPersonMessage");
|
|
143993
144041
|
const turnStream = createAgentTurnStream({
|
|
143994
144042
|
vctx,
|
|
143995
144043
|
belt,
|
|
@@ -144056,11 +144104,10 @@ function createAgentTurnAction(args) {
|
|
|
144056
144104
|
return Result250.Ok();
|
|
144057
144105
|
}, "checkpoint"),
|
|
144058
144106
|
// #8912: a person's message the loop takes here starts a new turn for the per-turn tool caps.
|
|
144059
|
-
next: /* @__PURE__ */ __name(() => nextAgentSessionMessages(liveSession.session, evidence,
|
|
144060
|
-
|
|
144061
|
-
|
|
144062
|
-
|
|
144063
|
-
}), "next"),
|
|
144107
|
+
next: /* @__PURE__ */ __name(() => nextAgentSessionMessages(liveSession.session, evidence, onPersonMessage), "next"),
|
|
144108
|
+
// The mid-build fold: a message waiting while this step answers a [build result] joins it,
|
|
144109
|
+
// and counts as taken off the mailbox exactly as `next` counts one.
|
|
144110
|
+
fold: /* @__PURE__ */ __name(() => foldAgentSessionMessages(liveSession.session, onPersonMessage), "fold"),
|
|
144064
144111
|
head: /* @__PURE__ */ __name(() => liveSession.session.head(), "head"),
|
|
144065
144112
|
settled: /* @__PURE__ */ __name(() => liveSession.session.settled(), "settled"),
|
|
144066
144113
|
dispatchBudgetMs: agentTotalBudgetMs(vctx),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vibes-diy",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.347",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"description": "Command-line tool for vibes.diy — generate, edit, pull, push, and publish AI-built apps",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"@neondatabase/serverless": "~1.2.0",
|
|
42
42
|
"@noble/hashes": "~2.4.0",
|
|
43
43
|
"@shadcn/lint": "~0.2.3",
|
|
44
|
-
"@vibes.diy/api-impl": "14.3.
|
|
45
|
-
"@vibes.diy/api-types": "14.3.
|
|
46
|
-
"@vibes.diy/call-ai-v2": "14.3.
|
|
47
|
-
"@vibes.diy/cmd-harness": "14.3.
|
|
48
|
-
"@vibes.diy/cmd-tools": "14.3.
|
|
49
|
-
"@vibes.diy/identity": "14.3.
|
|
50
|
-
"@vibes.diy/prompts": "14.3.
|
|
44
|
+
"@vibes.diy/api-impl": "14.3.347",
|
|
45
|
+
"@vibes.diy/api-types": "14.3.347",
|
|
46
|
+
"@vibes.diy/call-ai-v2": "14.3.347",
|
|
47
|
+
"@vibes.diy/cmd-harness": "14.3.347",
|
|
48
|
+
"@vibes.diy/cmd-tools": "14.3.347",
|
|
49
|
+
"@vibes.diy/identity": "14.3.347",
|
|
50
|
+
"@vibes.diy/prompts": "14.3.347",
|
|
51
51
|
"acorn": "~8.19.0",
|
|
52
52
|
"acorn-jsx": "~5.3.2",
|
|
53
53
|
"arktype": "~2.2.9",
|