vibes-diy 14.3.364 → 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.
package/cli/cmd-evento.d.ts
CHANGED
|
@@ -475,6 +475,7 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
|
|
|
475
475
|
updatedAt: string;
|
|
476
476
|
claimId?: string | undefined;
|
|
477
477
|
asker?: boolean | undefined;
|
|
478
|
+
guestAskerUserId?: string | undefined;
|
|
478
479
|
} | {
|
|
479
480
|
type: "groupSponsor";
|
|
480
481
|
sponsorUserId: string;
|
|
@@ -1470,6 +1471,7 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
|
|
|
1470
1471
|
guest?: boolean | undefined;
|
|
1471
1472
|
asker?: boolean | undefined;
|
|
1472
1473
|
sponsored?: boolean | undefined;
|
|
1474
|
+
guestAsker?: string | undefined;
|
|
1473
1475
|
members?: string | undefined;
|
|
1474
1476
|
}, {
|
|
1475
1477
|
type: "vibes-diy.cli.res-phone-link-pay-for-group";
|
|
@@ -57,6 +57,7 @@ export declare const ReqPhoneLinkPayForGroupCli: import("arktype/internal/varian
|
|
|
57
57
|
guest?: boolean | undefined;
|
|
58
58
|
asker?: boolean | undefined;
|
|
59
59
|
sponsored?: boolean | undefined;
|
|
60
|
+
guestAsker?: string | undefined;
|
|
60
61
|
members?: string | undefined;
|
|
61
62
|
}, {}>;
|
|
62
63
|
export type ReqPhoneLinkPayForGroupCli = typeof ReqPhoneLinkPayForGroupCli.infer;
|
|
@@ -322,6 +323,7 @@ export declare function phoneLinkSubcommands(ctx: CliCtx): Partial<import("cmd-t
|
|
|
322
323
|
guest: boolean;
|
|
323
324
|
asker: boolean;
|
|
324
325
|
sponsored: boolean;
|
|
326
|
+
guestAsker: string;
|
|
325
327
|
members: string;
|
|
326
328
|
};
|
|
327
329
|
} | {
|
|
@@ -443,6 +445,7 @@ export declare function phoneLinkSubcommands(ctx: CliCtx): Partial<import("cmd-t
|
|
|
443
445
|
guest: boolean;
|
|
444
446
|
asker: boolean;
|
|
445
447
|
sponsored: boolean;
|
|
448
|
+
guestAsker: string;
|
|
446
449
|
members: string;
|
|
447
450
|
};
|
|
448
451
|
} | {
|
|
@@ -154,6 +154,7 @@ export const ReqPhoneLinkPayForGroupCli = type({
|
|
|
154
154
|
"guest?": "boolean",
|
|
155
155
|
"asker?": "boolean",
|
|
156
156
|
"sponsored?": "boolean",
|
|
157
|
+
"guestAsker?": "string",
|
|
157
158
|
"members?": "string",
|
|
158
159
|
});
|
|
159
160
|
export function isReqPhoneLinkPayForGroupCli(obj) {
|
|
@@ -188,6 +189,7 @@ export const phoneLinkPayForGroupEvento = {
|
|
|
188
189
|
...(args.guest === true ? { guest: true } : {}),
|
|
189
190
|
...(args.asker === true ? { asker: true } : {}),
|
|
190
191
|
...(args.sponsored === true ? { sponsored: true } : {}),
|
|
192
|
+
...(args.sponsored === true && args.guestAsker !== undefined ? { guestAsker: args.guestAsker } : {}),
|
|
191
193
|
...(args.members === undefined || args.members.trim() === ""
|
|
192
194
|
? {}
|
|
193
195
|
: {
|
|
@@ -240,6 +242,13 @@ function phoneLinkPayForGroupCmd(ctx) {
|
|
|
240
242
|
description: "Bridge accounts only: a member who hasn't linked asked in a sponsored chat, so the turn runs on the sponsor's credits.",
|
|
241
243
|
defaultValue: () => ctx.sthis.env.get("VIBES_PAY_SPONSORED") === "1",
|
|
242
244
|
}),
|
|
245
|
+
guestAsker: option({
|
|
246
|
+
long: "guest-asker",
|
|
247
|
+
description: "With --sponsored: that member's own one-to-one phone-guest principal (group:<id>), so their yes to a text-later offer is theirs.",
|
|
248
|
+
type: string,
|
|
249
|
+
defaultValue: () => ctx.sthis.env.get("VIBES_PAY_GUEST_ASKER") ?? "",
|
|
250
|
+
defaultValueIsSerializable: true,
|
|
251
|
+
}),
|
|
243
252
|
members: option({
|
|
244
253
|
long: "members",
|
|
245
254
|
description: "The chat's linked members by handle, comma separated, for your own list of group chats.",
|
|
@@ -256,6 +265,7 @@ function phoneLinkPayForGroupCmd(ctx) {
|
|
|
256
265
|
...(args.guest ? { guest: true } : {}),
|
|
257
266
|
...(args.asker ? { asker: true } : {}),
|
|
258
267
|
...(args.sponsored ? { sponsored: true } : {}),
|
|
268
|
+
...(args.sponsored && args.guestAsker.trim() !== "" ? { guestAsker: args.guestAsker.trim() } : {}),
|
|
259
269
|
...(args.members === "" ? {} : { members: args.members }),
|
|
260
270
|
};
|
|
261
271
|
}),
|
|
@@ -208589,6 +208589,14 @@ var reqSetGroupPayer = lazyType(
|
|
|
208589
208589
|
* sponsored group, so the turn runs on the sponsor's credits, acting as nobody.
|
|
208590
208590
|
*/
|
|
208591
208591
|
"sponsored?": "boolean",
|
|
208592
|
+
/**
|
|
208593
|
+
* With `sponsored` only (issue #10043, Chris 2026-11-18): the member who hasn't linked, named by
|
|
208594
|
+
* their own one-to-one phone-guest principal (`group:<id>`, the one a direct chat with their
|
|
208595
|
+
* number gets). Their yes to a text-later offer on this turn is recorded under it, and that one
|
|
208596
|
+
* tool runs as it, so its later text reaches them one to one, never the group. Acts as nobody
|
|
208597
|
+
* anywhere else.
|
|
208598
|
+
*/
|
|
208599
|
+
"guestAsker?": "string",
|
|
208592
208600
|
/** The bridge's view of the chat's other linked members, by handle, for the caller's group list. */
|
|
208593
208601
|
"memberHandles?": "string[]"
|
|
208594
208602
|
})
|
|
@@ -209872,7 +209880,13 @@ var userSettingGroupPayer = lazyType(
|
|
|
209872
209880
|
* bridge runs on their credits. Only then may the group act as them inside other people's
|
|
209873
209881
|
* vibes (`with_vibe`'s asker lane). Absent: billing only.
|
|
209874
209882
|
*/
|
|
209875
|
-
"asker?": "boolean"
|
|
209883
|
+
"asker?": "boolean",
|
|
209884
|
+
/**
|
|
209885
|
+
* A sponsored turn from a member who hasn't linked (issue #10043): their own one-to-one
|
|
209886
|
+
* phone-guest principal, named by the bridge. Read only for a text-later yes
|
|
209887
|
+
* (`resolveTextConsentSpeaker`) and the one tool that yes runs; never an asker elsewhere.
|
|
209888
|
+
*/
|
|
209889
|
+
"guestAskerUserId?": "string"
|
|
209876
209890
|
})
|
|
209877
209891
|
);
|
|
209878
209892
|
var userSettingGroupSponsor = lazyType(
|
|
@@ -292481,7 +292495,8 @@ async function writeGroupPayer(sql2, args3) {
|
|
|
292481
292495
|
payerUserId: args3.payerUserId,
|
|
292482
292496
|
updatedAt: now3,
|
|
292483
292497
|
claimId,
|
|
292484
|
-
...args3.asker === true ? { asker: true } : {}
|
|
292498
|
+
...args3.asker === true ? { asker: true } : {},
|
|
292499
|
+
...args3.guestAskerUserId === void 0 ? {} : { guestAskerUserId: args3.guestAskerUserId }
|
|
292485
292500
|
}
|
|
292486
292501
|
];
|
|
292487
292502
|
if (row === void 0) {
|
|
@@ -292508,6 +292523,15 @@ async function readGroupAsker(sql2, args3) {
|
|
|
292508
292523
|
});
|
|
292509
292524
|
}
|
|
292510
292525
|
__name(readGroupAsker, "readGroupAsker");
|
|
292526
|
+
async function readGroupGuestAsker(sql2, groupUserId) {
|
|
292527
|
+
return exception2Result(async () => {
|
|
292528
|
+
const settings = await readSettings2(sql2, groupUserId);
|
|
292529
|
+
const id = settings?.find(isUserSettingGroupPayer)?.guestAskerUserId;
|
|
292530
|
+
if (id === void 0 || id === groupUserId || !isGroupPrincipal(id)) return void 0;
|
|
292531
|
+
return id;
|
|
292532
|
+
});
|
|
292533
|
+
}
|
|
292534
|
+
__name(readGroupGuestAsker, "readGroupGuestAsker");
|
|
292511
292535
|
async function replaceSettingsItem(sql2, args3) {
|
|
292512
292536
|
return exception2Result(async () => {
|
|
292513
292537
|
const t3 = sql2.tables.userSettings;
|
|
@@ -339249,11 +339273,25 @@ async function resolveTextConsentSpeaker(vctx, args3) {
|
|
|
339249
339273
|
return { ok: false, message: "Could not tell who said yes just now, so the tool did not run. Nothing was done." };
|
|
339250
339274
|
}
|
|
339251
339275
|
const writer = rWriter.Ok();
|
|
339252
|
-
if (writer.kind === "no-asker") return
|
|
339276
|
+
if (writer.kind === "no-asker") return guestSpeaker(vctx, args3.actorUserId);
|
|
339253
339277
|
if (writer.kind === "several-handles") return { ok: false, message: GROUP_ASKER_SEVERAL_HANDLES_MESSAGE };
|
|
339254
339278
|
return { ok: true, userId: writer.userId, ownerHandle: writer.ownerHandle };
|
|
339255
339279
|
}
|
|
339256
339280
|
__name(resolveTextConsentSpeaker, "resolveTextConsentSpeaker");
|
|
339281
|
+
async function guestSpeaker(vctx, groupUserId) {
|
|
339282
|
+
const unreadable = {
|
|
339283
|
+
ok: false,
|
|
339284
|
+
message: "Could not tell who said yes just now, so the tool did not run. Nothing was done."
|
|
339285
|
+
};
|
|
339286
|
+
const rGuest = await readGroupGuestAsker(vctx.sql, groupUserId);
|
|
339287
|
+
if (rGuest.isErr()) return unreadable;
|
|
339288
|
+
const guestUserId = rGuest.Ok();
|
|
339289
|
+
if (guestUserId === void 0) return { ok: false, message: TEXT_CONSENT_NO_SPEAKER_MESSAGE };
|
|
339290
|
+
const rHandle = await resolveAgentActor(vctx, { userId: guestUserId });
|
|
339291
|
+
if (rHandle.isErr()) return unreadable;
|
|
339292
|
+
return { ok: true, userId: guestUserId, ownerHandle: rHandle.Ok().ownerHandle, runsAsSpeaker: true };
|
|
339293
|
+
}
|
|
339294
|
+
__name(guestSpeaker, "guestSpeaker");
|
|
339257
339295
|
|
|
339258
339296
|
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/backend-notify-callback.ts
|
|
339259
339297
|
var MAX_BODY_CHARS = 500;
|
|
@@ -352319,6 +352357,20 @@ async function noteMemberTurn(vctx, groupUserId) {
|
|
|
352319
352357
|
if (r2.isErr()) vctx.logger.Warn().Err(r2).Str("groupUserId", groupUserId).Msg("vibe-outreach: member turn not noted");
|
|
352320
352358
|
}
|
|
352321
352359
|
__name(noteMemberTurn, "noteMemberTurn");
|
|
352360
|
+
async function phoneGuestAsker(vctx, groupUserId, guestAsker) {
|
|
352361
|
+
if (guestAsker === void 0) return void 0;
|
|
352362
|
+
if (guestAsker === groupUserId || !isGroupPrincipal(guestAsker)) {
|
|
352363
|
+
vctx.logger.Warn().Str("groupUserId", groupUserId).Msg("group-payer: guest asker is no phone guest");
|
|
352364
|
+
return void 0;
|
|
352365
|
+
}
|
|
352366
|
+
const own2 = await readGroupPayer(vctx.sql, guestAsker);
|
|
352367
|
+
if (own2.isErr() || own2.Ok() !== guestAsker) {
|
|
352368
|
+
vctx.logger.Warn().Str("groupUserId", groupUserId).Msg("group-payer: guest asker is no phone guest");
|
|
352369
|
+
return void 0;
|
|
352370
|
+
}
|
|
352371
|
+
return guestAsker;
|
|
352372
|
+
}
|
|
352373
|
+
__name(phoneGuestAsker, "phoneGuestAsker");
|
|
352322
352374
|
function refuse7(code2, message5) {
|
|
352323
352375
|
return { type: "vibes.diy.res-error", error: { message: message5, code: code2 } };
|
|
352324
352376
|
}
|
|
@@ -352401,7 +352453,12 @@ async function setGroupPayer(vctx, args3) {
|
|
|
352401
352453
|
sponsorUserId = args3.callerUserId;
|
|
352402
352454
|
vctx.logger.Info().Str("groupUserId", args3.groupUserId).Str("payerUserId", sponsorUserId).Msg("group-payer: bridge sponsor");
|
|
352403
352455
|
}
|
|
352404
|
-
const
|
|
352456
|
+
const guestAskerUserId = await phoneGuestAsker(vctx, args3.groupUserId, args3.guestAsker);
|
|
352457
|
+
const written2 = await writeGroupPayer(vctx.sql, {
|
|
352458
|
+
groupUserId: args3.groupUserId,
|
|
352459
|
+
payerUserId: sponsorUserId,
|
|
352460
|
+
...guestAskerUserId === void 0 ? {} : { guestAskerUserId }
|
|
352461
|
+
});
|
|
352405
352462
|
if (written2.isErr()) {
|
|
352406
352463
|
vctx.logger.Error().Err(written2.Err()).Str("groupUserId", args3.groupUserId).Msg("group-payer: sponsored write failed");
|
|
352407
352464
|
return refuse7(GROUP_PAYER_ERROR.unavailable, "Couldn't record that. Try again in a moment.");
|
|
@@ -352464,6 +352521,7 @@ var setGroupPayerEvento = {
|
|
|
352464
352521
|
...req2.guest === true ? { guest: true } : {},
|
|
352465
352522
|
...req2.asker === true ? { asker: true } : {},
|
|
352466
352523
|
...req2.sponsored === true ? { sponsored: true } : {},
|
|
352524
|
+
...req2.guestAsker === void 0 ? {} : { guestAsker: req2.guestAsker },
|
|
352467
352525
|
...req2.memberHandles === void 0 ? {} : { memberHandles: req2.memberHandles.slice(0, 20) }
|
|
352468
352526
|
});
|
|
352469
352527
|
await ctx.send.send(ctx, res);
|
|
@@ -356643,7 +356701,15 @@ var makePictureInput = lazyType(
|
|
|
356643
356701
|
"photo?": "number.integer >= 1",
|
|
356644
356702
|
"earlierPhoto?": "number.integer >= 1",
|
|
356645
356703
|
"sourceRecord?": type({ ...recordRef, "fileKey?": "string" }).onUndeclaredKey("reject"),
|
|
356646
|
-
"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")
|
|
356647
356713
|
}).onUndeclaredKey("reject")
|
|
356648
356714
|
);
|
|
356649
356715
|
function makePictureToolDefinition() {
|
|
@@ -356679,7 +356745,7 @@ function makePictureToolDefinition() {
|
|
|
356679
356745
|
},
|
|
356680
356746
|
vibe: {
|
|
356681
356747
|
type: "object",
|
|
356682
|
-
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.",
|
|
356683
356749
|
properties: {
|
|
356684
356750
|
ownerHandle: { type: "string" },
|
|
356685
356751
|
appSlug: { type: "string" },
|
|
@@ -356691,10 +356757,14 @@ function makePictureToolDefinition() {
|
|
|
356691
356757
|
},
|
|
356692
356758
|
record: {
|
|
356693
356759
|
type: "object",
|
|
356694
|
-
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."
|
|
356695
356765
|
}
|
|
356696
356766
|
},
|
|
356697
|
-
required: ["ownerHandle", "appSlug"
|
|
356767
|
+
required: ["ownerHandle", "appSlug"],
|
|
356698
356768
|
additionalProperties: false
|
|
356699
356769
|
}
|
|
356700
356770
|
},
|
|
@@ -356704,6 +356774,52 @@ function makePictureToolDefinition() {
|
|
|
356704
356774
|
};
|
|
356705
356775
|
}
|
|
356706
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");
|
|
356707
356823
|
function refusal(reason, message5) {
|
|
356708
356824
|
return { ok: false, reason, message: message5 };
|
|
356709
356825
|
}
|
|
@@ -356995,23 +357111,36 @@ async function keepPhotoOnRecord(vctx, mctx, o4) {
|
|
|
356995
357111
|
__name(keepPhotoOnRecord, "keepPhotoOnRecord");
|
|
356996
357112
|
async function makePicture(vctx, mctx, args3) {
|
|
356997
357113
|
let prompt = args3.prompt;
|
|
356998
|
-
const
|
|
356999
|
-
|
|
357000
|
-
appSlug: args3.vibe.appSlug.trim().toLowerCase(),
|
|
357001
|
-
dbName: args3.vibe.dbName,
|
|
357002
|
-
docId: args3.vibe.docId
|
|
357003
|
-
};
|
|
357004
|
-
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) {
|
|
357005
357116
|
return refusal("not-yours", "A conversation's own space is not a vibe. Leave out `vibe` to put the picture in the chat.");
|
|
357006
357117
|
}
|
|
357007
357118
|
let writer = { userId: mctx.actor.userId, ownerHandle: mctx.actor.ownerHandle };
|
|
357008
|
-
if (
|
|
357009
|
-
const resolved = await vibeWriter(vctx, mctx.actor,
|
|
357119
|
+
if (target2 !== void 0) {
|
|
357120
|
+
const resolved = await vibeWriter(vctx, mctx.actor, target2);
|
|
357010
357121
|
if (resolved.ok === false) return resolved;
|
|
357011
357122
|
writer = resolved.writer;
|
|
357012
357123
|
}
|
|
357013
|
-
|
|
357014
|
-
|
|
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 ?? {};
|
|
357015
357144
|
const at5 = {
|
|
357016
357145
|
userId: writer.userId,
|
|
357017
357146
|
ownerHandle: vibe2.ownerHandle,
|
|
@@ -357023,6 +357152,14 @@ async function makePicture(vctx, mctx, args3) {
|
|
|
357023
357152
|
const rHad = await exception2Result(() => getDocForCaller(vctx, { ...at5, docId: vibe2.docId }));
|
|
357024
357153
|
if (rHad.isErr()) return refusal("failed", "That record could not be read just now. Try once more.");
|
|
357025
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 };
|
|
357026
357163
|
await reserveImgGenForAgent(vctx, {
|
|
357027
357164
|
ownerHandle: vibe2.ownerHandle,
|
|
357028
357165
|
appSlug: vibe2.appSlug,
|
|
@@ -357249,7 +357386,8 @@ async function makePicture(vctx, mctx, args3) {
|
|
|
357249
357386
|
docId: version5.docId
|
|
357250
357387
|
},
|
|
357251
357388
|
link: `/vibe/${vibe2.ownerHandle}/${vibe2.appSlug}`,
|
|
357252
|
-
made: { prompt, model: painted2.model }
|
|
357389
|
+
made: { prompt, model: painted2.model },
|
|
357390
|
+
...found === void 0 ? {} : { record: found }
|
|
357253
357391
|
};
|
|
357254
357392
|
}
|
|
357255
357393
|
vctx.logger.Warn().Str("chatId", mctx.chatId).Bool("written", written !== false).Msg("make_picture: vibe did not take it, kept in ~agent");
|
|
@@ -378424,7 +378562,7 @@ A TEXT CONVERSATION. This conversation is a text thread. The person may be readi
|
|
|
378424
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.
|
|
378425
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.
|
|
378426
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.
|
|
378427
|
-
- 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.
|
|
378428
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.
|
|
378429
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.
|
|
378430
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.
|
|
@@ -384361,17 +384499,21 @@ function createVibeToolInnerExecutor(host, target2) {
|
|
|
384361
384499
|
const listed2 = rListed.isOk() ? rListed.Ok().find((t3) => t3.name === toolName) : void 0;
|
|
384362
384500
|
const wireName = vibeToolWireName(target2.appSlug, toolName);
|
|
384363
384501
|
if (listed2 === void 0) return json5(vibeToolCallAnswer(wireName, { reason: "no_tool" }));
|
|
384502
|
+
let runAs = {
|
|
384503
|
+
callerUserId: target2.callerUserId,
|
|
384504
|
+
...target2.payerUserId === void 0 ? {} : { payerUserId: target2.payerUserId }
|
|
384505
|
+
};
|
|
384364
384506
|
if (isTextLaterOffer(listed2)) {
|
|
384365
|
-
const
|
|
384366
|
-
if (
|
|
384507
|
+
const yes = await recordTextLaterYes({ host, target: target2, wireName, toolName });
|
|
384508
|
+
if (yes.ok === false) return json5(yes.refusal);
|
|
384509
|
+
if (yes.runsAs !== void 0) runAs = { callerUserId: yes.runsAs, payerUserId: target2.payerUserId ?? target2.callerUserId };
|
|
384367
384510
|
}
|
|
384368
384511
|
const outcome = await host.call({
|
|
384369
384512
|
ownerHandle: target2.ownerHandle,
|
|
384370
384513
|
appSlug: target2.appSlug,
|
|
384371
|
-
callerUserId: target2.callerUserId,
|
|
384372
384514
|
toolName,
|
|
384373
384515
|
input: args3.input ?? {},
|
|
384374
|
-
...
|
|
384516
|
+
...runAs
|
|
384375
384517
|
});
|
|
384376
384518
|
return json5(vibeToolCallAnswer(wireName, outcome));
|
|
384377
384519
|
}
|
|
@@ -384379,19 +384521,39 @@ function createVibeToolInnerExecutor(host, target2) {
|
|
|
384379
384521
|
};
|
|
384380
384522
|
}
|
|
384381
384523
|
__name(createVibeToolInnerExecutor, "createVibeToolInnerExecutor");
|
|
384382
|
-
async function recordTextLaterYes(
|
|
384524
|
+
async function recordTextLaterYes({
|
|
384525
|
+
host,
|
|
384526
|
+
target: target2,
|
|
384527
|
+
wireName,
|
|
384528
|
+
toolName
|
|
384529
|
+
}) {
|
|
384530
|
+
const refuse16 = /* @__PURE__ */ __name((refusal5) => ({ ok: false, refusal: refusal5 }), "refuse");
|
|
384383
384531
|
const consent = target2.textLater;
|
|
384384
384532
|
if (consent === void 0) {
|
|
384385
|
-
return {
|
|
384533
|
+
return refuse16({
|
|
384386
384534
|
ok: false,
|
|
384387
384535
|
reason: "no-consent-record",
|
|
384388
384536
|
tool: wireName,
|
|
384389
384537
|
message: "This tool texts the person later, and their yes can't be recorded here, so it did not run. Nothing was done."
|
|
384390
|
-
};
|
|
384538
|
+
});
|
|
384391
384539
|
}
|
|
384392
384540
|
const rWho = await exception2Result(() => consent.speaker());
|
|
384393
384541
|
const who = rWho.isOk() ? rWho.Ok() : { ok: false, message: "Could not tell who said yes just now, so the tool did not run. Nothing was done." };
|
|
384394
|
-
if (who.ok === false) return { ok: false, reason: "no-speaker", tool: wireName, message: who.message };
|
|
384542
|
+
if (who.ok === false) return refuse16({ ok: false, reason: "no-speaker", tool: wireName, message: who.message });
|
|
384543
|
+
const runsAs = who.runsAsSpeaker === true && who.userId !== target2.callerUserId ? who.userId : void 0;
|
|
384544
|
+
if (runsAs !== void 0) {
|
|
384545
|
+
const rTheirs = await exception2Result(
|
|
384546
|
+
() => host.list({ ownerHandle: target2.ownerHandle, appSlug: target2.appSlug, callerUserId: runsAs })
|
|
384547
|
+
);
|
|
384548
|
+
if (!rTheirs.isOk() || !rTheirs.Ok().some((t3) => t3.name === toolName)) {
|
|
384549
|
+
return refuse16({
|
|
384550
|
+
ok: false,
|
|
384551
|
+
reason: "no-tool",
|
|
384552
|
+
tool: wireName,
|
|
384553
|
+
message: "This vibe doesn't offer that tool to the person who said yes, so it did not run. Nothing was done."
|
|
384554
|
+
});
|
|
384555
|
+
}
|
|
384556
|
+
}
|
|
384395
384557
|
const rAnswer = await exception2Result(() => consent.answer());
|
|
384396
384558
|
const answer13 = rAnswer.isOk() ? rAnswer.Ok() : { method: "typed", text: null };
|
|
384397
384559
|
const rQuestion = await exception2Result(() => consent.offerQuestion());
|
|
@@ -384408,13 +384570,13 @@ async function recordTextLaterYes(target2, wireName) {
|
|
|
384408
384570
|
answerText: personAnswerText(answer13.text)
|
|
384409
384571
|
})
|
|
384410
384572
|
);
|
|
384411
|
-
if (rRecorded.isOk() && rRecorded.Ok() === true) return void 0;
|
|
384412
|
-
return {
|
|
384573
|
+
if (rRecorded.isOk() && rRecorded.Ok() === true) return runsAs === void 0 ? { ok: true } : { ok: true, runsAs };
|
|
384574
|
+
return refuse16({
|
|
384413
384575
|
ok: false,
|
|
384414
384576
|
reason: "consent-not-recorded",
|
|
384415
384577
|
tool: wireName,
|
|
384416
384578
|
message: "Their yes could not be saved just now, so the tool did not run. Nothing was done; try again in a moment."
|
|
384417
|
-
};
|
|
384579
|
+
});
|
|
384418
384580
|
}
|
|
384419
384581
|
__name(recordTextLaterYes, "recordTextLaterYes");
|
|
384420
384582
|
function withVibeToolCalls(vibeTools, rest) {
|