vibes-diy 14.3.365 → 14.3.366
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.
|
@@ -356701,7 +356701,15 @@ var makePictureInput = lazyType(
|
|
|
356701
356701
|
"photo?": "number.integer >= 1",
|
|
356702
356702
|
"earlierPhoto?": "number.integer >= 1",
|
|
356703
356703
|
"sourceRecord?": type({ ...recordRef, "fileKey?": "string" }).onUndeclaredKey("reject"),
|
|
356704
|
-
"vibe?": type({
|
|
356704
|
+
"vibe?": type({
|
|
356705
|
+
ownerHandle: "string > 0",
|
|
356706
|
+
appSlug: "string > 0",
|
|
356707
|
+
"dbName?": "string > 0",
|
|
356708
|
+
"docId?": "string > 0",
|
|
356709
|
+
"photoKey?": "string > 0",
|
|
356710
|
+
"record?": "Record<string, unknown>",
|
|
356711
|
+
"like?": "string > 0"
|
|
356712
|
+
}).onUndeclaredKey("reject")
|
|
356705
356713
|
}).onUndeclaredKey("reject")
|
|
356706
356714
|
);
|
|
356707
356715
|
function makePictureToolDefinition() {
|
|
@@ -356737,7 +356745,7 @@ function makePictureToolDefinition() {
|
|
|
356737
356745
|
},
|
|
356738
356746
|
vibe: {
|
|
356739
356747
|
type: "object",
|
|
356740
|
-
description: "Also save it as this record's picture, in a vibe this conversation may add records to (its own, or one they linked).",
|
|
356748
|
+
description: "Also save it as this record's picture, in a vibe this conversation may add records to (its own, or one they linked). A picture app named by its owner and appSlug alone (no dbName) goes through its own newest record with a prompt: make_picture copies it, keeps the photo where that record keeps its own, and answers `record` with what it used.",
|
|
356741
356749
|
properties: {
|
|
356742
356750
|
ownerHandle: { type: "string" },
|
|
356743
356751
|
appSlug: { type: "string" },
|
|
@@ -356749,10 +356757,14 @@ function makePictureToolDefinition() {
|
|
|
356749
356757
|
},
|
|
356750
356758
|
record: {
|
|
356751
356759
|
type: "object",
|
|
356752
|
-
description: "The record's own fields, in the shape the app's records have (its authorHandle the `writesAs` handle list_databases names, its prompt set the way theirs are). Saved through the app's rules before the paint, so no put_doc is needed first."
|
|
356760
|
+
description: "The record's own fields, in the shape the app's records have (its authorHandle the `writesAs` handle list_databases names, its prompt set the way theirs are). Saved through the app's rules before the paint, so no put_doc is needed first. With `like`, only the fields that differ from that record."
|
|
356761
|
+
},
|
|
356762
|
+
like: {
|
|
356763
|
+
type: "string",
|
|
356764
|
+
description: "The _id of one of the app's own records in this database (a list_databases sample's _id): the new record starts as a copy of its fields (its prompt included), written as you, with the time set to now. `record` changes any of them."
|
|
356753
356765
|
}
|
|
356754
356766
|
},
|
|
356755
|
-
required: ["ownerHandle", "appSlug"
|
|
356767
|
+
required: ["ownerHandle", "appSlug"],
|
|
356756
356768
|
additionalProperties: false
|
|
356757
356769
|
}
|
|
356758
356770
|
},
|
|
@@ -356762,6 +356774,52 @@ function makePictureToolDefinition() {
|
|
|
356762
356774
|
};
|
|
356763
356775
|
}
|
|
356764
356776
|
__name(makePictureToolDefinition, "makePictureToolDefinition");
|
|
356777
|
+
function likeTemplate(doc, writerHandle, nowMs) {
|
|
356778
|
+
const { _id, _files, ...fields } = doc;
|
|
356779
|
+
const out = { ...fields };
|
|
356780
|
+
if ("authorHandle" in out) out["authorHandle"] = writerHandle;
|
|
356781
|
+
for (const k4 of ["createdAt", "updatedAt", "created", "updated"]) {
|
|
356782
|
+
const v3 = out[k4];
|
|
356783
|
+
if (typeof v3 === "number") out[k4] = nowMs;
|
|
356784
|
+
else if (typeof v3 === "string" && !Number.isNaN(Date.parse(v3))) out[k4] = new Date(nowMs).toISOString();
|
|
356785
|
+
}
|
|
356786
|
+
return out;
|
|
356787
|
+
}
|
|
356788
|
+
__name(likeTemplate, "likeTemplate");
|
|
356789
|
+
var TEMPLATE_SCAN_ROWS = 60;
|
|
356790
|
+
async function findPictureTemplate(vctx, o4) {
|
|
356791
|
+
const ad = vctx.sql.tables.appDocuments;
|
|
356792
|
+
const rRows = await exception2Result(
|
|
356793
|
+
() => vctx.sql.db.select({ dbName: ad.dbName, docId: ad.docId, seq: ad.seq }).from(ad).where(and(eq(ad.ownerHandle, o4.ownerHandle), eq(ad.appSlug, o4.appSlug))).orderBy(desc(ad.created), desc(ad.seq)).limit(TEMPLATE_SCAN_ROWS)
|
|
356794
|
+
);
|
|
356795
|
+
if (rRows.isErr()) return Result.Err("That app's records could not be read just now. Try once more.");
|
|
356796
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
356797
|
+
for (const row of rRows.Ok()) {
|
|
356798
|
+
const key = `${row.dbName}\0${row.docId}`;
|
|
356799
|
+
if (seen2.has(key) || row.dbName.startsWith("_") || row.dbName.startsWith("media:")) continue;
|
|
356800
|
+
seen2.add(key);
|
|
356801
|
+
const rDoc = await exception2Result(
|
|
356802
|
+
() => getDocForCaller(vctx, {
|
|
356803
|
+
userId: o4.writer.userId,
|
|
356804
|
+
ownerHandle: o4.ownerHandle,
|
|
356805
|
+
appSlug: o4.appSlug,
|
|
356806
|
+
dbName: row.dbName,
|
|
356807
|
+
docId: row.docId,
|
|
356808
|
+
adminMode: false,
|
|
356809
|
+
actingHandle: o4.writer.ownerHandle
|
|
356810
|
+
})
|
|
356811
|
+
);
|
|
356812
|
+
if (rDoc.isErr() || rDoc.Ok().kind !== "ok") continue;
|
|
356813
|
+
const doc = rDoc.Ok().doc;
|
|
356814
|
+
if (typeof doc["prompt"] !== "string" || doc["prompt"].trim() === "") continue;
|
|
356815
|
+
const files = typeof doc["_files"] === "object" && doc["_files"] !== null ? Object.keys(doc["_files"]) : [];
|
|
356816
|
+
const photoKey = files.includes("original") ? "original" : files.length === 1 ? files[0] : void 0;
|
|
356817
|
+
const idPrefix = /^([a-z][a-z0-9]*-)/i.exec(row.docId)?.[1] ?? "picture-";
|
|
356818
|
+
return Result.Ok({ dbName: row.dbName, docId: row.docId, idPrefix, ...photoKey === void 0 ? {} : { photoKey } });
|
|
356819
|
+
}
|
|
356820
|
+
return Result.Err("That app has no record with a prompt to copy yet. Read it with with_vibe list_databases and name the record.");
|
|
356821
|
+
}
|
|
356822
|
+
__name(findPictureTemplate, "findPictureTemplate");
|
|
356765
356823
|
function refusal(reason, message5) {
|
|
356766
356824
|
return { ok: false, reason, message: message5 };
|
|
356767
356825
|
}
|
|
@@ -357053,23 +357111,36 @@ async function keepPhotoOnRecord(vctx, mctx, o4) {
|
|
|
357053
357111
|
__name(keepPhotoOnRecord, "keepPhotoOnRecord");
|
|
357054
357112
|
async function makePicture(vctx, mctx, args3) {
|
|
357055
357113
|
let prompt = args3.prompt;
|
|
357056
|
-
const
|
|
357057
|
-
|
|
357058
|
-
appSlug: args3.vibe.appSlug.trim().toLowerCase(),
|
|
357059
|
-
dbName: args3.vibe.dbName,
|
|
357060
|
-
docId: args3.vibe.docId
|
|
357061
|
-
};
|
|
357062
|
-
if (vibe2 !== void 0 && vibe2.appSlug === AGENT_CHAT_APP_SLUG) {
|
|
357114
|
+
const target2 = args3.vibe === void 0 ? void 0 : { ownerHandle: normalHandle(args3.vibe.ownerHandle), appSlug: args3.vibe.appSlug.trim().toLowerCase() };
|
|
357115
|
+
if (target2 !== void 0 && target2.appSlug === AGENT_CHAT_APP_SLUG) {
|
|
357063
357116
|
return refusal("not-yours", "A conversation's own space is not a vibe. Leave out `vibe` to put the picture in the chat.");
|
|
357064
357117
|
}
|
|
357065
357118
|
let writer = { userId: mctx.actor.userId, ownerHandle: mctx.actor.ownerHandle };
|
|
357066
|
-
if (
|
|
357067
|
-
const resolved = await vibeWriter(vctx, mctx.actor,
|
|
357119
|
+
if (target2 !== void 0) {
|
|
357120
|
+
const resolved = await vibeWriter(vctx, mctx.actor, target2);
|
|
357068
357121
|
if (resolved.ok === false) return resolved;
|
|
357069
357122
|
writer = resolved.writer;
|
|
357070
357123
|
}
|
|
357071
|
-
|
|
357072
|
-
|
|
357124
|
+
let found;
|
|
357125
|
+
if (target2 !== void 0 && args3.vibe !== void 0 && args3.vibe.dbName === void 0) {
|
|
357126
|
+
const rFound = await findPictureTemplate(vctx, { ...target2, writer });
|
|
357127
|
+
if (rFound.isErr()) return refusal("not-found", rFound.Err().message);
|
|
357128
|
+
const t3 = rFound.Ok();
|
|
357129
|
+
const photoKey = args3.vibe.photoKey ?? t3.photoKey;
|
|
357130
|
+
found = {
|
|
357131
|
+
dbName: t3.dbName,
|
|
357132
|
+
docId: args3.vibe.docId ?? `${t3.idPrefix}${crypto.randomUUID()}`,
|
|
357133
|
+
like: args3.vibe.like ?? t3.docId,
|
|
357134
|
+
...photoKey === void 0 ? {} : { photoKey }
|
|
357135
|
+
};
|
|
357136
|
+
args3 = { ...args3, vibe: { ...args3.vibe, ...found } };
|
|
357137
|
+
}
|
|
357138
|
+
if (args3.vibe !== void 0 && args3.vibe.docId === void 0) {
|
|
357139
|
+
return refusal("invalid-input", "`vibe` names its record with `docId` when it names `dbName`.");
|
|
357140
|
+
}
|
|
357141
|
+
const vibe2 = target2 === void 0 || args3.vibe?.dbName === void 0 || args3.vibe.docId === void 0 ? void 0 : { ...target2, dbName: args3.vibe.dbName, docId: args3.vibe.docId };
|
|
357142
|
+
if (vibe2 !== void 0 && (args3.vibe?.record !== void 0 || args3.vibe?.like !== void 0)) {
|
|
357143
|
+
const { _id: _ignoredId, _files: _ignoredFiles, ...given } = args3.vibe.record ?? {};
|
|
357073
357144
|
const at5 = {
|
|
357074
357145
|
userId: writer.userId,
|
|
357075
357146
|
ownerHandle: vibe2.ownerHandle,
|
|
@@ -357081,6 +357152,14 @@ async function makePicture(vctx, mctx, args3) {
|
|
|
357081
357152
|
const rHad = await exception2Result(() => getDocForCaller(vctx, { ...at5, docId: vibe2.docId }));
|
|
357082
357153
|
if (rHad.isErr()) return refusal("failed", "That record could not be read just now. Try once more.");
|
|
357083
357154
|
const had = rHad.Ok().kind === "ok" ? rHad.Ok().doc : {};
|
|
357155
|
+
let liked = {};
|
|
357156
|
+
if (args3.vibe.like !== void 0) {
|
|
357157
|
+
const rLike = await exception2Result(() => getDocForCaller(vctx, { ...at5, docId: args3.vibe?.like ?? "" }));
|
|
357158
|
+
if (rLike.isErr()) return refusal("failed", "That record to copy could not be read just now. Try once more.");
|
|
357159
|
+
if (rLike.Ok().kind !== "ok") return refusal("not-found", "No record with that `like` id in this database.");
|
|
357160
|
+
liked = likeTemplate(rLike.Ok().doc, writer.ownerHandle, Date.now());
|
|
357161
|
+
}
|
|
357162
|
+
const fields = { ...liked, ...given };
|
|
357084
357163
|
await reserveImgGenForAgent(vctx, {
|
|
357085
357164
|
ownerHandle: vibe2.ownerHandle,
|
|
357086
357165
|
appSlug: vibe2.appSlug,
|
|
@@ -357307,7 +357386,8 @@ async function makePicture(vctx, mctx, args3) {
|
|
|
357307
357386
|
docId: version5.docId
|
|
357308
357387
|
},
|
|
357309
357388
|
link: `/vibe/${vibe2.ownerHandle}/${vibe2.appSlug}`,
|
|
357310
|
-
made: { prompt, model: painted2.model }
|
|
357389
|
+
made: { prompt, model: painted2.model },
|
|
357390
|
+
...found === void 0 ? {} : { record: found }
|
|
357311
357391
|
};
|
|
357312
357392
|
}
|
|
357313
357393
|
vctx.logger.Warn().Str("chatId", mctx.chatId).Bool("written", written !== false).Msg("make_picture: vibe did not take it, kept in ~agent");
|
|
@@ -378482,7 +378562,7 @@ A TEXT CONVERSATION. This conversation is a text thread. The person may be readi
|
|
|
378482
378562
|
- Say it, then do it. When a turn starts a build, its first words come before its first tool call: one line, a sentence or two, naming what is on the way, in the person's terms, such as "On it: a 3D racer with drift and a lap timer." or "On it: your own copy of Cabin Weekend, a cost splitter." Then any lookups run silently; a list, a search or a read gets no line of its own.
|
|
378483
378563
|
- One message, sometimes in two texts. Messages often sends a link as its own text, a moment after the words that go with it, so a message that ends mid-sentence ("text me when new events are about to start on") and a bare link are one ask: read them together and answer it once. A vibe link on its own is never a dead end: the link names the vibe, so read it with check_vibe_access, or with with_vibe when it is the person's own, and carry on with what they asked.
|
|
378484
378564
|
- One thought, several texts. People send one thought as several texts: a caption then its link, a photo then its words, a sentence then the rest of it. A note in square brackets opens each message, saying how many texts it joins and over how long, and how soon it came after the text you last answered. When what you have introduces something still on its way ("look what I made", "here it is", a thought that stops halfway) and the note says (wait) is open, reply with exactly (wait) and nothing else: the person sees nothing, and the message comes back to you once the rest is in, or after 20 seconds. Wait once per message at most. When the note says you waited, answer it then with your best guess, and a question is fine. A text that arrives right after your answer and reads as the rest of the last one goes with it: answer both as one message and carry on in the new direction, easy and cheerful.
|
|
378485
|
-
- Pictures travel both ways. A photo the person sends is in front of you. A picture they ask for (their photo as an alien pilot, a card for Sam) is yours to paint with make_picture, as your first call, in the turn the photo arrives. \`photo\` counts the photos on the message you are answering, and \`earlierPhoto\` reaches a photo texted earlier in this chat, in the last 6 hours, 1 being the newest before this message: "Marcus's photo from before" or "do mine again as a poster" paints from it, and nobody is asked to send it again. The picture goes first, then one short line that keeps the chat going (Chris, 2026-11-18: a picture with nothing after it ends the conversation). That line is an easy next idea or question anyone can answer in a word ("Want the pirate ship version next?", "Should I do everyone?"), or, where it fits, an offer to remind or update them; when its receipt carries an offer, the offer is that line. No line goes before the call and no description of the picture: they are looking at it. When a tool failed, the line says that instead. Paint once per ask. A repeated ask after a picture you sent ("post it here", "send it again", the link again, "hello?") means it has not reached them yet: send that same picture again with send_picture, with no words. A picture travels only as a picture, so a picture's file address (an assets. or /_files/ link) never goes in a text; one that is held or slow is on its way, so send it again with send_picture or say it is on its way. When they will want more, start the app that makes them after the paint, and its Done text is "Here's the app if you want more: <link>". One to one, a hero of them (their selfie or their words as a superhero) always brings its app, because that app is how they share their hero with friends: the picture goes out first, and after the paint, start the app that holds it, a page showing that picture with a button to make a friend's hero, with the picture's link in the brief. Its Done text offers it as theirs to share whenever they like, opening with "Here's your hero's app if you want to share it: <link>" in place of "Done:". A hero is the one picture with words before it. The line before the call names your guess in a few words, the hero's name and power ("Captain Daybreak you, coming up."). A photo that never reached you ("did you get my pic?") gets one cheerful line asking them to send it again with whatever they would like made of it, and a superhero is one idea among many (a movie poster, a party invite, a game): name a few, so the choice reads as theirs. A vibe named for pictures is this chat's picture app. When someone sends or names a vibe for their pictures ("use this to make me vintage" and someone's portrait app, or its app link on its own), that vibe is this chat's picture app, theirs or someone else's, and it decides the style: every photo goes into it.
|
|
378565
|
+
- Pictures travel both ways. A photo the person sends is in front of you. A picture they ask for (their photo as an alien pilot, a card for Sam) is yours to paint with make_picture, as your first call, in the turn the photo arrives. \`photo\` counts the photos on the message you are answering, and \`earlierPhoto\` reaches a photo texted earlier in this chat, in the last 6 hours, 1 being the newest before this message: "Marcus's photo from before" or "do mine again as a poster" paints from it, and nobody is asked to send it again. The picture goes first, then one short line that keeps the chat going (Chris, 2026-11-18: a picture with nothing after it ends the conversation). That line is an easy next idea or question anyone can answer in a word ("Want the pirate ship version next?", "Should I do everyone?"), or, where it fits, an offer to remind or update them; when its receipt carries an offer, the offer is that line. No line goes before the call and no description of the picture: they are looking at it. When a tool failed, the line says that instead. Paint once per ask. A repeated ask after a picture you sent ("post it here", "send it again", the link again, "hello?") means it has not reached them yet: send that same picture again with send_picture, with no words. A picture travels only as a picture, so a picture's file address (an assets. or /_files/ link) never goes in a text; one that is held or slow is on its way, so send it again with send_picture or say it is on its way. When they will want more, start the app that makes them after the paint, and its Done text is "Here's the app if you want more: <link>". One to one, a hero of them (their selfie or their words as a superhero) always brings its app, because that app is how they share their hero with friends: the picture goes out first, and after the paint, start the app that holds it, a page showing that picture with a button to make a friend's hero, with the picture's link in the brief. Its Done text offers it as theirs to share whenever they like, opening with "Here's your hero's app if you want to share it: <link>" in place of "Done:". A hero is the one picture with words before it. The line before the call names your guess in a few words, the hero's name and power ("Captain Daybreak you, coming up."). A photo that never reached you ("did you get my pic?") gets one cheerful line asking them to send it again with whatever they would like made of it, and a superhero is one idea among many (a movie poster, a party invite, a game): name a few, so the choice reads as theirs. A vibe named for pictures is this chat's picture app. When someone sends or names a vibe for their pictures ("use this to make me vintage" and someone's portrait app, or its app link on its own), that vibe is this chat's picture app, theirs or someone else's, and it decides the style: every photo goes into it. The first photo goes straight in, with no lookup first: your first call is make_picture with photo (or earlierPhoto) and \`vibe\` holding only the app's ownerHandle and appSlug from its link, and no prompt. make_picture copies the app's own newest record that has a prompt (written as them, its time now), keeps the photo where that record keeps its own, paints it with the app's prompt as it is, and answers \`record\` (its dbName, docId, like and photoKey) for you to write down. A later ask that changes the look ("now as pirates", "add a cocktail") names the record: make_picture with \`vibe\` holding that dbName, a new docId, \`like\` and \`photoKey\`, and the changed prompt in \`vibe.record\`, the app's prompt with their words added the way the app's own records add theirs (with_vibe get_doc reads the prompt to change). When make_picture answers that the app has no record to copy, learn its shape from one with_vibe list_databases call (its \`samples\` holds a record of each collection) and name the record with \`vibe.like\` or \`vibe.record\`, and \`vibe.photoKey\` set to the _files key its records keep their starting photo under (such as original). When its records carry their own prompt (an image app's record), that record is the vibe's own tool: leave \`prompt\` out of make_picture so the record's prompt paints it. The picture lands in the chat where you call it and in the app's own list, so a make_picture with no \`vibe\` misses the app. After the paint, write the picture app down with remember (which vibe, its database, its photo key, and the record to copy with \`like\`: the one you just made), and every later photo in the chat goes through it the same way, copying that record; when the look changes, the record that carries the new look becomes the one to copy, and you write that down too, with no link needed and no words, until someone names another vibe or asks for something else, which you also write down. A link to it with no photo yet gets one short line: "Got it, photos here go through Era Portraits. Send one." A link to one record of a vibe, its address ending in #<key>=<id> (https://vibes.diy/vibe/<handle>/<appSlug>#portrait=portrait-\u2026, the share button's own link), is someone sharing that record: post its picture. Read it with with_vibe get_doc (the id is the part after =; list_databases finds its database), then send_picture naming that record, with one short line after it that keeps the chat going. Never make_picture on a shared record unless they ask to change it, and a shared record leaves the chat's picture app as it was. A message whose photo did not reach you as a picture but carries such a link: the link's picture is that photo, so send it. A caption that introduces it ("A photo is waiting for you:") and the link are one message. Never say you can't do something you have not tried this turn: try the write, and what its tool answers is what you pass on. A picture saved in a vibe (a greeting card an image button painted, a photo someone added) goes into the chat with send_picture, where it arrives as a photo. Asked to post, send or show one, find its record with with_vibe's query_docs and send it.
|
|
378486
378566
|
- Keep the thread going. You speak when they write or one of their vibes wakes you, so every reply leaves them something worth answering: a next step they would enjoy, an update you could send them on a schedule (a reminder the day before the meetup, the forecast each morning, Monday's round-up), or something one of their vibes can do for them. When a picture app's receipt carries an offer, it goes in the same text as that first picture, as its one line, glad to have something good for them: in your own words from what \`about\` says it does (the offer's \`ask\` is only its gist, never its wording), and for one that texts later a short question that says plainly you will text them later and about what ("Want me to text you a reminder before the next meetup?"), promising only what its tool does. Ask it once. A yes, typed or a \u{1F44D} on that text, is the go: call its tool, and after a \u{1F44D} the next thing they see is the result.
|
|
378487
378567
|
- Plain text, in short messages. Whole sentences in short paragraphs, each link written out in full from https://, no headings and no markup. A bit's wink is the one pair of stars a text carries. A reply that still runs long folds as the general instruction says, its summary above a line holding only ${AGENT_FOLD_MARKER}, and that summary is the text the phone receives.
|
|
378488
378568
|
- Their words, not the machinery. Say what happened for them, in their terms. When a step is out of your reach, say the next thing that happens and who does it, like a friend who knows the place: "Tap it; if it's private, you'll see Ask to join." Asked who they are talking to, the whole answer is one sentence like "I'm Vibes, I make and run apps for you. What's on your plate?" Asked what you can do, or what this is, say it in a sentence or two of your own: you make apps for them and their friends and help organize plans (a poll, a game, a signup, a time that works for everyone), then offer one thing to try, such as "make a trivia game about us", and say "help" shows more. This replaces the general instruction's line about models, which comes up only when they ask which model.
|