vibes-diy 14.3.331 → 14.3.333
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 +6 -0
- package/cli/cmds/run/backend-worker/run-backend-entry.js +617 -243
- package/cli/cmds/run/bundle-inputs.json +8 -0
- package/cli/cmds/run/run-bundle.js +2914 -2510
- package/package.json +8 -8
|
@@ -17113,8 +17113,8 @@ var init_node = __esm({
|
|
|
17113
17113
|
return this.expression;
|
|
17114
17114
|
}
|
|
17115
17115
|
select(selector) {
|
|
17116
|
-
const
|
|
17117
|
-
return this._select(
|
|
17116
|
+
const normalized3 = NodeSelector.normalize(selector);
|
|
17117
|
+
return this._select(normalized3);
|
|
17118
17118
|
}
|
|
17119
17119
|
_select(selector) {
|
|
17120
17120
|
let nodes = NodeSelector.applyBoundary[selector.boundary ?? "references"](this);
|
|
@@ -17194,7 +17194,7 @@ var init_node = __esm({
|
|
|
17194
17194
|
return transformedNode = $4.node(this.kind, transformedInner, ctx.parseOptions);
|
|
17195
17195
|
}
|
|
17196
17196
|
configureReferences(meta3, selector = "references") {
|
|
17197
|
-
const
|
|
17197
|
+
const normalized3 = NodeSelector.normalize(selector);
|
|
17198
17198
|
const mapper = typeof meta3 === "string" ? (kind, inner) => ({
|
|
17199
17199
|
...inner,
|
|
17200
17200
|
meta: { ...inner.meta, description: meta3 }
|
|
@@ -17202,12 +17202,12 @@ var init_node = __esm({
|
|
|
17202
17202
|
...inner,
|
|
17203
17203
|
meta: { ...inner.meta, ...meta3 }
|
|
17204
17204
|
});
|
|
17205
|
-
if (
|
|
17205
|
+
if (normalized3.boundary === "self") {
|
|
17206
17206
|
return this.$.node(this.kind, mapper(this.kind, { ...this.inner, meta: this.meta }));
|
|
17207
17207
|
}
|
|
17208
|
-
const rawSelected = this._select(
|
|
17208
|
+
const rawSelected = this._select(normalized3);
|
|
17209
17209
|
const selected = rawSelected && liftArray(rawSelected);
|
|
17210
|
-
const shouldTransform =
|
|
17210
|
+
const shouldTransform = normalized3.boundary === "child" ? (node3, ctx) => ctx.root.children.includes(node3) : normalized3.boundary === "shallow" ? (node3) => node3.kind !== "structure" : () => true;
|
|
17211
17211
|
return this.$.finalize(this.transform(mapper, {
|
|
17212
17212
|
shouldTransform,
|
|
17213
17213
|
selected
|
|
@@ -17888,23 +17888,23 @@ var init_range = __esm({
|
|
|
17888
17888
|
createLengthSchemaNormalizer = /* @__PURE__ */ __name((kind) => (schema5) => {
|
|
17889
17889
|
if (typeof schema5 === "number")
|
|
17890
17890
|
return { rule: schema5 };
|
|
17891
|
-
const { exclusive, ...
|
|
17891
|
+
const { exclusive, ...normalized3 } = schema5;
|
|
17892
17892
|
return exclusive ? {
|
|
17893
|
-
...
|
|
17894
|
-
rule: kind === "minLength" ?
|
|
17895
|
-
} :
|
|
17893
|
+
...normalized3,
|
|
17894
|
+
rule: kind === "minLength" ? normalized3.rule + 1 : normalized3.rule - 1
|
|
17895
|
+
} : normalized3;
|
|
17896
17896
|
}, "createLengthSchemaNormalizer");
|
|
17897
17897
|
createDateSchemaNormalizer = /* @__PURE__ */ __name((kind) => (schema5) => {
|
|
17898
17898
|
if (typeof schema5 === "number" || typeof schema5 === "string" || schema5 instanceof Date)
|
|
17899
17899
|
return { rule: schema5 };
|
|
17900
|
-
const { exclusive, ...
|
|
17900
|
+
const { exclusive, ...normalized3 } = schema5;
|
|
17901
17901
|
if (!exclusive)
|
|
17902
|
-
return
|
|
17903
|
-
const numericLimit = typeof
|
|
17902
|
+
return normalized3;
|
|
17903
|
+
const numericLimit = typeof normalized3.rule === "number" ? normalized3.rule : typeof normalized3.rule === "string" ? new Date(normalized3.rule).valueOf() : normalized3.rule.valueOf();
|
|
17904
17904
|
return exclusive ? {
|
|
17905
|
-
...
|
|
17905
|
+
...normalized3,
|
|
17906
17906
|
rule: kind === "after" ? numericLimit + 1 : numericLimit - 1
|
|
17907
|
-
} :
|
|
17907
|
+
} : normalized3;
|
|
17908
17908
|
}, "createDateSchemaNormalizer");
|
|
17909
17909
|
parseDateLimit = /* @__PURE__ */ __name((limit) => typeof limit === "string" || typeof limit === "number" ? new Date(limit) : limit, "parseDateLimit");
|
|
17910
17910
|
writeInvalidLengthBoundMessage = /* @__PURE__ */ __name((kind, limit) => `${kind} bound must be a positive integer (was ${limit})`, "writeInvalidLengthBoundMessage");
|
|
@@ -19543,7 +19543,7 @@ var init_intersection = __esm({
|
|
|
19543
19543
|
const { structure, ...schema5 } = rawSchema;
|
|
19544
19544
|
const hasRootStructureKey = !!structure;
|
|
19545
19545
|
const normalizedStructure = structure ?? {};
|
|
19546
|
-
const
|
|
19546
|
+
const normalized3 = flatMorph(schema5, (k4, v3) => {
|
|
19547
19547
|
if (isKeyOf(k4, structureKeys)) {
|
|
19548
19548
|
if (hasRootStructureKey) {
|
|
19549
19549
|
throwParseError(`Flattened structure key ${k4} cannot be specified alongside a root 'structure' key.`);
|
|
@@ -19554,8 +19554,8 @@ var init_intersection = __esm({
|
|
|
19554
19554
|
return [k4, v3];
|
|
19555
19555
|
});
|
|
19556
19556
|
if (hasArkKind(normalizedStructure, "constraint") || !isEmptyObject(normalizedStructure))
|
|
19557
|
-
|
|
19558
|
-
return
|
|
19557
|
+
normalized3.structure = normalizedStructure;
|
|
19558
|
+
return normalized3;
|
|
19559
19559
|
}, "normalize"),
|
|
19560
19560
|
finalizeInnerJson: /* @__PURE__ */ __name(({ structure, ...rest }) => hasDomain(structure, "object") ? { ...structure, ...rest } : rest, "finalizeInnerJson"),
|
|
19561
19561
|
keys: {
|
|
@@ -19978,12 +19978,12 @@ var init_proto = __esm({
|
|
|
19978
19978
|
dateAllowsInvalid: {}
|
|
19979
19979
|
},
|
|
19980
19980
|
normalize: /* @__PURE__ */ __name((schema5) => {
|
|
19981
|
-
const
|
|
19982
|
-
if (typeof
|
|
19983
|
-
throwParseError(Proto.writeInvalidSchemaMessage(
|
|
19984
|
-
if (hasKey(
|
|
19985
|
-
throwParseError(Proto.writeBadInvalidDateMessage(
|
|
19986
|
-
return
|
|
19981
|
+
const normalized3 = typeof schema5 === "string" ? { proto: builtinConstructors[schema5] } : typeof schema5 === "function" ? isNode2(schema5) ? schema5 : { proto: schema5 } : typeof schema5.proto === "string" ? { ...schema5, proto: builtinConstructors[schema5.proto] } : schema5;
|
|
19982
|
+
if (typeof normalized3.proto !== "function")
|
|
19983
|
+
throwParseError(Proto.writeInvalidSchemaMessage(normalized3.proto));
|
|
19984
|
+
if (hasKey(normalized3, "dateAllowsInvalid") && normalized3.proto !== Date)
|
|
19985
|
+
throwParseError(Proto.writeBadInvalidDateMessage(normalized3.proto));
|
|
19986
|
+
return normalized3;
|
|
19987
19987
|
}, "normalize"),
|
|
19988
19988
|
applyConfig: /* @__PURE__ */ __name((schema5, config3) => {
|
|
19989
19989
|
if (schema5.dateAllowsInvalid === void 0 && schema5.proto === Date && config3.dateAllowsInvalid)
|
|
@@ -21501,10 +21501,10 @@ var init_structure2 = __esm({
|
|
|
21501
21501
|
const indexOverlap = intersectNodesRoot(lKey, n3.signature, ctx.$);
|
|
21502
21502
|
if (indexOverlap instanceof Disjoint)
|
|
21503
21503
|
return [];
|
|
21504
|
-
const
|
|
21505
|
-
derived2.push(...
|
|
21506
|
-
derived2.push(...
|
|
21507
|
-
return
|
|
21504
|
+
const normalized3 = normalizeIndex(indexOverlap, n3.value, ctx.$);
|
|
21505
|
+
derived2.push(...normalized3.required ?? []);
|
|
21506
|
+
derived2.push(...normalized3.optional ?? []);
|
|
21507
|
+
return normalized3.index ?? [];
|
|
21508
21508
|
});
|
|
21509
21509
|
}
|
|
21510
21510
|
}
|
|
@@ -21526,10 +21526,10 @@ var init_structure2 = __esm({
|
|
|
21526
21526
|
const indexOverlap = intersectNodesRoot(rKey, n3.signature, ctx.$);
|
|
21527
21527
|
if (indexOverlap instanceof Disjoint)
|
|
21528
21528
|
return [];
|
|
21529
|
-
const
|
|
21530
|
-
derived2.push(...
|
|
21531
|
-
derived2.push(...
|
|
21532
|
-
return
|
|
21529
|
+
const normalized3 = normalizeIndex(indexOverlap, n3.value, ctx.$);
|
|
21530
|
+
derived2.push(...normalized3.required ?? []);
|
|
21531
|
+
derived2.push(...normalized3.optional ?? []);
|
|
21532
|
+
return normalized3.index ?? [];
|
|
21533
21533
|
});
|
|
21534
21534
|
}
|
|
21535
21535
|
}
|
|
@@ -22056,18 +22056,18 @@ var init_structure2 = __esm({
|
|
|
22056
22056
|
const [enumerableBranches, nonEnumerableBranches] = spliterate(signature.branches, (k4) => k4.hasKind("unit"));
|
|
22057
22057
|
if (!enumerableBranches.length)
|
|
22058
22058
|
return { index: $4.node("index", { signature, value: value2 }) };
|
|
22059
|
-
const
|
|
22059
|
+
const normalized3 = {};
|
|
22060
22060
|
for (const n3 of enumerableBranches) {
|
|
22061
22061
|
const prop = $4.node("required", { key: n3.unit, value: value2 });
|
|
22062
|
-
|
|
22062
|
+
normalized3[prop.kind] = append(normalized3[prop.kind], prop);
|
|
22063
22063
|
}
|
|
22064
22064
|
if (nonEnumerableBranches.length) {
|
|
22065
|
-
|
|
22065
|
+
normalized3.index = $4.node("index", {
|
|
22066
22066
|
signature: nonEnumerableBranches,
|
|
22067
22067
|
value: value2
|
|
22068
22068
|
});
|
|
22069
22069
|
}
|
|
22070
|
-
return
|
|
22070
|
+
return normalized3;
|
|
22071
22071
|
}, "normalizeIndex");
|
|
22072
22072
|
typeKeyToString = /* @__PURE__ */ __name((k4) => hasArkKind(k4, "root") ? k4.expression : printable(k4), "typeKeyToString");
|
|
22073
22073
|
writeInvalidKeysMessage = /* @__PURE__ */ __name((o4, keys) => `Key${keys.length === 1 ? "" : "s"} ${keys.map(typeKeyToString).join(", ")} ${keys.length === 1 ? "does" : "do"} not exist on ${o4}`, "writeInvalidKeysMessage");
|
|
@@ -23810,11 +23810,11 @@ var init_objectLiteral = __esm({
|
|
|
23810
23810
|
continue;
|
|
23811
23811
|
}
|
|
23812
23812
|
const signature = ctx.$.parseOwnDefinitionFormat(parsedEntryKey.normalized, ctx);
|
|
23813
|
-
const
|
|
23814
|
-
if (
|
|
23815
|
-
structure.index = append(structure.index,
|
|
23816
|
-
if (
|
|
23817
|
-
structure.required = append(structure.required,
|
|
23813
|
+
const normalized3 = normalizeIndex(signature, parsedValue, ctx.$);
|
|
23814
|
+
if (normalized3.index)
|
|
23815
|
+
structure.index = append(structure.index, normalized3.index);
|
|
23816
|
+
if (normalized3.required)
|
|
23817
|
+
structure.required = append(structure.required, normalized3.required);
|
|
23818
23818
|
}
|
|
23819
23819
|
const structureNode = ctx.$.node("structure", structure);
|
|
23820
23820
|
return ctx.$.parseSchema({
|
|
@@ -65856,12 +65856,12 @@ var require_cjs3 = __commonJS({
|
|
|
65856
65856
|
*/
|
|
65857
65857
|
constructor(configs, {
|
|
65858
65858
|
basePath = "/",
|
|
65859
|
-
normalized:
|
|
65859
|
+
normalized: normalized3 = false,
|
|
65860
65860
|
schema: customSchema,
|
|
65861
65861
|
extraConfigTypes = []
|
|
65862
65862
|
} = {}) {
|
|
65863
65863
|
super();
|
|
65864
|
-
this[ConfigArraySymbol.isNormalized] =
|
|
65864
|
+
this[ConfigArraySymbol.isNormalized] = normalized3;
|
|
65865
65865
|
this[ConfigArraySymbol.schema] = new objectSchema.ObjectSchema(
|
|
65866
65866
|
Object.assign({}, customSchema, baseSchema)
|
|
65867
65867
|
);
|
|
@@ -177652,7 +177652,7 @@ var init_vibe_tree = __esm({
|
|
|
177652
177652
|
});
|
|
177653
177653
|
|
|
177654
177654
|
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/vibe/runtime/ssr-press-replay.ts
|
|
177655
|
-
var SSR_PRESS_ATTR;
|
|
177655
|
+
var SSR_PRESS_ATTR, SSR_PRESS_MESSAGE, SSR_PRESS_EVENT;
|
|
177656
177656
|
var init_ssr_press_replay = __esm({
|
|
177657
177657
|
"../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/vibe/runtime/ssr-press-replay.ts"() {
|
|
177658
177658
|
"use strict";
|
|
@@ -177660,6 +177660,8 @@ var init_ssr_press_replay = __esm({
|
|
|
177660
177660
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
177661
177661
|
init_performance2();
|
|
177662
177662
|
SSR_PRESS_ATTR = "data-vibe-ssr-press";
|
|
177663
|
+
SSR_PRESS_MESSAGE = "vibe.evt.held-press";
|
|
177664
|
+
SSR_PRESS_EVENT = "vibe-ssr-press";
|
|
177663
177665
|
}
|
|
177664
177666
|
});
|
|
177665
177667
|
|
|
@@ -204171,6 +204173,10 @@ var agentBuildDispatched = lazyType(
|
|
|
204171
204173
|
chatId: "string",
|
|
204172
204174
|
ownerHandle: "string",
|
|
204173
204175
|
appSlug: "string",
|
|
204176
|
+
// #9563 — the app's own address, https://vibes.diy/vibe/<owner>/<slug>, on a create_vibe
|
|
204177
|
+
// receipt, so a reply that links the app copies an address and never composes one (a composed
|
|
204178
|
+
// link once opened on Page Not Found). OPTIONAL: edit receipts and recorded runs carry none.
|
|
204179
|
+
"appUrl?": "string",
|
|
204174
204180
|
// OPTIONAL, and the reason is worth knowing: the turn's `promptId` is minted
|
|
204175
204181
|
// INSIDE the codegen handler, after the tool has already returned. An edit
|
|
204176
204182
|
// dispatch awaits that far and carries it; a first build is fired through the
|
|
@@ -209240,8 +209246,21 @@ function isUserSettingAppHistoryHidden(obj) {
|
|
|
209240
209246
|
return userSettingAppHistoryHidden.allows(obj);
|
|
209241
209247
|
}
|
|
209242
209248
|
__name(isUserSettingAppHistoryHidden, "isUserSettingAppHistoryHidden");
|
|
209249
|
+
var userSettingCreditMilestones = lazyType(
|
|
209250
|
+
() => type({
|
|
209251
|
+
type: "'creditMilestones'",
|
|
209252
|
+
cycle: "string",
|
|
209253
|
+
thresholds: "number[]",
|
|
209254
|
+
updatedAt: "string",
|
|
209255
|
+
"claimId?": "string"
|
|
209256
|
+
})
|
|
209257
|
+
);
|
|
209258
|
+
function isUserSettingCreditMilestones(obj) {
|
|
209259
|
+
return userSettingCreditMilestones.allows(obj);
|
|
209260
|
+
}
|
|
209261
|
+
__name(isUserSettingCreditMilestones, "isUserSettingCreditMilestones");
|
|
209243
209262
|
var userSettingItem = lazyType(
|
|
209244
|
-
() => userSettingShareing.or(userSettingModelDefaults).or(userSettingDefaultHandle).or(userSettingLegacyDefaultHandle).or(userSettingProfile).or(userSettingNotifications).or(userSettingEgressStatus).or(userSettingContactEmail).or(userSettingGeoCountry).or(userSettingRetentionDrip).or(userSettingOnboarding).or(userSettingKyc).or(userSettingMetaClickId).or(userSettingLastVisit).or(userSettingGoldDripPosted).or(userSettingCapiLeadCredited).or(userSettingGuestAppOpeners).or(userSettingGroupPayer).or(userSettingGroupSponsor).or(userSettingGroupChats).or(userSettingGroupRoster).or(userSettingTermsAck).or(userSettingAppHistoryHidden)
|
|
209263
|
+
() => userSettingShareing.or(userSettingModelDefaults).or(userSettingDefaultHandle).or(userSettingLegacyDefaultHandle).or(userSettingProfile).or(userSettingNotifications).or(userSettingEgressStatus).or(userSettingContactEmail).or(userSettingGeoCountry).or(userSettingRetentionDrip).or(userSettingOnboarding).or(userSettingKyc).or(userSettingMetaClickId).or(userSettingLastVisit).or(userSettingGoldDripPosted).or(userSettingCapiLeadCredited).or(userSettingGuestAppOpeners).or(userSettingGroupPayer).or(userSettingGroupSponsor).or(userSettingGroupChats).or(userSettingGroupRoster).or(userSettingTermsAck).or(userSettingAppHistoryHidden).or(userSettingCreditMilestones)
|
|
209245
209264
|
);
|
|
209246
209265
|
var reqEnsureUserSettings = lazyType(
|
|
209247
209266
|
() => type({
|
|
@@ -211333,9 +211352,9 @@ function normalizeCapiEmail(email4) {
|
|
|
211333
211352
|
__name(normalizeCapiEmail, "normalizeCapiEmail");
|
|
211334
211353
|
async function capiHashedEmail(email4) {
|
|
211335
211354
|
if (email4 === void 0) return void 0;
|
|
211336
|
-
const
|
|
211337
|
-
if (
|
|
211338
|
-
return capiSha256Hex(
|
|
211355
|
+
const normalized3 = normalizeCapiEmail(email4);
|
|
211356
|
+
if (normalized3 === "") return void 0;
|
|
211357
|
+
return capiSha256Hex(normalized3);
|
|
211339
211358
|
}
|
|
211340
211359
|
__name(capiHashedEmail, "capiHashedEmail");
|
|
211341
211360
|
async function postCapiEvent(pixelId, payload, eventLabel) {
|
|
@@ -212012,8 +212031,8 @@ function subjectAudienceInputs(args3) {
|
|
|
212012
212031
|
__name(subjectAudienceInputs, "subjectAudienceInputs");
|
|
212013
212032
|
function effectiveAudienceVisibility({ state: state4, sensitive, policy }) {
|
|
212014
212033
|
if (state4 !== null) {
|
|
212015
|
-
const
|
|
212016
|
-
return
|
|
212034
|
+
const normalized3 = normalizeArmState(state4);
|
|
212035
|
+
return normalized3 === "public" && sensitive ? "followers" : normalized3;
|
|
212017
212036
|
}
|
|
212018
212037
|
if (sensitive) return "private";
|
|
212019
212038
|
const intent = normalizeHandleIntent(policy);
|
|
@@ -215237,14 +215256,14 @@ async function prepareKey(entry2, key, usage) {
|
|
|
215237
215256
|
const { alg, secret } = entry2, requiresPrivateKey = usage === "decrypt" || usage === "sign";
|
|
215238
215257
|
if (secret && key instanceof Uint8Array)
|
|
215239
215258
|
return key;
|
|
215240
|
-
let
|
|
215259
|
+
let normalized3, keyObject;
|
|
215241
215260
|
if (isObject(key)) {
|
|
215242
|
-
if (
|
|
215261
|
+
if (normalized3 = normalizeJwk(key), typeof normalized3.kty != "string")
|
|
215243
215262
|
throw invalidKeyType(alg, key, secret);
|
|
215244
|
-
if (!(secret ?
|
|
215263
|
+
if (!(secret ? normalized3.kty === "oct" && typeof normalized3.k == "string" : normalized3.kty !== "oct" && (requiresPrivateKey ? normalized3.kty === "AKP" && typeof normalized3.priv == "string" || typeof normalized3.d == "string" : normalized3.d === void 0 && normalized3.priv === void 0)))
|
|
215245
215264
|
throw new TypeError(secret ? 'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present' : `JSON Web Key for this operation must be a ${requiresPrivateKey ? "private" : "public"} JWK`);
|
|
215246
|
-
if (jwkMatchesOp(entry2,
|
|
215247
|
-
return decode(
|
|
215265
|
+
if (jwkMatchesOp(entry2, normalized3, usage), normalized3.kty === "oct")
|
|
215266
|
+
return decode(normalized3.k);
|
|
215248
215267
|
if (!Object.isFrozen(key)) {
|
|
215249
215268
|
const { key_ops } = key;
|
|
215250
215269
|
Array.isArray(key_ops) && Object.freeze(key_ops), Object.freeze(key);
|
|
@@ -215269,7 +215288,7 @@ async function prepareKey(entry2, key, usage) {
|
|
|
215269
215288
|
const isPublic = keyObject.type === "public", crv = nist[keyObject.asymmetricKeyDetails?.namedCurve], params = entry2.resolve?.({ crv, asymmetricKeyType: keyObject.asymmetricKeyType }) ?? entry2.subtle;
|
|
215270
215289
|
return cached5[alg] = keyObject.toCryptoKey(params, isPublic, entry2.usages[isPublic ? 0 : 1]);
|
|
215271
215290
|
}
|
|
215272
|
-
return
|
|
215291
|
+
return normalized3 ??= keyObject.export({ format: "jwk" }), normalized3.alg = alg, cached5[alg] = await jwkToKey(entry2, normalized3);
|
|
215273
215292
|
}
|
|
215274
215293
|
__name(prepareKey, "prepareKey");
|
|
215275
215294
|
var cache;
|
|
@@ -215334,16 +215353,16 @@ function snapshotJwk(jwk) {
|
|
|
215334
215353
|
}
|
|
215335
215354
|
__name(snapshotJwk, "snapshotJwk");
|
|
215336
215355
|
function normalizeJwk(jwk) {
|
|
215337
|
-
const
|
|
215338
|
-
if (
|
|
215356
|
+
const normalized3 = snapshotJwk(jwk);
|
|
215357
|
+
if (normalized3.ext !== void 0 && typeof normalized3.ext != "boolean")
|
|
215339
215358
|
throw new TypeError('"ext" (Extractable) Parameter must be a boolean');
|
|
215340
|
-
if (
|
|
215341
|
-
const value2 =
|
|
215359
|
+
if (normalized3.key_ops !== void 0) {
|
|
215360
|
+
const value2 = normalized3.key_ops, keyOps = Array.isArray(value2) ? [...value2] : void 0;
|
|
215342
215361
|
if (!keyOps || keyOps.some((operation) => typeof operation != "string") || new Set(keyOps).size !== keyOps.length)
|
|
215343
215362
|
throw new TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');
|
|
215344
|
-
|
|
215363
|
+
normalized3.key_ops = keyOps;
|
|
215345
215364
|
}
|
|
215346
|
-
return
|
|
215365
|
+
return normalized3;
|
|
215347
215366
|
}
|
|
215348
215367
|
__name(normalizeJwk, "normalizeJwk");
|
|
215349
215368
|
function validateExtractableOption(extractable) {
|
|
@@ -215684,8 +215703,8 @@ function numericDate(value2, label) {
|
|
|
215684
215703
|
}
|
|
215685
215704
|
__name(numericDate, "numericDate");
|
|
215686
215705
|
var normalizeTyp = /* @__PURE__ */ __name((value2) => {
|
|
215687
|
-
const
|
|
215688
|
-
return value2.includes("/") ?
|
|
215706
|
+
const normalized3 = value2.toLowerCase();
|
|
215707
|
+
return value2.includes("/") ? normalized3 : `application/${normalized3}`;
|
|
215689
215708
|
}, "normalizeTyp");
|
|
215690
215709
|
var checkAudiencePresence = /* @__PURE__ */ __name((audPayload, audOption) => typeof audPayload == "string" ? audOption.includes(audPayload) : Array.isArray(audPayload) ? audOption.some((aud) => audPayload.includes(aud)) : false, "checkAudiencePresence");
|
|
215691
215710
|
function validateNumericDate(claimsSet, claim2, required2 = false) {
|
|
@@ -215813,8 +215832,8 @@ init_performance2();
|
|
|
215813
215832
|
async function createSignature(input3, key, rejectUnencoded) {
|
|
215814
215833
|
let [payload, protectedHeader, unprotectedHeader, crit] = input3, encodedProtectedHeader = "";
|
|
215815
215834
|
if (protectedHeader !== void 0) {
|
|
215816
|
-
const
|
|
215817
|
-
protectedHeader =
|
|
215835
|
+
const normalized3 = serializeJoseHeader(JWSInvalid, protectedHeader);
|
|
215836
|
+
protectedHeader = normalized3[0], encodedProtectedHeader = encode2(normalized3[1]);
|
|
215818
215837
|
}
|
|
215819
215838
|
if (unprotectedHeader !== void 0 && (unprotectedHeader = serializeJoseHeader(JWSInvalid, unprotectedHeader)[0]), !protectedHeader && !unprotectedHeader)
|
|
215820
215839
|
throw new JWSInvalid("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");
|
|
@@ -216067,25 +216086,25 @@ __name(importSPKI, "importSPKI");
|
|
|
216067
216086
|
async function importJWK(jwk, alg, options) {
|
|
216068
216087
|
if (!isObject(jwk))
|
|
216069
216088
|
throw new TypeError("JWK must be an object");
|
|
216070
|
-
const
|
|
216071
|
-
if (alg ??= jwkAlg,
|
|
216089
|
+
const normalized3 = normalizeJwk(jwk), extractable = validateExtractableOption(options?.extractable), { alg: jwkAlg } = normalized3;
|
|
216090
|
+
if (alg ??= jwkAlg, normalized3.kty !== "oct" && !alg)
|
|
216072
216091
|
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
216073
|
-
switch (
|
|
216092
|
+
switch (normalized3.kty) {
|
|
216074
216093
|
case "oct":
|
|
216075
|
-
if (typeof
|
|
216094
|
+
if (typeof normalized3.k != "string")
|
|
216076
216095
|
throw new TypeError('missing "k" (Key Value) Parameter value');
|
|
216077
|
-
return decode(
|
|
216096
|
+
return decode(normalized3.k);
|
|
216078
216097
|
case "AKP": {
|
|
216079
216098
|
if (typeof jwkAlg != "string" || !jwkAlg)
|
|
216080
216099
|
throw new TypeError('missing "alg" (Algorithm) Parameter value');
|
|
216081
216100
|
if (alg !== jwkAlg)
|
|
216082
216101
|
throw new TypeError("JWK alg and alg option value mismatch");
|
|
216083
|
-
return jwkToKey(keyAlgorithm(alg),
|
|
216102
|
+
return jwkToKey(keyAlgorithm(alg), normalized3, extractable);
|
|
216084
216103
|
}
|
|
216085
216104
|
case "RSA":
|
|
216086
216105
|
case "EC":
|
|
216087
216106
|
case "OKP":
|
|
216088
|
-
return jwkToKey(keyAlgorithm(alg),
|
|
216107
|
+
return jwkToKey(keyAlgorithm(alg), normalized3, extractable);
|
|
216089
216108
|
default:
|
|
216090
216109
|
throw new JOSENotSupported('Unsupported "kty" (Key Type) Parameter value');
|
|
216091
216110
|
}
|
|
@@ -222400,8 +222419,8 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
222400
222419
|
const _normalized = cached2(() => normalizeDef(def));
|
|
222401
222420
|
const memo3 = globalConfig.memoizer;
|
|
222402
222421
|
const generateFastpass = /* @__PURE__ */ __name((shape) => {
|
|
222403
|
-
const
|
|
222404
|
-
const syms =
|
|
222422
|
+
const normalized3 = _normalized.value;
|
|
222423
|
+
const syms = normalized3.symbolKeys;
|
|
222405
222424
|
const doc = new Doc(["payload", "ctx"], { shape, inst, memo: memo3, syms });
|
|
222406
222425
|
const parseStr = /* @__PURE__ */ __name((k4) => `shape[${k4}]._zod.run({ value: input[${k4}], issues: [] }, ctx)`, "parseStr");
|
|
222407
222426
|
const prefixStr = /* @__PURE__ */ __name((id, k4) => `
|
|
@@ -222419,11 +222438,11 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
222419
222438
|
doc.write(`const input = payload.value;`);
|
|
222420
222439
|
const ids = /* @__PURE__ */ Object.create(null);
|
|
222421
222440
|
let counter = 0;
|
|
222422
|
-
for (const key of
|
|
222441
|
+
for (const key of normalized3.allKeys) {
|
|
222423
222442
|
ids[key] = `key_${counter++}`;
|
|
222424
222443
|
}
|
|
222425
222444
|
doc.write(memo3 ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
|
|
222426
|
-
for (const key of
|
|
222445
|
+
for (const key of normalized3.allKeys) {
|
|
222427
222446
|
if (key === "__proto__")
|
|
222428
222447
|
continue;
|
|
222429
222448
|
const id = ids[key];
|
|
@@ -235263,22 +235282,22 @@ function foldObjects(members2) {
|
|
|
235263
235282
|
}
|
|
235264
235283
|
__name(foldObjects, "foldObjects");
|
|
235265
235284
|
function foldIntersection(json6) {
|
|
235266
|
-
const
|
|
235267
|
-
if (!Array.isArray(
|
|
235285
|
+
const allOf2 = json6.allOf;
|
|
235286
|
+
if (!Array.isArray(allOf2) || allOf2.length < 2)
|
|
235268
235287
|
return;
|
|
235269
235288
|
for (const key of FOLDABLE_KEYS)
|
|
235270
235289
|
if (key in json6)
|
|
235271
235290
|
return;
|
|
235272
|
-
const unions =
|
|
235291
|
+
const unions = allOf2.filter((m) => UNION_KEYS.some((k4) => Array.isArray(m[k4])));
|
|
235273
235292
|
let folded = null;
|
|
235274
235293
|
if (!unions.length) {
|
|
235275
|
-
folded = foldObjects(
|
|
235294
|
+
folded = foldObjects(allOf2);
|
|
235276
235295
|
} else {
|
|
235277
235296
|
const union5 = unions[0];
|
|
235278
235297
|
const keyword = UNION_KEYS.find((k4) => Array.isArray(union5[k4]));
|
|
235279
235298
|
if (Object.keys(union5).length !== 1)
|
|
235280
235299
|
return;
|
|
235281
|
-
const rest =
|
|
235300
|
+
const rest = allOf2.filter((m) => m !== union5);
|
|
235282
235301
|
const branches = union5[keyword].map((branch) => foldObjects([...rest, branch]));
|
|
235283
235302
|
if (branches.some((b4) => !b4))
|
|
235284
235303
|
return;
|
|
@@ -235371,18 +235390,18 @@ function finalize(ctx, schema5) {
|
|
|
235371
235390
|
const carriers = /* @__PURE__ */ new Map();
|
|
235372
235391
|
for (const seen2 of ctx.seen.values()) {
|
|
235373
235392
|
for (const json6 of [seen2.schema, seen2.def]) {
|
|
235374
|
-
const
|
|
235375
|
-
if (!Array.isArray(
|
|
235393
|
+
const allOf2 = json6?.allOf;
|
|
235394
|
+
if (!Array.isArray(allOf2))
|
|
235376
235395
|
continue;
|
|
235377
|
-
const existing = carriers.get(
|
|
235396
|
+
const existing = carriers.get(allOf2);
|
|
235378
235397
|
if (existing)
|
|
235379
235398
|
existing.push(json6);
|
|
235380
235399
|
else
|
|
235381
|
-
carriers.set(
|
|
235400
|
+
carriers.set(allOf2, [json6]);
|
|
235382
235401
|
}
|
|
235383
235402
|
}
|
|
235384
|
-
for (const
|
|
235385
|
-
for (const json6 of carriers.get(
|
|
235403
|
+
for (const allOf2 of ctx.intersections) {
|
|
235404
|
+
for (const json6 of carriers.get(allOf2) ?? [])
|
|
235386
235405
|
foldIntersection(json6);
|
|
235387
235406
|
}
|
|
235388
235407
|
}
|
|
@@ -235919,12 +235938,12 @@ var intersectionProcessor = /* @__PURE__ */ __name((schema5, ctx, json6, params)
|
|
|
235919
235938
|
path: [...params.path, "allOf", 1]
|
|
235920
235939
|
});
|
|
235921
235940
|
const isSimpleIntersection = /* @__PURE__ */ __name((val) => "allOf" in val && Object.keys(val).length === 1, "isSimpleIntersection");
|
|
235922
|
-
const
|
|
235941
|
+
const allOf2 = [
|
|
235923
235942
|
...isSimpleIntersection(a4) ? a4.allOf : [a4],
|
|
235924
235943
|
...isSimpleIntersection(b4) ? b4.allOf : [b4]
|
|
235925
235944
|
];
|
|
235926
|
-
json6.allOf =
|
|
235927
|
-
ctx.intersections.push(
|
|
235945
|
+
json6.allOf = allOf2;
|
|
235946
|
+
ctx.intersections.push(allOf2);
|
|
235928
235947
|
}, "intersectionProcessor");
|
|
235929
235948
|
var tupleProcessor = /* @__PURE__ */ __name((schema5, ctx, _json, params) => {
|
|
235930
235949
|
const json6 = _json;
|
|
@@ -239011,23 +239030,23 @@ function fromJSONSchema(schema5, params) {
|
|
|
239011
239030
|
if (typeof schema5 === "boolean") {
|
|
239012
239031
|
return schema5 ? z.any() : z.never();
|
|
239013
239032
|
}
|
|
239014
|
-
let
|
|
239033
|
+
let normalized3;
|
|
239015
239034
|
try {
|
|
239016
|
-
|
|
239035
|
+
normalized3 = JSON.parse(JSON.stringify(schema5));
|
|
239017
239036
|
} catch {
|
|
239018
239037
|
throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
|
|
239019
239038
|
}
|
|
239020
|
-
const version5 = detectVersion(
|
|
239021
|
-
const defs =
|
|
239039
|
+
const version5 = detectVersion(normalized3, params?.defaultTarget);
|
|
239040
|
+
const defs = normalized3.$defs || normalized3.definitions || {};
|
|
239022
239041
|
const ctx = {
|
|
239023
239042
|
version: version5,
|
|
239024
239043
|
defs,
|
|
239025
239044
|
refs: /* @__PURE__ */ new Map(),
|
|
239026
239045
|
processing: /* @__PURE__ */ new Set(),
|
|
239027
|
-
rootSchema:
|
|
239046
|
+
rootSchema: normalized3,
|
|
239028
239047
|
registry: params?.registry ?? globalRegistry
|
|
239029
239048
|
};
|
|
239030
|
-
return convertSchema(
|
|
239049
|
+
return convertSchema(normalized3, ctx);
|
|
239031
239050
|
}
|
|
239032
239051
|
__name(fromJSONSchema, "fromJSONSchema");
|
|
239033
239052
|
|
|
@@ -247109,8 +247128,8 @@ function normalizeStaffEmail(email4) {
|
|
|
247109
247128
|
}
|
|
247110
247129
|
__name(normalizeStaffEmail, "normalizeStaffEmail");
|
|
247111
247130
|
function staffEmailHash(email4) {
|
|
247112
|
-
const
|
|
247113
|
-
return
|
|
247131
|
+
const normalized3 = normalizeStaffEmail(email4);
|
|
247132
|
+
return normalized3 === void 0 ? void 0 : createHash("sha256").update(normalized3).digest("hex");
|
|
247114
247133
|
}
|
|
247115
247134
|
__name(staffEmailHash, "staffEmailHash");
|
|
247116
247135
|
function isStaffEmail(email4, exclusions) {
|
|
@@ -259609,11 +259628,14 @@ function carriedItems(items) {
|
|
|
259609
259628
|
return items.filter(isAssetItem);
|
|
259610
259629
|
}
|
|
259611
259630
|
__name(carriedItems, "carriedItems");
|
|
259612
|
-
async function resolveVfsFromFileSystem(vctx, items) {
|
|
259631
|
+
async function resolveVfsFromFileSystem(vctx, items, opts) {
|
|
259613
259632
|
const sources = items.filter((item) => !isAssetItem(item) && isSourceFile(item.fileName));
|
|
259614
259633
|
const rTexts = await mapInOrder(sources, VFS_FETCH_CONCURRENCY, async (item) => {
|
|
259615
259634
|
const rFetch = await vctx.storage.fetch(item.assetURI);
|
|
259616
|
-
if (isFetchErrResult(rFetch) || isFetchNotFoundResult(rFetch))
|
|
259635
|
+
if (isFetchErrResult(rFetch) || isFetchNotFoundResult(rFetch)) {
|
|
259636
|
+
if (opts?.strict === true) throw new Error(`source ${item.fileName} did not load (${rFetch.type})`);
|
|
259637
|
+
return void 0;
|
|
259638
|
+
}
|
|
259617
259639
|
const bytes = await stream2uint8array(rFetch.data);
|
|
259618
259640
|
return vctx.sthis.txt.decode(bytes);
|
|
259619
259641
|
});
|
|
@@ -259629,8 +259651,8 @@ async function resolveVfsFromFileSystem(vctx, items) {
|
|
|
259629
259651
|
return Result.Ok(vfs);
|
|
259630
259652
|
}
|
|
259631
259653
|
__name(resolveVfsFromFileSystem, "resolveVfsFromFileSystem");
|
|
259632
|
-
async function resolveVfsFromFileSystemOrThrow(vctx, items) {
|
|
259633
|
-
const rVfs = await resolveVfsFromFileSystem(vctx, items);
|
|
259654
|
+
async function resolveVfsFromFileSystemOrThrow(vctx, items, opts) {
|
|
259655
|
+
const rVfs = await resolveVfsFromFileSystem(vctx, items, opts);
|
|
259634
259656
|
if (rVfs.isErr()) throw rVfs.Err();
|
|
259635
259657
|
return rVfs.Ok();
|
|
259636
259658
|
}
|
|
@@ -259919,11 +259941,14 @@ function dispatchLookLint(vctx, args3) {
|
|
|
259919
259941
|
vctx.waitUntil?.(promise2);
|
|
259920
259942
|
}
|
|
259921
259943
|
__name(dispatchLookLint, "dispatchLookLint");
|
|
259922
|
-
async function loadTurnFilesByFsId(vctx, fsId) {
|
|
259944
|
+
async function loadTurnFilesByFsId(vctx, fsId, opts) {
|
|
259923
259945
|
const rows = await vctx.sql.db.select({ fileSystem: vctx.sql.tables.apps.fileSystem }).from(vctx.sql.tables.apps).where(eq(vctx.sql.tables.apps.fsId, fsId)).limit(1);
|
|
259924
259946
|
const row = rows[0];
|
|
259925
|
-
if (row === void 0)
|
|
259926
|
-
|
|
259947
|
+
if (row === void 0) {
|
|
259948
|
+
if (opts?.strict === true) throw new Error(`release ${fsId} not found`);
|
|
259949
|
+
return {};
|
|
259950
|
+
}
|
|
259951
|
+
const vfs = await resolveVfsFromFileSystemOrThrow(vctx, parseArray(row.fileSystem, fileSystemItem), opts);
|
|
259927
259952
|
const files = {};
|
|
259928
259953
|
for (const [path3, content] of vfs) {
|
|
259929
259954
|
if (path3.startsWith(DERIVED_MANIFEST_PREFIX)) continue;
|
|
@@ -260828,6 +260853,57 @@ function crossedCreditMilestones(usedBefore, usedAfter, thresholds = CREDIT_USAG
|
|
|
260828
260853
|
}
|
|
260829
260854
|
__name(crossedCreditMilestones, "crossedCreditMilestones");
|
|
260830
260855
|
|
|
260856
|
+
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/credit-milestone-ledger.ts
|
|
260857
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
260858
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
260859
|
+
init_performance2();
|
|
260860
|
+
var UNKNOWN_CREDIT_CYCLE = "unknown";
|
|
260861
|
+
function unclaimedCreditMilestones(settings, cycle, thresholds) {
|
|
260862
|
+
const prior = settings.find(isUserSettingCreditMilestones);
|
|
260863
|
+
if (prior === void 0 || prior.cycle < cycle) return { fresh: [...new Set(thresholds)], kept: [] };
|
|
260864
|
+
if (prior.cycle > cycle) return { fresh: [], kept: prior.thresholds };
|
|
260865
|
+
return { fresh: [...new Set(thresholds)].filter((t3) => !prior.thresholds.includes(t3)), kept: prior.thresholds };
|
|
260866
|
+
}
|
|
260867
|
+
__name(unclaimedCreditMilestones, "unclaimedCreditMilestones");
|
|
260868
|
+
async function readSettings(sql2, userId) {
|
|
260869
|
+
const t3 = sql2.tables.userSettings;
|
|
260870
|
+
return sql2.db.select({ settings: t3.settings }).from(t3).where(eq(t3.userId, userId)).limit(1).then((r2) => r2[0] === void 0 ? void 0 : { raw: r2[0].settings });
|
|
260871
|
+
}
|
|
260872
|
+
__name(readSettings, "readSettings");
|
|
260873
|
+
async function claimCreditMilestones(sql2, userId, cycle, thresholds) {
|
|
260874
|
+
if (thresholds.length === 0) return [];
|
|
260875
|
+
const t3 = sql2.tables.userSettings;
|
|
260876
|
+
let row = await readSettings(sql2, userId);
|
|
260877
|
+
if (row === void 0) {
|
|
260878
|
+
const now4 = (/* @__PURE__ */ new Date()).toISOString();
|
|
260879
|
+
await sql2.db.insert(t3).values({ userId, settings: [], updated: now4, created: now4 }).onConflictDoNothing();
|
|
260880
|
+
row = await readSettings(sql2, userId);
|
|
260881
|
+
if (row === void 0) return [];
|
|
260882
|
+
}
|
|
260883
|
+
const { filtered: settings } = parseArrayWarning(row.raw ?? [], userSettingItem);
|
|
260884
|
+
const { fresh, kept } = unclaimedCreditMilestones(settings, cycle, thresholds);
|
|
260885
|
+
if (fresh.length === 0) return [];
|
|
260886
|
+
const now3 = (/* @__PURE__ */ new Date()).toISOString();
|
|
260887
|
+
const claimId = crypto.randomUUID();
|
|
260888
|
+
const next3 = {
|
|
260889
|
+
type: "creditMilestones",
|
|
260890
|
+
cycle,
|
|
260891
|
+
thresholds: [...kept, ...fresh].sort((a4, b4) => a4 - b4),
|
|
260892
|
+
updatedAt: now3,
|
|
260893
|
+
claimId
|
|
260894
|
+
};
|
|
260895
|
+
await sql2.db.update(t3).set({ settings: [...settings.filter((s2) => s2.type !== "creditMilestones"), next3], updated: now3 }).where(and(eq(t3.userId, userId), eq(t3.settings, row.raw)));
|
|
260896
|
+
const after = await readSettings(sql2, userId);
|
|
260897
|
+
const { filtered: afterSettings } = parseArrayWarning(after?.raw ?? [], userSettingItem);
|
|
260898
|
+
const won = afterSettings.find(isUserSettingCreditMilestones)?.claimId === claimId;
|
|
260899
|
+
return won ? [...fresh].sort((a4, b4) => a4 - b4) : [];
|
|
260900
|
+
}
|
|
260901
|
+
__name(claimCreditMilestones, "claimCreditMilestones");
|
|
260902
|
+
function creditMilestoneLedger(sql2) {
|
|
260903
|
+
return { claim: /* @__PURE__ */ __name((userId, cycle, thresholds) => claimCreditMilestones(sql2, userId, cycle, thresholds), "claim") };
|
|
260904
|
+
}
|
|
260905
|
+
__name(creditMilestoneLedger, "creditMilestoneLedger");
|
|
260906
|
+
|
|
260831
260907
|
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/analytics.ts
|
|
260832
260908
|
var STORE_R2_TRANSIENT_RE = /unspecified error|internal error|please try again|\(10001\)/i;
|
|
260833
260909
|
var STORE_TEMP_MISSING_RE = /object not found/i;
|
|
@@ -260865,6 +260941,10 @@ function warnCountryMissingOnce(logger) {
|
|
|
260865
260941
|
logger.Warn().Msg("analytics-country-missing");
|
|
260866
260942
|
}
|
|
260867
260943
|
__name(warnCountryMissingOnce, "warnCountryMissingOnce");
|
|
260944
|
+
function posthogWouldSend(vctx) {
|
|
260945
|
+
return isUsCountry(vctx.analyticsCountry) && (vctx.posthogKey ?? "") !== "" && (vctx.posthogHost ?? "") !== "";
|
|
260946
|
+
}
|
|
260947
|
+
__name(posthogWouldSend, "posthogWouldSend");
|
|
260868
260948
|
async function capturePostHogServerEvent(vctx, args3) {
|
|
260869
260949
|
if (!isUsCountry(vctx.analyticsCountry)) {
|
|
260870
260950
|
if (vctx.analyticsCountry === void 0) warnCountryMissingOnce(vctx.logger);
|
|
@@ -261285,26 +261365,32 @@ function captureCreditUsageMilestones(vctx, args3) {
|
|
|
261285
261365
|
const usedAfter = usedBefore + Math.min(args3.chargedCredits, Math.max(0, remainingBefore));
|
|
261286
261366
|
const crossed = crossedCreditMilestones(usedBefore, usedAfter);
|
|
261287
261367
|
const resetsAtIso = cycleResetsAtIso(args3.check);
|
|
261288
|
-
|
|
261289
|
-
|
|
261290
|
-
|
|
261291
|
-
|
|
261292
|
-
|
|
261293
|
-
|
|
261294
|
-
|
|
261295
|
-
|
|
261296
|
-
|
|
261297
|
-
|
|
261298
|
-
|
|
261299
|
-
|
|
261300
|
-
|
|
261301
|
-
|
|
261302
|
-
|
|
261303
|
-
|
|
261304
|
-
|
|
261305
|
-
|
|
261306
|
-
|
|
261307
|
-
|
|
261368
|
+
if (crossed.length === 0) return 0;
|
|
261369
|
+
const emit2 = /* @__PURE__ */ __name((threshold) => capturePostHogServerEvent(vctx, {
|
|
261370
|
+
event: "credits_usage_milestone",
|
|
261371
|
+
distinctId: args3.userId,
|
|
261372
|
+
properties: {
|
|
261373
|
+
threshold,
|
|
261374
|
+
credits_used_cycle: usedAfter,
|
|
261375
|
+
credits_used_before: usedBefore,
|
|
261376
|
+
...args3.check?.grantedCredits === void 0 ? {} : { credits_granted: args3.check.grantedCredits },
|
|
261377
|
+
...args3.check?.plan === void 0 ? {} : { plan: args3.check.plan },
|
|
261378
|
+
...resetsAtIso === void 0 ? {} : { cycle_resets_at: resetsAtIso },
|
|
261379
|
+
lane: args3.lane,
|
|
261380
|
+
...args3.ownerHandle === void 0 || args3.ownerHandle === "" ? {} : { owner_handle: args3.ownerHandle },
|
|
261381
|
+
...args3.appSlug === void 0 || args3.appSlug === "" ? {} : { app_slug: args3.appSlug },
|
|
261382
|
+
...clientProperties(vctx.client)
|
|
261383
|
+
}
|
|
261384
|
+
}).catch(() => {
|
|
261385
|
+
}), "emit");
|
|
261386
|
+
const ledger = posthogWouldSend(vctx) ? args3.ledger : void 0;
|
|
261387
|
+
const promise2 = (async () => {
|
|
261388
|
+
const won = ledger === void 0 ? crossed : await ledger.claim(args3.userId, resetsAtIso ?? UNKNOWN_CREDIT_CYCLE, crossed);
|
|
261389
|
+
await Promise.all(won.map((threshold) => emit2(threshold)));
|
|
261390
|
+
})().catch((e3) => {
|
|
261391
|
+
vctx.logger.Warn().Err(e3).Str("userId", args3.userId).Msg("credit-milestones-claim-failed");
|
|
261392
|
+
});
|
|
261393
|
+
vctx.waitUntil?.(promise2);
|
|
261308
261394
|
return crossed.length;
|
|
261309
261395
|
}
|
|
261310
261396
|
__name(captureCreditUsageMilestones, "captureCreditUsageMilestones");
|
|
@@ -262621,21 +262707,41 @@ async function loadDocChannels(vctx, part) {
|
|
|
262621
262707
|
const row = await vctx.sql.db.select({ output: tO.output }).from(tO).where(
|
|
262622
262708
|
and(eq(tO.ownerHandle, part.ownerHandle), eq(tO.appSlug, part.appSlug), eq(tO.dbName, part.dbName), eq(tO.docId, part.docId))
|
|
262623
262709
|
).limit(1).then((r2) => r2[0]);
|
|
262624
|
-
|
|
262710
|
+
return channelSetOfStoredOutput(row?.output);
|
|
262711
|
+
}
|
|
262712
|
+
__name(loadDocChannels, "loadDocChannels");
|
|
262713
|
+
function channelSetOfStoredOutput(output2) {
|
|
262714
|
+
if (!output2) return [];
|
|
262625
262715
|
try {
|
|
262626
|
-
return channelSetOfDescriptor(JSON.parse(
|
|
262716
|
+
return channelSetOfDescriptor(JSON.parse(output2));
|
|
262627
262717
|
} catch {
|
|
262628
262718
|
return [];
|
|
262629
262719
|
}
|
|
262630
262720
|
}
|
|
262631
|
-
__name(
|
|
262721
|
+
__name(channelSetOfStoredOutput, "channelSetOfStoredOutput");
|
|
262722
|
+
async function lockFeedPartitionInTransaction(exec, p3) {
|
|
262723
|
+
await exec.execute(
|
|
262724
|
+
sql`SELECT pg_advisory_xact_lock(hashtextextended(${partitionLockKey(p3.ownerHandle, p3.appSlug, p3.dbName)}, 0))`
|
|
262725
|
+
);
|
|
262726
|
+
}
|
|
262727
|
+
__name(lockFeedPartitionInTransaction, "lockFeedPartitionInTransaction");
|
|
262632
262728
|
async function emitChannelChangeFeed(p3) {
|
|
262633
262729
|
const oldSet = new Set(p3.oldChannels);
|
|
262634
262730
|
const newSet = new Set(p3.newChannels);
|
|
262635
262731
|
const channelsChanged = oldSet.size !== newSet.size || [...newSet].some((c3) => !oldSet.has(c3)) || [...oldSet].some((c3) => !newSet.has(c3));
|
|
262732
|
+
if (p3.inTransaction === true && p3.flavour !== "pg") throw new Error("emitChannelChangeFeed: inTransaction is pg-only");
|
|
262733
|
+
let partitionLocked = false;
|
|
262734
|
+
const appendEntry = /* @__PURE__ */ __name(async (entry2) => {
|
|
262735
|
+
if (p3.inTransaction !== true) return appendFeedEntry(entry2);
|
|
262736
|
+
if (!partitionLocked) {
|
|
262737
|
+
await lockFeedPartitionInTransaction(entry2.db, entry2);
|
|
262738
|
+
partitionLocked = true;
|
|
262739
|
+
}
|
|
262740
|
+
return extractSyncSeq(await runReturning(entry2.db, entry2.flavour, buildAppendInsert(entry2)));
|
|
262741
|
+
}, "appendEntry");
|
|
262636
262742
|
for (const ch of oldSet) {
|
|
262637
262743
|
if (!newSet.has(ch)) {
|
|
262638
|
-
await
|
|
262744
|
+
await appendEntry({
|
|
262639
262745
|
db: p3.db,
|
|
262640
262746
|
flavour: p3.flavour,
|
|
262641
262747
|
ownerHandle: p3.ownerHandle,
|
|
@@ -262649,7 +262755,7 @@ async function emitChannelChangeFeed(p3) {
|
|
|
262649
262755
|
}
|
|
262650
262756
|
}
|
|
262651
262757
|
if (p3.alwaysPut || channelsChanged) {
|
|
262652
|
-
return
|
|
262758
|
+
return appendEntry({
|
|
262653
262759
|
db: p3.db,
|
|
262654
262760
|
flavour: p3.flavour,
|
|
262655
262761
|
ownerHandle: p3.ownerHandle,
|
|
@@ -262831,7 +262937,7 @@ init_esm();
|
|
|
262831
262937
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
262832
262938
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
262833
262939
|
init_performance2();
|
|
262834
|
-
var AGENT_SESSION_INSTRUCTION_VERSION = "2026-11-14.
|
|
262940
|
+
var AGENT_SESSION_INSTRUCTION_VERSION = "2026-11-14.3";
|
|
262835
262941
|
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.";
|
|
262836
262942
|
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";
|
|
262837
262943
|
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.";
|
|
@@ -262958,7 +263064,7 @@ line on a [commit result] names what the saved files still hold, for your next d
|
|
|
262958
263064
|
the request with the changes already present, preserving that work.
|
|
262959
263065
|
|
|
262960
263066
|
Look at the app before you speak for its looks. The first turn is the exception: the person is already looking at the app the moment its first build saves, so that turn ends on the build result without read_screenshot \u2014 describe what the result and the saved files establish, as the screen they open on, and leave the look of what you have not seen for the picture to show. On every later turn the person starts, the current version's picture is already in front of you, behind <app-context>, captioned with its version and whether that is the current one: read it as evidence beside the files before you answer or change anything, and when it says no picture is available yet, the files are what you have. A [build result] usually brings the picture of the version it saved, right behind it; read it there. Then read_screenshot is for a version you have not seen: call it after a build or commit lands in this turn without its picture when the person asked about layout, spacing, colour or what is visible, or to confirm a visual change you made, and with an earlier version's number to compare before and after. It shows the app as a person sees it, on a phone, and takes an optional version number from list_versions (absent means the current version; it answers at once with the newest picture there is, naming the earlier version it shows when the current one's is still being taken, and wait: true waits for the current one). What the picture shows is evidence beside the files: a control the files define and the picture does not show is a finding to act on, not a claim to make. Grey hint text inside an empty field is that field's placeholder: the field is empty and ready for typing. A control the first-screen order itself puts below the fold or behind a tap \u2014 the share row under a long list, settings behind a button \u2014 is in its place, not a finding. The picture's caption says where its records came from \u2014 the release's seed.json examples in a throwaway store, no records at all, or a capture too old to say \u2014 and none of those is what the person saved: a sentence about their records \u2014 that they are still there, how many there are, which are done today \u2014 follows a query_docs read of them, and a change that touched no records is told as the change itself, such as only the heading text changing.
|
|
262961
|
-
When a current-version screenshot or check shows the requested change is broken, apply a self-contained repair in this turn and check the result before replying. A view this turn's ask named that the picture shows below the fold, under a form or a settings card, or only inside a detail view is broken in that same sense unless the person said where it goes: move it to the top of the opening screen in this turn, and never tell the person to scroll or open something to find what they asked for. A turn that only asks a question dispatches no build. An earlier-version picture is evidence of that version only; use the current files or a current check to establish a defect before repairing. Choose implementation details yourself when the repair preserves the requested behavior; questions belong to choices about what the person wants the app to do. If a repair remains unresolved, say what they will see and what is unresolved in their words. Say work is continuing only while a build or repair is actually running; otherwise state the remaining blocker. Claim a visible result only when the current evidence establishes it. The reply tells the app as its saved files hold it: name what this turn added in its own terms, and compare it only with parts those files contain, so a part that is new to the app is told as new. The picture is your own check: the reply speaks about the app itself, and what the picture showed, how old it is and which version it caught stay with you. A finding from your own checks is yours in the same way, whether a [build result] line, a design check or the picture raised it: one the current files bear out, you repair with edit_vibe and repair: true before you reply; one the files contradict, you let go; and the reply tells the person about the app they have, in its own labels, with the repair already in it.
|
|
263067
|
+
When a current-version screenshot or check shows the requested change is broken, apply a self-contained repair in this turn and check the result before replying. A view this turn's ask named that the picture shows below the fold, under a form or a settings card, or only inside a detail view is broken in that same sense unless the person said where it goes: move it to the top of the opening screen in this turn, and never tell the person to scroll or open something to find what they asked for. A turn that only asks a question dispatches no build. An earlier-version picture is evidence of that version only; use the current files or a current check to establish a defect before repairing. Choose implementation details yourself when the repair preserves the requested behavior; questions belong to choices about what the person wants the app to do. If a repair remains unresolved, say what they will see and what is unresolved in their words. Say work is continuing only while a build or repair is actually running; otherwise state the remaining blocker. Claim a visible result only when the current evidence establishes it. A reply that tells a visual change as done (a colour, a layout, a picture, what shows where) comes after you have looked at the version that holds it, in the picture its [build result] brought or in read_screenshot; when no picture of that version has reached you, the reply says the change is saved and that you have not looked at it yet, and names what they will see, so they know where to check. The reply tells the app as its saved files hold it: name what this turn added in its own terms, and compare it only with parts those files contain, so a part that is new to the app is told as new. The picture is your own check: the reply speaks about the app itself, and what the picture showed, how old it is and which version it caught stay with you. A finding from your own checks is yours in the same way, whether a [build result] line, a design check or the picture raised it: one the current files bear out, you repair with edit_vibe and repair: true before you reply; one the files contradict, you let go; and the reply tells the person about the app they have, in its own labels, with the repair already in it.
|
|
262962
263068
|
|
|
262963
263069
|
Questions about the existing app deserve facts from its files. Inspect the implementation before
|
|
262964
263070
|
deciding what is missing. Read linked material and inspect structured field shapes before choosing
|
|
@@ -263066,7 +263172,9 @@ A batch of new records the person sends you in chat is a save you make yourself:
|
|
|
263066
263172
|
|
|
263067
263173
|
Speak plainly and briefly about the app: the opening line while work runs, then what changed and what remains
|
|
263068
263174
|
unresolved, in a clause each, in the person's own terms. Describe the result and the next useful action, keeping implementation choices in the work itself.
|
|
263175
|
+
A link to the app is its own address, the appUrl its create_vibe receipt and its first [build result] carry, https://vibes.diy/vibe/<handle>/<app> with this app's handle and name from <app-context>, copied whole into the reply.
|
|
263069
263176
|
When a change appears only after an action, the completion reply's first sentence is that action and the result it reveals, in the app's own labels, shaped "<do this> to see <that>.": "Fill in the form and tap Save repair to see the receipt." One sentence carries both halves, the action and what it shows, and what changed follows it; distinguish a saved change from a flow you actually exercised. A safe read-only view or an existing sandbox preview can show the changed state; label example content as a demonstration. Example records you cite in a reply are named for where a read found them: examples a read found in the app are named as its examples ("two example repairs are in the app, and I can take them out"), and examples only in seed.json are named as a sample preview ("the sample preview shows two example repairs"), so the person reads their own app as holding exactly what is there. Live records and submissions follow the person's explicit request: beyond the first build's own call on its examples, showing a change alone authorizes neither adding example records nor sending a real request, notification, booking or payment. When no safe preview exists, name the revealing action and say whether it has been tested; the person chooses when to perform the real action.
|
|
263177
|
+
The reply that closes the first build of an app that holds records makes its revealing action the person's first real record, filled with the form's sparkle, in one sentence in the app's own words: "Tap \u2728 on the form to fill your first recipe, then Save it." That sentence sits above the closing options, which stay as they are.
|
|
263070
263178
|
Before you build, say to yourself in the person's own words what will be happening when this app has worked, and who will be there: just them, their friends, a group they run, or strangers who arrive by a link. Keep that picture as you go and let each turn bring it closer; when the person's words change it, the picture changes with them. The platform already carries much of what such a moment needs, and the skill docs say what moment each piece is for, so build on that piece. Most asks already sit on those pieces and are simply this turn's build. When a build is about to go around one, offer the platform's piece as the built-in way: say in one sentence what it gives and what the other way costs, then build what they choose, and let that choice stand for the turns after it. Say "works" only for what a skill doc shows or this turn confirmed. Once the app can reach its moment, the closing row leads there, toward the people who need to be in it.
|
|
263071
263179
|
A specific change the person asks for is this turn's build: when the ask names what to change and carries enough to implement \u2014 put the running total at the top, show each entry's date beside its name \u2014 choose a useful shape they can redirect and dispatch it first, with edit_vibe or a direct edit, and the variations you would suggest ride as options after its result, beside the change they asked for. When an unresolved fact materially changes that build, ask one focused question.
|
|
263072
263180
|
A turn that dispatches no build ends with one short improvement question and the options that fit it, up to three,
|
|
@@ -268789,27 +268897,51 @@ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
|
268789
268897
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
268790
268898
|
init_performance2();
|
|
268791
268899
|
init_esm();
|
|
268792
|
-
|
|
268900
|
+
function allOf(where) {
|
|
268901
|
+
return where ?? sql`false`;
|
|
268902
|
+
}
|
|
268903
|
+
__name(allOf, "allOf");
|
|
268904
|
+
function accessBindingPlan(vctx, key) {
|
|
268905
|
+
const { ownerHandle, appSlug, dbName } = key;
|
|
268793
268906
|
if (dbName.startsWith("media:")) {
|
|
268794
|
-
const
|
|
268795
|
-
const explicit = await vctx.sql.db.select({ accessFnCid: t3.accessFnCid, accessFnAssetUri: t3.accessFnAssetUri, dbName: t3.dbName }).from(t3).where(and(eq(t3.ownerHandle, ownerHandle), eq(t3.appSlug, appSlug), eq(t3.dbName, dbName))).limit(1).then((rows) => rows[0]);
|
|
268796
|
-
if (explicit !== void 0) {
|
|
268797
|
-
return { ...explicit, accessFnAssetUri: explicit.accessFnAssetUri ?? void 0 };
|
|
268798
|
-
}
|
|
268907
|
+
const t4 = vctx.sql.tables.accessFunctionBindings;
|
|
268799
268908
|
const media = legacyPlatformDb("media");
|
|
268800
|
-
return {
|
|
268909
|
+
return {
|
|
268910
|
+
kind: "lookup",
|
|
268911
|
+
where: allOf(and(eq(t4.ownerHandle, ownerHandle), eq(t4.appSlug, appSlug), eq(t4.dbName, dbName))),
|
|
268912
|
+
orderBy: void 0,
|
|
268913
|
+
fallback: { accessFnCid: media.builtinFor(mediaHostDbName(dbName)).cid, dbName: media.exportSelector }
|
|
268914
|
+
};
|
|
268801
268915
|
}
|
|
268802
268916
|
if (isPlatformDbName(dbName)) {
|
|
268803
268917
|
const entry2 = lookupPlatformDb(dbName);
|
|
268804
|
-
|
|
268805
|
-
if (
|
|
268806
|
-
|
|
268918
|
+
const deny3 = { kind: "fixed", binding: { accessFnCid: PLATFORM_DENY_CID, dbName: PLATFORM_DENY_EXPORT } };
|
|
268919
|
+
if (entry2 === void 0) return deny3;
|
|
268920
|
+
if (platformDbHostedOn(entry2, appSlug) === false) return deny3;
|
|
268921
|
+
return { kind: "fixed", binding: { accessFnCid: entry2.accessFnCid, dbName: entry2.exportSelector } };
|
|
268807
268922
|
}
|
|
268808
|
-
const
|
|
268809
|
-
|
|
268810
|
-
|
|
268923
|
+
const t3 = vctx.sql.tables.accessFunctionBindings;
|
|
268924
|
+
return {
|
|
268925
|
+
kind: "lookup",
|
|
268926
|
+
where: allOf(and(eq(t3.ownerHandle, ownerHandle), eq(t3.appSlug, appSlug), inArray(t3.dbName, [dbName, "*"]))),
|
|
268927
|
+
orderBy: sql`CASE WHEN ${t3.dbName} = ${dbName} THEN 0 ELSE 1 END`,
|
|
268928
|
+
fallback: void 0
|
|
268929
|
+
};
|
|
268930
|
+
}
|
|
268931
|
+
__name(accessBindingPlan, "accessBindingPlan");
|
|
268932
|
+
function bindingFromPlanRow(plan, row) {
|
|
268933
|
+
if (row === void 0 || row.accessFnCid === null || row.dbName === null) return plan.fallback;
|
|
268811
268934
|
return { accessFnCid: row.accessFnCid, accessFnAssetUri: row.accessFnAssetUri ?? void 0, dbName: row.dbName };
|
|
268812
268935
|
}
|
|
268936
|
+
__name(bindingFromPlanRow, "bindingFromPlanRow");
|
|
268937
|
+
async function resolveAccessBinding(vctx, ownerHandle, appSlug, dbName) {
|
|
268938
|
+
const plan = accessBindingPlan(vctx, { ownerHandle, appSlug, dbName });
|
|
268939
|
+
if (plan.kind === "fixed") return plan.binding;
|
|
268940
|
+
const t3 = vctx.sql.tables.accessFunctionBindings;
|
|
268941
|
+
const query = vctx.sql.db.select({ accessFnCid: t3.accessFnCid, accessFnAssetUri: t3.accessFnAssetUri, dbName: t3.dbName }).from(t3).where(plan.where);
|
|
268942
|
+
const row = await (plan.orderBy === void 0 ? query : query.orderBy(plan.orderBy)).limit(1).then((rows) => rows[0]);
|
|
268943
|
+
return bindingFromPlanRow(plan, row);
|
|
268944
|
+
}
|
|
268813
268945
|
__name(resolveAccessBinding, "resolveAccessBinding");
|
|
268814
268946
|
async function resolveDmParticipantHandle(vctx, userId, channelSlug) {
|
|
268815
268947
|
const participants = directChannelParticipants(channelSlug);
|
|
@@ -271479,9 +271611,9 @@ var WORKSPACE_IDEA = {
|
|
|
271479
271611
|
var WORKSPACE_IDEAS = Object.values(WORKSPACE_IDEA);
|
|
271480
271612
|
function isCustomPrompt(text3) {
|
|
271481
271613
|
if (text3 === void 0) return false;
|
|
271482
|
-
const
|
|
271483
|
-
if (
|
|
271484
|
-
return PREFILLED_PROMPTS.has(
|
|
271614
|
+
const normalized3 = text3.trim().toLowerCase();
|
|
271615
|
+
if (normalized3 === "") return false;
|
|
271616
|
+
return PREFILLED_PROMPTS.has(normalized3) === false;
|
|
271485
271617
|
}
|
|
271486
271618
|
__name(isCustomPrompt, "isCustomPrompt");
|
|
271487
271619
|
var auditionLaneData = [
|
|
@@ -287633,6 +287765,7 @@ function renderBuildSettledSentence(outcome) {
|
|
|
287633
287765
|
}
|
|
287634
287766
|
if (outcome.fsId !== void 0) facts.push(`Saved as version ${outcome.fsId}.`);
|
|
287635
287767
|
facts.push(outcome.firstBuild === true ? FIRST_BUILD_SEEN_LINE : SEE_IT_LINE);
|
|
287768
|
+
if (outcome.firstBuild === true && outcome.appUrl !== void 0) facts.push(appAddressLine(outcome.appUrl));
|
|
287636
287769
|
if (outcome.accessSummary !== void 0) facts.push(accessSummaryLine(capAccessSummary(outcome.accessSummary)));
|
|
287637
287770
|
if (outcome.accessLine !== void 0) facts.push(outcome.accessLine);
|
|
287638
287771
|
facts.push(...aliasContextLines(outcome.aliasNotes ?? []));
|
|
@@ -287662,6 +287795,10 @@ __name(designFindingsLine, "designFindingsLine");
|
|
|
287662
287795
|
var SEE_IT_LINE = "To see what it looks like now, call read_screenshot before describing the result: it answers at once, with an earlier version's picture, named by its number, while this one's is still being taken, and wait: true waits for this version's own.";
|
|
287663
287796
|
var BUILD_PICTURE_LINE = "The picture of the version this build saved follows this report, taken on a phone as a person sees it: read it before describing the result, the way you would read read_screenshot's.";
|
|
287664
287797
|
var FIRST_BUILD_SEEN_LINE = "The person is already looking at the app. Describe what this report and the saved files establish, as the screen they open on, and do not wait for a picture: its screenshot is taken shortly and is in front of you on their next message.";
|
|
287798
|
+
function appAddressLine(url3) {
|
|
287799
|
+
return `The app opens at ${url3}; a link to it in your reply is this address, copied whole.`;
|
|
287800
|
+
}
|
|
287801
|
+
__name(appAddressLine, "appAddressLine");
|
|
287665
287802
|
function renderAgentWakeNote(outcome) {
|
|
287666
287803
|
return `[build result] ${renderBuildSettledSentence(outcome)} Continue from this result in the same conversation.`;
|
|
287667
287804
|
}
|
|
@@ -290283,13 +290420,13 @@ function isClickInWindow(settings, nowMs) {
|
|
|
290283
290420
|
return age >= 0 && age <= META_CLICK_WINDOW_MS;
|
|
290284
290421
|
}
|
|
290285
290422
|
__name(isClickInWindow, "isClickInWindow");
|
|
290286
|
-
async function
|
|
290423
|
+
async function readSettings2(sql2, userId) {
|
|
290287
290424
|
const t3 = sql2.tables.userSettings;
|
|
290288
290425
|
const row = await sql2.db.select({ settings: t3.settings }).from(t3).where(eq(t3.userId, userId)).limit(1).then((r2) => r2[0]);
|
|
290289
290426
|
if (row === void 0) return void 0;
|
|
290290
290427
|
return parseArrayWarning(row.settings ?? [], userSettingItem).filtered;
|
|
290291
290428
|
}
|
|
290292
|
-
__name(
|
|
290429
|
+
__name(readSettings2, "readSettings");
|
|
290293
290430
|
async function handlesOf2(sql2, userId) {
|
|
290294
290431
|
const t3 = sql2.tables.handleBinding;
|
|
290295
290432
|
const rows = await sql2.db.select({ handle: t3.handle }).from(t3).where(eq(t3.userId, userId)).limit(50).then((r2) => r2);
|
|
@@ -290308,7 +290445,7 @@ async function postCapiShareEvent(ctx, args3) {
|
|
|
290308
290445
|
const r2 = await exception2Result(async () => {
|
|
290309
290446
|
if (ctx.capiToken === void 0 || ctx.capiToken === "") return;
|
|
290310
290447
|
if (ctx.pixelId === void 0 || ctx.pixelId === "") return;
|
|
290311
|
-
const settings = await
|
|
290448
|
+
const settings = await readSettings2(ctx.sql, args3.userId);
|
|
290312
290449
|
if (settings === void 0) return;
|
|
290313
290450
|
if (isClickInWindow(settings, args3.nowMs) === false) return;
|
|
290314
290451
|
if (isStaffAccount(args3.userId, settings, await handlesOf2(ctx.sql, args3.userId))) return;
|
|
@@ -290356,7 +290493,7 @@ var NO_PAYER = { allowed: false, remainingCredits: 0 };
|
|
|
290356
290493
|
var GROUP_CANNOT_BUY = "group-cannot-buy: a group's credits are its members' own";
|
|
290357
290494
|
async function readGroupPayer(sql2, groupUserId) {
|
|
290358
290495
|
return exception2Result(async () => {
|
|
290359
|
-
const settings = await
|
|
290496
|
+
const settings = await readSettings2(sql2, groupUserId);
|
|
290360
290497
|
return settings?.find(isUserSettingGroupPayer)?.payerUserId;
|
|
290361
290498
|
});
|
|
290362
290499
|
}
|
|
@@ -290384,7 +290521,7 @@ async function writeGroupPayer(sql2, args3) {
|
|
|
290384
290521
|
} else {
|
|
290385
290522
|
await sql2.db.update(t3).set({ settings: nextSettings, updated: now3 }).where(and(eq(t3.userId, args3.groupUserId), eq(t3.settings, row.settings)));
|
|
290386
290523
|
}
|
|
290387
|
-
const after = await
|
|
290524
|
+
const after = await readSettings2(sql2, args3.groupUserId);
|
|
290388
290525
|
if (after?.find(isUserSettingGroupPayer)?.claimId === claimId) return Result.Ok(void 0);
|
|
290389
290526
|
}
|
|
290390
290527
|
return Result.Err(new Error(`group-payer: settings write kept conflicting for ${args3.groupUserId}`));
|
|
@@ -290393,7 +290530,7 @@ async function writeGroupPayer(sql2, args3) {
|
|
|
290393
290530
|
__name(writeGroupPayer, "writeGroupPayer");
|
|
290394
290531
|
async function readGroupAsker(sql2, args3) {
|
|
290395
290532
|
return exception2Result(async () => {
|
|
290396
|
-
const settings = await
|
|
290533
|
+
const settings = await readSettings2(sql2, args3.groupUserId);
|
|
290397
290534
|
const item = settings?.find(isUserSettingGroupPayer);
|
|
290398
290535
|
if (item === void 0 || item.asker !== true) return void 0;
|
|
290399
290536
|
const id = item.payerUserId;
|
|
@@ -290419,7 +290556,7 @@ async function replaceSettingsItem(sql2, args3) {
|
|
|
290419
290556
|
} else {
|
|
290420
290557
|
await sql2.db.update(t3).set({ settings: nextSettings, updated: now3 }).where(and(eq(t3.userId, args3.userId), eq(t3.settings, row.settings)));
|
|
290421
290558
|
}
|
|
290422
|
-
if (args3.landed(await
|
|
290559
|
+
if (args3.landed(await readSettings2(sql2, args3.userId), claimId)) return Result.Ok(void 0);
|
|
290423
290560
|
}
|
|
290424
290561
|
return Result.Err(new Error(`group-payer: ${args3.itemType} write kept conflicting for ${args3.userId}`));
|
|
290425
290562
|
});
|
|
@@ -290428,7 +290565,7 @@ __name(replaceSettingsItem, "replaceSettingsItem");
|
|
|
290428
290565
|
var GROUP_ROSTER_KEPT = 50;
|
|
290429
290566
|
async function readGroupRoster(sql2, groupUserId) {
|
|
290430
290567
|
return exception2Result(async () => {
|
|
290431
|
-
const settings = await
|
|
290568
|
+
const settings = await readSettings2(sql2, groupUserId);
|
|
290432
290569
|
return settings?.find(isUserSettingGroupRoster)?.userIds ?? [];
|
|
290433
290570
|
});
|
|
290434
290571
|
}
|
|
@@ -290452,7 +290589,7 @@ async function isOnGroupRoster(sql2, args3) {
|
|
|
290452
290589
|
__name(isOnGroupRoster, "isOnGroupRoster");
|
|
290453
290590
|
async function readGroupSponsor(sql2, groupUserId) {
|
|
290454
290591
|
return exception2Result(async () => {
|
|
290455
|
-
const settings = await
|
|
290592
|
+
const settings = await readSettings2(sql2, groupUserId);
|
|
290456
290593
|
const id = settings?.find(isUserSettingGroupSponsor)?.sponsorUserId;
|
|
290457
290594
|
return id !== void 0 && canPayForGroup(id) ? id : void 0;
|
|
290458
290595
|
});
|
|
@@ -290486,7 +290623,7 @@ var GROUP_MEMBERS_KEPT = 20;
|
|
|
290486
290623
|
var HANDLE_SHAPE = /^[a-z0-9][a-z0-9-]{0,62}$/;
|
|
290487
290624
|
async function readGroupChats(sql2, personUserId) {
|
|
290488
290625
|
return exception2Result(async () => {
|
|
290489
|
-
const settings = await
|
|
290626
|
+
const settings = await readSettings2(sql2, personUserId);
|
|
290490
290627
|
return settings?.find(isUserSettingGroupChats)?.chats ?? [];
|
|
290491
290628
|
});
|
|
290492
290629
|
}
|
|
@@ -293167,7 +293304,7 @@ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
|
293167
293304
|
init_performance2();
|
|
293168
293305
|
init_ssr_press_replay();
|
|
293169
293306
|
var SSR_INERT_CEILING_MS = 15e3;
|
|
293170
|
-
var SSR_HASH_BOOT_BODY = `var c=s===null||s===undefined?null:s.previousElementSibling;if(c===null||c.getAttribute("data-vibe-ssr")===null)return;if(typeof h==="string"&&h.length>1){c.removeAttribute("data-vibe-ssr");c.removeAttribute("inert");c.textContent="";return}if(!c.hasAttribute("inert"))return;var l=function(){c.removeAttribute("inert")};setTimeout(l,m);w.addEventListener("error",function(e){var t=e&&e.target;if(t===w||(t&&t.getAttribute&&t.getAttribute("data-vibe-mount")==="1"))l()},true);w.addEventListener("unhandledrejection",l);
|
|
293307
|
+
var SSR_HASH_BOOT_BODY = `var c=s===null||s===undefined?null:s.previousElementSibling;if(c===null||c.getAttribute("data-vibe-ssr")===null)return;if(typeof h==="string"&&h.length>1){c.removeAttribute("data-vibe-ssr");c.removeAttribute("inert");c.textContent="";return}if(!c.hasAttribute("inert"))return;var l=function(){c.removeAttribute("inert")};setTimeout(l,m);w.addEventListener("error",function(e){var t=e&&e.target;if(t===w||(t&&t.getAttribute&&t.getAttribute("data-vibe-mount")==="1"))l()},true);w.addEventListener("unhandledrejection",l);var b=function(x,y){var n=[c].concat(Array.prototype.slice.call(c.children)),i=0;for(;i<n.length;i++){var r=n[i].getBoundingClientRect();if(x>=r.left&&x<=r.right&&y>=r.top&&y<=r.bottom)return true}return false};var hp=function(x,y,a){c.setAttribute(${JSON.stringify(SSR_PRESS_ATTR)},x+" "+y+" "+(w.scrollX||0)+" "+(w.scrollY||0)+" "+a)};w.addEventListener("click",function(e){var t=e.target;if(!t||t.nodeType!==1||!(t===c||c.contains(t)||t.contains(c)))return;var x=e.clientX,y=e.clientY;if(!b(x,y))return;if(!c.hasAttribute("inert")){c.removeAttribute(${JSON.stringify(SSR_PRESS_ATTR)});return}hp(x,y,Date.now())},true);var f=0,p=Date.now();w.addEventListener("message",function(e){var d=e.data;if(!d||d.type!==${JSON.stringify(SSR_PRESS_MESSAGE)}||!w.parent||w.parent===w||e.source!==w.parent)return;var x=d.x,y=d.y,a=d.at;if(typeof x!=="number"||typeof y!=="number"||typeof a!=="number"||!(a>f)||Date.now()-p>m)return;f=a;if(!b(x,y))return;hp(x,y,a);if(!c.hasAttribute("inert"))c.dispatchEvent(new Event(${JSON.stringify(SSR_PRESS_EVENT)}))});`;
|
|
293171
293308
|
function ssrHashBootScript() {
|
|
293172
293309
|
return `(function(s,h,m,w){${SSR_HASH_BOOT_BODY}})(document.currentScript,location.hash,${SSR_INERT_CEILING_MS},window);`;
|
|
293173
293310
|
}
|
|
@@ -302777,6 +302914,47 @@ function normalizeChannels(channels) {
|
|
|
302777
302914
|
}
|
|
302778
302915
|
__name(normalizeChannels, "normalizeChannels");
|
|
302779
302916
|
|
|
302917
|
+
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/backend-put-state.ts
|
|
302918
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
302919
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
302920
|
+
init_performance2();
|
|
302921
|
+
async function readBackendPutState(vctx, key) {
|
|
302922
|
+
const { ownerHandle, appSlug, dbName, docId } = key;
|
|
302923
|
+
if (docId === void 0) {
|
|
302924
|
+
return { binding: await resolveAccessBinding(vctx, ownerHandle, appSlug, dbName), head: void 0, storedOutput: void 0 };
|
|
302925
|
+
}
|
|
302926
|
+
const db = vctx.sql.db;
|
|
302927
|
+
const tDocs = vctx.sql.tables.appDocuments;
|
|
302928
|
+
const tOut = vctx.sql.tables.accessFnOutputs;
|
|
302929
|
+
const tAfb = vctx.sql.tables.accessFunctionBindings;
|
|
302930
|
+
const head = db.select({ hData: tDocs.data, hDeleted: tDocs.deleted, hSeq: tDocs.seq }).from(tDocs).where(
|
|
302931
|
+
key.readHead ? and(eq(tDocs.ownerHandle, ownerHandle), eq(tDocs.appSlug, appSlug), eq(tDocs.dbName, dbName), eq(tDocs.docId, docId)) : sql`1 = 0`
|
|
302932
|
+
).orderBy(desc(tDocs.seq)).limit(1).as("put_head");
|
|
302933
|
+
const output2 = db.select({ oOutput: tOut.output }).from(tOut).where(and(eq(tOut.ownerHandle, ownerHandle), eq(tOut.appSlug, appSlug), eq(tOut.dbName, dbName), eq(tOut.docId, docId))).limit(1).as("put_output");
|
|
302934
|
+
const plan = accessBindingPlan(vctx, { ownerHandle, appSlug, dbName });
|
|
302935
|
+
const bindingQuery = db.select({ bCid: tAfb.accessFnCid, bAssetUri: tAfb.accessFnAssetUri, bDbName: tAfb.dbName }).from(tAfb).where(plan.kind === "lookup" ? plan.where : sql`1 = 0`);
|
|
302936
|
+
const binding2 = (plan.kind === "lookup" && plan.orderBy !== void 0 ? bindingQuery.orderBy(plan.orderBy) : bindingQuery).limit(1).as("put_binding");
|
|
302937
|
+
const row = await db.select({
|
|
302938
|
+
hData: head.hData,
|
|
302939
|
+
hDeleted: head.hDeleted,
|
|
302940
|
+
hSeq: head.hSeq,
|
|
302941
|
+
oOutput: output2.oOutput,
|
|
302942
|
+
bCid: binding2.bCid,
|
|
302943
|
+
bAssetUri: binding2.bAssetUri,
|
|
302944
|
+
bDbName: binding2.bDbName
|
|
302945
|
+
}).from(sql`(select 1 as "one") as "put_base"`).leftJoin(head, sql`1 = 1`).leftJoin(output2, sql`1 = 1`).leftJoin(binding2, sql`1 = 1`).then((rows) => rows[0]);
|
|
302946
|
+
return {
|
|
302947
|
+
binding: plan.kind === "fixed" ? plan.binding : bindingFromPlanRow(plan, {
|
|
302948
|
+
accessFnCid: row?.bCid ?? null,
|
|
302949
|
+
accessFnAssetUri: row?.bAssetUri ?? null,
|
|
302950
|
+
dbName: row?.bDbName ?? null
|
|
302951
|
+
}),
|
|
302952
|
+
head: row === void 0 || row.hSeq === null || row.hSeq === void 0 ? void 0 : { data: row.hData, deleted: Number(row.hDeleted), seq: Number(row.hSeq) },
|
|
302953
|
+
storedOutput: row?.oOutput ?? void 0
|
|
302954
|
+
};
|
|
302955
|
+
}
|
|
302956
|
+
__name(readBackendPutState, "readBackendPutState");
|
|
302957
|
+
|
|
302780
302958
|
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/emit-backend-onchange.ts
|
|
302781
302959
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
302782
302960
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
@@ -304411,24 +304589,22 @@ async function handleBackendPut(vctx, base2, op) {
|
|
|
304411
304589
|
return deny("Access denied");
|
|
304412
304590
|
}
|
|
304413
304591
|
timer.mark("writeAllowed");
|
|
304414
|
-
const
|
|
304592
|
+
const putState = await readBackendPutState(vctx, {
|
|
304593
|
+
ownerHandle,
|
|
304594
|
+
appSlug,
|
|
304595
|
+
dbName,
|
|
304596
|
+
docId: op.docId ?? void 0,
|
|
304597
|
+
readHead: Boolean(op.docId)
|
|
304598
|
+
});
|
|
304599
|
+
const afbRow = putState.binding;
|
|
304415
304600
|
timer.mark("binding");
|
|
304416
304601
|
if (!userId && !afbRow?.accessFnCid) return deny("Access denied");
|
|
304417
304602
|
if (afbRow?.accessFnCid && !vctx.invokeAccessFn) return deny("Access function unavailable");
|
|
304418
304603
|
const docId = op.docId ?? vctx.sthis.timeOrderedNextId().str;
|
|
304419
|
-
|
|
304420
|
-
|
|
304421
|
-
|
|
304422
|
-
|
|
304423
|
-
const tDocs = vctx.sql.tables.appDocuments;
|
|
304424
|
-
const headRow = await vctx.sql.db.select({ data: tDocs.data, deleted: tDocs.deleted, seq: tDocs.seq }).from(tDocs).where(
|
|
304425
|
-
and(eq(tDocs.ownerHandle, ownerHandle), eq(tDocs.appSlug, appSlug), eq(tDocs.dbName, dbName), eq(tDocs.docId, op.docId))
|
|
304426
|
-
).orderBy(desc(tDocs.seq)).limit(1).then((r2) => r2[0]);
|
|
304427
|
-
oldDoc = headRow?.data ?? null;
|
|
304428
|
-
oldDocDeleted = headRow?.deleted === 1;
|
|
304429
|
-
oldDocRev = liveRevOf2(headRow);
|
|
304430
|
-
timer.mark("head");
|
|
304431
|
-
}
|
|
304604
|
+
const headRow = putState.head;
|
|
304605
|
+
const oldDoc = headRow?.data ?? null;
|
|
304606
|
+
const oldDocDeleted = headRow?.deleted === 1;
|
|
304607
|
+
const oldDocRev = liveRevOf2(headRow);
|
|
304432
304608
|
let accessResult;
|
|
304433
304609
|
let grantsReduceBefore;
|
|
304434
304610
|
if (afbRow?.accessFnCid && vctx.invokeAccessFn) {
|
|
@@ -304546,8 +304722,37 @@ async function handleBackendPut(vctx, base2, op) {
|
|
|
304546
304722
|
} : void 0;
|
|
304547
304723
|
const now3 = (/* @__PURE__ */ new Date()).toISOString();
|
|
304548
304724
|
const t3 = vctx.sql.tables.appDocuments;
|
|
304549
|
-
const
|
|
304550
|
-
|
|
304725
|
+
const feedOld = { channels: afbRow?.accessFnCid ? channelSetOfStoredOutput(putState.storedOutput) : [] };
|
|
304726
|
+
const readOldChannelsInLock = /* @__PURE__ */ __name(async (exec) => {
|
|
304727
|
+
if (!afbRow?.accessFnCid) return;
|
|
304728
|
+
const tO = vctx.sql.tables.accessFnOutputs;
|
|
304729
|
+
const row = await exec.select({ output: tO.output }).from(tO).where(and(eq(tO.ownerHandle, ownerHandle), eq(tO.appSlug, appSlug), eq(tO.dbName, dbName), eq(tO.docId, docId))).limit(1).then((r2) => r2[0]);
|
|
304730
|
+
feedOld.channels = channelSetOfStoredOutput(row?.output);
|
|
304731
|
+
}, "readOldChannelsInLock");
|
|
304732
|
+
const feedParams = /* @__PURE__ */ __name((seq2, exec) => ({
|
|
304733
|
+
db: exec,
|
|
304734
|
+
flavour: vctx.sql.flavour,
|
|
304735
|
+
ownerHandle,
|
|
304736
|
+
appSlug,
|
|
304737
|
+
dbName,
|
|
304738
|
+
docId,
|
|
304739
|
+
seq: seq2,
|
|
304740
|
+
oldChannels: feedOld.channels,
|
|
304741
|
+
newChannels: channelSetOfDescriptor(accessResult),
|
|
304742
|
+
alwaysPut: true,
|
|
304743
|
+
created: now3
|
|
304744
|
+
}), "feedParams");
|
|
304745
|
+
const feedState = { inTransaction: false };
|
|
304746
|
+
const appendFeedInTransaction = /* @__PURE__ */ __name(async (seq2, exec) => {
|
|
304747
|
+
if (vctx.sql.flavour !== "pg" || grantUpsertErr !== void 0) return;
|
|
304748
|
+
await emitChannelChangeFeed({ ...feedParams(seq2, exec), inTransaction: true });
|
|
304749
|
+
feedState.inTransaction = true;
|
|
304750
|
+
}, "appendFeedInTransaction");
|
|
304751
|
+
const sidecarWithFeed = /* @__PURE__ */ __name(async (seq2, exec) => {
|
|
304752
|
+
await readOldChannelsInLock(exec);
|
|
304753
|
+
await sidecar(seq2, exec);
|
|
304754
|
+
await appendFeedInTransaction(seq2, exec);
|
|
304755
|
+
}, "sidecarWithFeed");
|
|
304551
304756
|
let alloc;
|
|
304552
304757
|
try {
|
|
304553
304758
|
alloc = await allocateAndInsertRevision({
|
|
@@ -304576,7 +304781,7 @@ async function handleBackendPut(vctx, base2, op) {
|
|
|
304576
304781
|
// exact content is a conflict (not an absorbed success) and `onAbsorb`
|
|
304577
304782
|
// never heals a sidecar on a write that lost.
|
|
304578
304783
|
ifRev: op.ifRev,
|
|
304579
|
-
sidecar,
|
|
304784
|
+
sidecar: sidecarWithFeed,
|
|
304580
304785
|
onAbsorb
|
|
304581
304786
|
});
|
|
304582
304787
|
} catch (err) {
|
|
@@ -304597,23 +304802,14 @@ async function handleBackendPut(vctx, base2, op) {
|
|
|
304597
304802
|
if (rHealFanOut.isErr()) console.error("backend put healed-grant fan-out error:", rHealFanOut.Err());
|
|
304598
304803
|
}
|
|
304599
304804
|
if (alloc.inserted) {
|
|
304600
|
-
|
|
304601
|
-
|
|
304602
|
-
|
|
304603
|
-
|
|
304604
|
-
ownerHandle,
|
|
304605
|
-
appSlug,
|
|
304606
|
-
dbName,
|
|
304607
|
-
docId,
|
|
304608
|
-
seq: alloc.seq,
|
|
304609
|
-
oldChannels: oldFeedChannels,
|
|
304610
|
-
newChannels: channelSetOfDescriptor(accessResult),
|
|
304611
|
-
alwaysPut: true,
|
|
304612
|
-
created: now3
|
|
304805
|
+
if (!feedState.inTransaction) {
|
|
304806
|
+
const seq3 = alloc.seq;
|
|
304807
|
+
const rFeed = await exception2Result(async () => {
|
|
304808
|
+
await bestEffortChannelChange(feedParams(seq3, vctx.sql.db));
|
|
304613
304809
|
});
|
|
304614
|
-
|
|
304615
|
-
|
|
304616
|
-
|
|
304810
|
+
if (rFeed.isErr()) {
|
|
304811
|
+
console.error("backend put post-commit sync-feed error:", rFeed.Err());
|
|
304812
|
+
}
|
|
304617
304813
|
}
|
|
304618
304814
|
timer.mark("syncFeed");
|
|
304619
304815
|
const putFanoutChannels = [
|
|
@@ -326072,8 +326268,8 @@ function assetRequestOriginAllowed(vctx, request) {
|
|
|
326072
326268
|
if (origin === void 0 || origin !== request.origin) return false;
|
|
326073
326269
|
if (origin === httpOrigin(vctx.params.vibes.env.VIBES_DIY_PUBLIC_BASE_URL)) return true;
|
|
326074
326270
|
if (request.app === void 0) return false;
|
|
326075
|
-
const
|
|
326076
|
-
return origin === httpOrigin(
|
|
326271
|
+
const appUrl2 = calcEntryPointUrl({ ...vctx.params.vibes.svc, bindings: request.app });
|
|
326272
|
+
return origin === httpOrigin(appUrl2);
|
|
326077
326273
|
}
|
|
326078
326274
|
__name(assetRequestOriginAllowed, "assetRequestOriginAllowed");
|
|
326079
326275
|
function httpOrigin(value2) {
|
|
@@ -331818,12 +332014,12 @@ async function guestAppVisitors(vctx, req2) {
|
|
|
331818
332014
|
for (const { foreignUserId } of waiting) {
|
|
331819
332015
|
const staff = isStaffAccount(
|
|
331820
332016
|
foreignUserId,
|
|
331821
|
-
await
|
|
332017
|
+
await readSettings2(vctx.sql, foreignUserId) ?? [],
|
|
331822
332018
|
await handlesOf2(vctx.sql, foreignUserId)
|
|
331823
332019
|
);
|
|
331824
332020
|
if (staff === false) people.push(foreignUserId);
|
|
331825
332021
|
}
|
|
331826
|
-
const openers = guestAppOpeners(await
|
|
332022
|
+
const openers = guestAppOpeners(await readSettings2(vctx.sql, req2.callerUserId) ?? [], req2);
|
|
331827
332023
|
return mergeGuestVisitors(openers, people);
|
|
331828
332024
|
});
|
|
331829
332025
|
}
|
|
@@ -335930,7 +336126,8 @@ function makeBackendAiCallback(vctx, base2) {
|
|
|
335930
336126
|
chargedCredits: costCents * DISPLAY_CREDITS_PER_CENT,
|
|
335931
336127
|
lane: `backend-${base2.lane}`,
|
|
335932
336128
|
ownerHandle: base2.ownerHandle,
|
|
335933
|
-
appSlug: base2.appSlug
|
|
336129
|
+
appSlug: base2.appSlug,
|
|
336130
|
+
ledger: creditMilestoneLedger(vctx.sql)
|
|
335934
336131
|
})
|
|
335935
336132
|
);
|
|
335936
336133
|
if (rMilestones.isErr()) {
|
|
@@ -356370,10 +356567,10 @@ function activateUrlCandidates(input3) {
|
|
|
356370
356567
|
for (const source of candidates) {
|
|
356371
356568
|
for (const token of source.match(/https:\/\/[^\s<>"'`]+/gi) ?? []) {
|
|
356372
356569
|
if (activated.length >= MAX_ACTIVATED_URLS) return activated;
|
|
356373
|
-
const
|
|
356374
|
-
if (
|
|
356375
|
-
seen2.add(
|
|
356376
|
-
activated.push(
|
|
356570
|
+
const normalized3 = normalizeCandidate(token);
|
|
356571
|
+
if (normalized3 !== void 0 && seen2.has(normalized3) === false) {
|
|
356572
|
+
seen2.add(normalized3);
|
|
356573
|
+
activated.push(normalized3);
|
|
356377
356574
|
}
|
|
356378
356575
|
}
|
|
356379
356576
|
}
|
|
@@ -356403,8 +356600,8 @@ function parseCandidate(candidate) {
|
|
|
356403
356600
|
if (checkEgressFloor(url3).ok === false) return void 0;
|
|
356404
356601
|
const builder = BuildURI.from(uri.toString()).hash("");
|
|
356405
356602
|
if (uri.port === "443") builder.port("");
|
|
356406
|
-
const
|
|
356407
|
-
return
|
|
356603
|
+
const normalized3 = builder.toString();
|
|
356604
|
+
return normalized3.length <= MAX_ACTIVATED_URL_LENGTH ? normalized3 : void 0;
|
|
356408
356605
|
}
|
|
356409
356606
|
__name(parseCandidate, "parseCandidate");
|
|
356410
356607
|
function trimUnmatchedClosingPunctuation(candidate) {
|
|
@@ -358221,6 +358418,77 @@ async function releaseAccessVerdicts(vctx, args3) {
|
|
|
358221
358418
|
}
|
|
358222
358419
|
__name(releaseAccessVerdicts, "releaseAccessVerdicts");
|
|
358223
358420
|
|
|
358421
|
+
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/placeholder-entry.ts
|
|
358422
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
358423
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
358424
|
+
init_performance2();
|
|
358425
|
+
var ENTRY = /^\/?App\.(jsx|tsx|js|ts)$/;
|
|
358426
|
+
var PLACEHOLDER_MAX_CHARS = 600;
|
|
358427
|
+
var PLACEHOLDER_TEXTS = /* @__PURE__ */ new Set([
|
|
358428
|
+
"hello",
|
|
358429
|
+
"hello world",
|
|
358430
|
+
"hello there",
|
|
358431
|
+
"hello vibes",
|
|
358432
|
+
"hello app",
|
|
358433
|
+
"app",
|
|
358434
|
+
"my app",
|
|
358435
|
+
"your app",
|
|
358436
|
+
"new app",
|
|
358437
|
+
"app goes here",
|
|
358438
|
+
"content goes here",
|
|
358439
|
+
"your app goes here",
|
|
358440
|
+
"placeholder",
|
|
358441
|
+
"placeholder app",
|
|
358442
|
+
"loading",
|
|
358443
|
+
"building",
|
|
358444
|
+
"building your app",
|
|
358445
|
+
"coming soon",
|
|
358446
|
+
"todo"
|
|
358447
|
+
]);
|
|
358448
|
+
function withoutComments(source) {
|
|
358449
|
+
return source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:"'`])\/\/.*$/gm, "$1");
|
|
358450
|
+
}
|
|
358451
|
+
__name(withoutComments, "withoutComments");
|
|
358452
|
+
function normalized2(text3) {
|
|
358453
|
+
return text3.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").trim();
|
|
358454
|
+
}
|
|
358455
|
+
__name(normalized2, "normalized");
|
|
358456
|
+
function visibleText(code2) {
|
|
358457
|
+
const parts = [];
|
|
358458
|
+
for (const m of code2.matchAll(/>([^<>{}]*)</g)) parts.push(m[1]);
|
|
358459
|
+
for (const m of code2.matchAll(/\{\s*(["'`])([^"'`]*)\1\s*\}/g)) parts.push(m[2]);
|
|
358460
|
+
return normalized2(parts.join(" "));
|
|
358461
|
+
}
|
|
358462
|
+
__name(visibleText, "visibleText");
|
|
358463
|
+
function isPlaceholderEntry(source) {
|
|
358464
|
+
const code2 = withoutComments(source);
|
|
358465
|
+
if (code2.replace(/\s+/g, " ").length > PLACEHOLDER_MAX_CHARS) return false;
|
|
358466
|
+
if (/\bfrom\s+["']\.{1,2}\//.test(code2) || /\bimport\s*\(?\s*["']\.{1,2}\//.test(code2)) return false;
|
|
358467
|
+
if (/\buse[A-Z]\w*\s*\(/.test(code2)) return false;
|
|
358468
|
+
if (/\bon[A-Z]\w*\s*=/.test(code2)) return false;
|
|
358469
|
+
if (/\.map\s*\(/.test(code2)) return false;
|
|
358470
|
+
const body = code2.replace(/^[ \t]*import\b[\s\S]*?(["'])[^"'\n]*\1[ \t]*;?/gm, "");
|
|
358471
|
+
if (/(?<!=)>[^<>]*\{(?!\s*(["'`])[^"'`]*\1\s*\})/.test(body)) return false;
|
|
358472
|
+
const text3 = visibleText(body);
|
|
358473
|
+
return text3 !== "" && PLACEHOLDER_TEXTS.has(text3);
|
|
358474
|
+
}
|
|
358475
|
+
__name(isPlaceholderEntry, "isPlaceholderEntry");
|
|
358476
|
+
function placeholderEntryFinding(vfs) {
|
|
358477
|
+
for (const [path3, source] of vfs) {
|
|
358478
|
+
if (ENTRY.test(path3) === false) continue;
|
|
358479
|
+
if (isPlaceholderEntry(source) === false) return void 0;
|
|
358480
|
+
const name = path3.replace(/^\/+/, "");
|
|
358481
|
+
return `${name} is still a placeholder that shows only a heading. Write the whole app the request describes in ${name}.`;
|
|
358482
|
+
}
|
|
358483
|
+
return void 0;
|
|
358484
|
+
}
|
|
358485
|
+
__name(placeholderEntryFinding, "placeholderEntryFinding");
|
|
358486
|
+
function hasEntryFile(vfs) {
|
|
358487
|
+
for (const path3 of vfs.keys()) if (ENTRY.test(path3)) return true;
|
|
358488
|
+
return false;
|
|
358489
|
+
}
|
|
358490
|
+
__name(hasEntryFile, "hasEntryFile");
|
|
358491
|
+
|
|
358224
358492
|
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/agent-file-validation.ts
|
|
358225
358493
|
function agentEditablePath(path3) {
|
|
358226
358494
|
return /^\/[A-Za-z0-9_-][A-Za-z0-9_./-]*\.(jsx?|tsx?|json|css)$/.test(path3) && path3.split("/").every((part) => part !== "." && part !== "..") && path3.includes("//") === false && (/\/(access\.js|backend\.js|seed\.json|App\.(jsx|tsx|js|ts))$/.test(path3) === false || path3.lastIndexOf("/") === 0);
|
|
@@ -358284,6 +358552,10 @@ async function validateAgentFiles(vctx, args3) {
|
|
|
358284
358552
|
vibeEntryFile(lintFiles) === void 0 ? "missing-entry" : "missing-default-export"
|
|
358285
358553
|
)
|
|
358286
358554
|
);
|
|
358555
|
+
if (args3.firstBuild === true) {
|
|
358556
|
+
const placeholder2 = placeholderEntryFinding(args3.vfs);
|
|
358557
|
+
if (placeholder2 !== void 0) return Result.Err(new AgentFileRefusal("lint", placeholder2, "placeholder-entry"));
|
|
358558
|
+
}
|
|
358287
358559
|
for (const [path3, contents] of args3.vfs) {
|
|
358288
358560
|
if (/\.(jsx?|tsx?)$/.test(path3)) {
|
|
358289
358561
|
const diagnostics = buildCheckCandidate({ vfs: args3.vfs, path: path3, contents });
|
|
@@ -360673,8 +360945,10 @@ async function planPushSkinLook(vctx, args3) {
|
|
|
360673
360945
|
const stored = entries.filter(isActiveLookPackage).at(-1)?.package;
|
|
360674
360946
|
if (stored === void 0 || skins.length === 1 && stored === skins[0]) return void 0;
|
|
360675
360947
|
const previous = await selectTopProductionRelease(vctx, args3);
|
|
360676
|
-
const previousFiles = previous === void 0 ? void 0 :
|
|
360677
|
-
|
|
360948
|
+
const previousFiles = previous === void 0 ? void 0 : await releaseSources(vctx, previous.fsId);
|
|
360949
|
+
const fresh = pushedSkinLook({ pushed: args3.sources, previous: previousFiles, stored });
|
|
360950
|
+
if (fresh !== void 0 || previous === void 0 || previousFiles === void 0) return fresh;
|
|
360951
|
+
return missedSkinLook(vctx, { ...args3, stored, previous, previousFiles });
|
|
360678
360952
|
});
|
|
360679
360953
|
if (rPlan.isErr()) {
|
|
360680
360954
|
vctx.logger.Warn().Err(rPlan).Str("ownerHandle", args3.ownerHandle).Str("appSlug", args3.appSlug).Msg("push-skin-look-plan-failed");
|
|
@@ -360683,6 +360957,52 @@ async function planPushSkinLook(vctx, args3) {
|
|
|
360683
360957
|
return rPlan.Ok();
|
|
360684
360958
|
}
|
|
360685
360959
|
__name(planPushSkinLook, "planPushSkinLook");
|
|
360960
|
+
async function pushSkinLookHeadMismatch(vctx, args3) {
|
|
360961
|
+
const head = await selectTopProductionRelease(vctx, args3);
|
|
360962
|
+
return head?.fsId === args3.fsId ? void 0 : `the production head is ${head?.fsId ?? "missing"}, not ${args3.fsId}`;
|
|
360963
|
+
}
|
|
360964
|
+
__name(pushSkinLookHeadMismatch, "pushSkinLookHeadMismatch");
|
|
360965
|
+
async function releaseSources(vctx, fsId) {
|
|
360966
|
+
return Object.values(await loadTurnFilesByFsId(vctx, fsId, { strict: true }));
|
|
360967
|
+
}
|
|
360968
|
+
__name(releaseSources, "releaseSources");
|
|
360969
|
+
async function missedSkinLook(vctx, args3) {
|
|
360970
|
+
const inPrevious = sourceSkinLooks(args3.previousFiles).map((p3) => p3.id);
|
|
360971
|
+
const candidates = sourceSkinLooks(args3.sources).filter((p3) => p3.id !== args3.stored && inPrevious.includes(p3.id));
|
|
360972
|
+
if (candidates.length === 0) return void 0;
|
|
360973
|
+
const writtenAt = await lookPackageWrittenAt(vctx, args3);
|
|
360974
|
+
if (writtenAt === void 0 || writtenAt >= args3.previous.created) return void 0;
|
|
360975
|
+
const before = await vctx.sql.db.select({ fsId: vctx.sql.tables.apps.fsId }).from(vctx.sql.tables.apps).where(
|
|
360976
|
+
and(
|
|
360977
|
+
eq(vctx.sql.tables.apps.ownerHandle, args3.ownerHandle),
|
|
360978
|
+
eq(vctx.sql.tables.apps.appSlug, args3.appSlug),
|
|
360979
|
+
eq(vctx.sql.tables.apps.mode, "production"),
|
|
360980
|
+
lt(vctx.sql.tables.apps.releaseSeq, args3.previous.releaseSeq)
|
|
360981
|
+
)
|
|
360982
|
+
).orderBy(desc(vctx.sql.tables.apps.releaseSeq)).limit(1).then((r2) => r2[0]);
|
|
360983
|
+
if (before === void 0) return void 0;
|
|
360984
|
+
const inBefore = sourceSkinLooks(await releaseSources(vctx, before.fsId)).map((p3) => p3.id);
|
|
360985
|
+
return candidates.find((p3) => inBefore.includes(p3.id) === false);
|
|
360986
|
+
}
|
|
360987
|
+
__name(missedSkinLook, "missedSkinLook");
|
|
360988
|
+
async function lookPackageWrittenAt(vctx, args3) {
|
|
360989
|
+
const at5 = vctx.sql.tables.appSettings;
|
|
360990
|
+
const hb = vctx.sql.tables.handleBinding;
|
|
360991
|
+
const row = await vctx.sql.db.select({ userId: at5.userId, settingsItemizedAt: at5.settingsItemizedAt, updated: at5.updated }).from(at5).innerJoin(hb, and(eq(hb.handle, at5.ownerHandle), eq(hb.userId, at5.userId))).where(and(eq(at5.ownerHandle, args3.ownerHandle), eq(at5.appSlug, args3.appSlug))).limit(1).then((r2) => r2[0]);
|
|
360992
|
+
if (row === void 0) return void 0;
|
|
360993
|
+
if (row.settingsItemizedAt === null || row.settingsItemizedAt === void 0) return row.updated;
|
|
360994
|
+
const it4 = vctx.sql.tables.appSettingItems;
|
|
360995
|
+
const item = await vctx.sql.db.select({ updated: it4.updated }).from(it4).where(
|
|
360996
|
+
and(
|
|
360997
|
+
eq(it4.userId, row.userId),
|
|
360998
|
+
eq(it4.ownerHandle, args3.ownerHandle),
|
|
360999
|
+
eq(it4.appSlug, args3.appSlug),
|
|
361000
|
+
eq(it4.itemKey, keyForEntry({ type: "active.look-package", package: "" }))
|
|
361001
|
+
)
|
|
361002
|
+
).limit(1).then((r2) => r2[0]);
|
|
361003
|
+
return item?.updated;
|
|
361004
|
+
}
|
|
361005
|
+
__name(lookPackageWrittenAt, "lookPackageWrittenAt");
|
|
360686
361006
|
|
|
360687
361007
|
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/public/chip-stamp.ts
|
|
360688
361008
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
@@ -362254,8 +362574,14 @@ async function ensureAppSlugItem(vctx, req2, opts) {
|
|
|
362254
362574
|
}
|
|
362255
362575
|
if (mintsLookOnCreate && req2.from !== void 0) await mintPushedLook();
|
|
362256
362576
|
if (pushSkinLook !== void 0) {
|
|
362257
|
-
const rLook = await exception2Result(
|
|
362258
|
-
|
|
362577
|
+
const rLook = await exception2Result(async () => {
|
|
362578
|
+
const notHead = await pushSkinLookHeadMismatch(vctx, {
|
|
362579
|
+
ownerHandle: ensured.ownerHandle,
|
|
362580
|
+
appSlug: ensured.appSlug,
|
|
362581
|
+
fsId: ensured.fsId
|
|
362582
|
+
});
|
|
362583
|
+
if (notHead !== void 0) return Result.Ok({ error: notHead });
|
|
362584
|
+
return ensureAppSettings(
|
|
362259
362585
|
vctx,
|
|
362260
362586
|
{
|
|
362261
362587
|
type: "vibes.diy.req-ensure-app-settings",
|
|
@@ -362264,8 +362590,8 @@ async function ensureAppSlugItem(vctx, req2, opts) {
|
|
|
362264
362590
|
lookPackage: pushSkinLook.id
|
|
362265
362591
|
},
|
|
362266
362592
|
appHandleBinding.ownerHandle.userId
|
|
362267
|
-
)
|
|
362268
|
-
);
|
|
362593
|
+
);
|
|
362594
|
+
});
|
|
362269
362595
|
const lookError = rLook.isErr() ? rLook.Err().message : rLook.Ok().error;
|
|
362270
362596
|
if (lookError === void 0) {
|
|
362271
362597
|
vctx.logger.Info().Str("ownerHandle", ensured.ownerHandle).Str("appSlug", ensured.appSlug).Str("lookPackage", pushSkinLook.id).Msg("push-skin-look-stored");
|
|
@@ -367646,6 +367972,7 @@ async function handlePromptContext({
|
|
|
367646
367972
|
let resolvedFileSystem;
|
|
367647
367973
|
let changedPathsFromBlocks;
|
|
367648
367974
|
let carriedItems2 = carried ?? [];
|
|
367975
|
+
let firstBuild = false;
|
|
367649
367976
|
if (fileSystem) {
|
|
367650
367977
|
resolvedFileSystem = fileSystem;
|
|
367651
367978
|
const blockPaths = resolveCodeBlockChangedPaths(code2);
|
|
@@ -367674,6 +368001,7 @@ async function handlePromptContext({
|
|
|
367674
368001
|
appSlug: appSlugForPersist
|
|
367675
368002
|
});
|
|
367676
368003
|
carriedItems2 = base2.carried;
|
|
368004
|
+
firstBuild = agentDispatched === true && hasEntryFile(base2.vfs) === false;
|
|
367677
368005
|
const resolved = resolveCodeBlocks(code2, base2.vfs);
|
|
367678
368006
|
resolvedFileSystem = resolved.files;
|
|
367679
368007
|
changedPathsFromBlocks = resolved.changedPaths;
|
|
@@ -367707,7 +368035,8 @@ async function handlePromptContext({
|
|
|
367707
368035
|
vfs: new Map(sources.map((file2) => [file2.filename, file2.content])),
|
|
367708
368036
|
changes,
|
|
367709
368037
|
ownerHandle: ownerHandleForPersist,
|
|
367710
|
-
appSlug: appSlugForPersist
|
|
368038
|
+
appSlug: appSlugForPersist,
|
|
368039
|
+
firstBuild
|
|
367711
368040
|
}), "validate");
|
|
367712
368041
|
let checked3 = await validate2();
|
|
367713
368042
|
if (checked3.isErr() && isSaveRepairRefusal(checked3.Err()) && saveRepairEnabled(vctx.sthis.env.get("SAVE_REPAIR"))) {
|
|
@@ -367912,7 +368241,8 @@ async function handlePromptContext({
|
|
|
367912
368241
|
chargedCredits: costCents * DISPLAY_CREDITS_PER_CENT,
|
|
367913
368242
|
lane: resChat.mode,
|
|
367914
368243
|
ownerHandle: resChat.ownerHandle,
|
|
367915
|
-
appSlug: resChat.appSlug
|
|
368244
|
+
appSlug: resChat.appSlug,
|
|
368245
|
+
ledger: creditMilestoneLedger(vctx.sql)
|
|
367916
368246
|
})
|
|
367917
368247
|
);
|
|
367918
368248
|
if (rMilestones.isErr()) {
|
|
@@ -369208,9 +369538,11 @@ __name(ignoreApplyError, "ignoreApplyError");
|
|
|
369208
369538
|
function autofixAndCheck(args3) {
|
|
369209
369539
|
const fixed = synthesizeImports({ vfs: args3.vfs, paths: args3.changed.filter((path3) => args3.vfs.has(path3)), look: args3.look });
|
|
369210
369540
|
const files = [...fixed.vfs].map(([filename, content]) => ({ type: "code-block", filename, lang: "jsx", content }));
|
|
369211
|
-
const
|
|
369212
|
-
|
|
369213
|
-
|
|
369541
|
+
const placeholder2 = args3.firstBuild === true ? placeholderEntryFinding(fixed.vfs) : void 0;
|
|
369542
|
+
const parse13 = [
|
|
369543
|
+
...saveRepairFindings(files, new Set(args3.changed)).map((finding) => `${finding.path.replace(/^\/+/, "")}: ${finding.message}`),
|
|
369544
|
+
...placeholder2 === void 0 ? [] : [placeholder2]
|
|
369545
|
+
];
|
|
369214
369546
|
const verdict = checkOpens(fixed.vfs);
|
|
369215
369547
|
const blocking = newOpensFindings(verdict, args3.baseline ?? /* @__PURE__ */ new Set());
|
|
369216
369548
|
const line3 = /* @__PURE__ */ __name((finding) => `${finding.file.replace(/^\/+/, "")}:${finding.line}: ${finding.message}`, "line");
|
|
@@ -369633,6 +369965,7 @@ async function runInstantCandidate(args3) {
|
|
|
369633
369965
|
let changed = /* @__PURE__ */ new Set();
|
|
369634
369966
|
let repairing = false;
|
|
369635
369967
|
const editBase = sourceFiles(args3.base);
|
|
369968
|
+
const firstBuild = hasEntryFile(editBase) === false;
|
|
369636
369969
|
let preRepair = editBase.size > 0 ? { files: editBase, lines: "shrink" } : void 0;
|
|
369637
369970
|
const repairNames = /* @__PURE__ */ new Set();
|
|
369638
369971
|
let overridable;
|
|
@@ -369762,7 +370095,7 @@ async function runInstantCandidate(args3) {
|
|
|
369762
370095
|
continue;
|
|
369763
370096
|
}
|
|
369764
370097
|
const nextChanged = /* @__PURE__ */ new Set([...changed, ...edit.changed]);
|
|
369765
|
-
const checked3 = autofixAndCheck({ vfs: edit.vfs, changed: [...nextChanged], look: args3.look, baseline });
|
|
370098
|
+
const checked3 = autofixAndCheck({ vfs: edit.vfs, changed: [...nextChanged], look: args3.look, baseline, firstBuild });
|
|
369766
370099
|
const gated2 = edit.applyErrors.length === 0 ? checked3 : { ...checked3, opens: false, findings: [...edit.applyErrors, ...checked3.findings] };
|
|
369767
370100
|
const gutted = preRepair === void 0 ? void 0 : repairIntactness(preRepair, gated2.vfs, repairNames);
|
|
369768
370101
|
if (gutted !== void 0) {
|
|
@@ -369832,7 +370165,7 @@ async function runInstantCandidate(args3) {
|
|
|
369832
370165
|
continue;
|
|
369833
370166
|
}
|
|
369834
370167
|
const nextChanged = /* @__PURE__ */ new Set([...changed, ...parsed3.Ok().changed]);
|
|
369835
|
-
const checked3 = autofixAndCheck({ vfs: parsed3.Ok().vfs, changed: [...nextChanged], look: args3.look, baseline });
|
|
370168
|
+
const checked3 = autofixAndCheck({ vfs: parsed3.Ok().vfs, changed: [...nextChanged], look: args3.look, baseline, firstBuild });
|
|
369836
370169
|
const gated2 = parsed3.Ok().applyErrors.length === 0 ? checked3 : { ...checked3, opens: false, findings: [...parsed3.Ok().applyErrors, ...checked3.findings] };
|
|
369837
370170
|
const applyErrors = parsed3.Ok().applyErrors.length;
|
|
369838
370171
|
if (gated2.opens) {
|
|
@@ -372335,13 +372668,16 @@ async function handleFSPrompt({
|
|
|
372335
372668
|
});
|
|
372336
372669
|
vctx.logger.Info().Any("event", { chatId: req2.chatId, promptId, paths: rebased }).Msg("agent-commit-rebased");
|
|
372337
372670
|
}
|
|
372338
|
-
const
|
|
372671
|
+
const baseVfs = new Map(refFS.filter(isVibeCodeBlock).map((file2) => [file2.filename, file2.content]));
|
|
372672
|
+
const candidate = new Map(baseVfs);
|
|
372339
372673
|
for (const change of changes) candidate.set(change.path, change.contents);
|
|
372340
372674
|
const checked3 = await validateAgentFiles(vctx, {
|
|
372341
372675
|
vfs: candidate,
|
|
372342
372676
|
changes,
|
|
372343
372677
|
ownerHandle: resChat.ownerHandle,
|
|
372344
|
-
appSlug: resChat.appSlug
|
|
372678
|
+
appSlug: resChat.appSlug,
|
|
372679
|
+
// A commit onto files with no entry file yet is the app's first build (#9565).
|
|
372680
|
+
firstBuild: hasEntryFile(baseVfs) === false
|
|
372345
372681
|
});
|
|
372346
372682
|
if (checked3.isErr()) return Result.Err(checked3.Err());
|
|
372347
372683
|
}
|
|
@@ -374586,6 +374922,15 @@ function mintDecisionWithDrops(input3, catalogs) {
|
|
|
374586
374922
|
}
|
|
374587
374923
|
__name(mintDecisionWithDrops, "mintDecisionWithDrops");
|
|
374588
374924
|
|
|
374925
|
+
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/maker-identity.ts
|
|
374926
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
374927
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
374928
|
+
init_performance2();
|
|
374929
|
+
function appUrl(handle, appSlug) {
|
|
374930
|
+
return `https://vibes.diy/vibe/${handle}/${appSlug}`;
|
|
374931
|
+
}
|
|
374932
|
+
__name(appUrl, "appUrl");
|
|
374933
|
+
|
|
374589
374934
|
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/agent-build-tools.ts
|
|
374590
374935
|
function refuse13(refusal5) {
|
|
374591
374936
|
return Result.Err(new AgentRefusalError(refusal5));
|
|
@@ -374760,6 +375105,8 @@ async function runCreateVibeTool(vctx, args3) {
|
|
|
374760
375105
|
chatId: minted.chatId,
|
|
374761
375106
|
ownerHandle: minted.ownerHandle,
|
|
374762
375107
|
appSlug: minted.appSlug,
|
|
375108
|
+
// #9563: the address the reply links, copied rather than composed.
|
|
375109
|
+
appUrl: appUrl(minted.ownerHandle, minted.appSlug),
|
|
374763
375110
|
...args3.toolsOffered === void 0 ? {} : { toolsOffered: [...args3.toolsOffered] },
|
|
374764
375111
|
// The catalog names this build was actually given — the VALIDATED list off
|
|
374765
375112
|
// the mint decision, never the model's raw ask, so a skill it named that
|
|
@@ -381906,7 +382253,7 @@ function createAgentVibeSettingsTools(vctx, args3) {
|
|
|
381906
382253
|
const userId = args3.actor.userId;
|
|
381907
382254
|
const failed3 = /* @__PURE__ */ __name((tool, message5) => args3.refused(tool, { ok: false, reason: "failed", message: message5 }), "failed");
|
|
381908
382255
|
const invalid2 = /* @__PURE__ */ __name((tool, message5) => args3.refused(tool, { ok: false, reason: "invalid-input", message: message5 }), "invalid");
|
|
381909
|
-
async function
|
|
382256
|
+
async function readSettings3(ownerHandle, appSlug) {
|
|
381910
382257
|
const r2 = await exception2Result(
|
|
381911
382258
|
() => ensureAppSettings(vctx, { type: "vibes.diy.req-ensure-app-settings", ownerHandle, appSlug }, userId)
|
|
381912
382259
|
);
|
|
@@ -381914,7 +382261,7 @@ function createAgentVibeSettingsTools(vctx, args3) {
|
|
|
381914
382261
|
const res = r2.Ok();
|
|
381915
382262
|
return res.error === void 0 ? res : void 0;
|
|
381916
382263
|
}
|
|
381917
|
-
__name(
|
|
382264
|
+
__name(readSettings3, "readSettings");
|
|
381918
382265
|
async function readLiveState(ownerHandle, appSlug) {
|
|
381919
382266
|
const asb = vctx.sql.tables.appSlugBinding;
|
|
381920
382267
|
const tApps = vctx.sql.tables.apps;
|
|
@@ -381928,7 +382275,7 @@ function createAgentVibeSettingsTools(vctx, args3) {
|
|
|
381928
382275
|
}
|
|
381929
382276
|
__name(readLiveState, "readLiveState");
|
|
381930
382277
|
async function answer12(ownerHandle, appSlug, extra = {}) {
|
|
381931
|
-
const settings = await
|
|
382278
|
+
const settings = await readSettings3(ownerHandle, appSlug);
|
|
381932
382279
|
if (settings === void 0) return failed3(VIBE_SETTINGS_TOOL_NAME, "Could not read that vibe's settings just now.");
|
|
381933
382280
|
const live = await readLiveState(ownerHandle, appSlug);
|
|
381934
382281
|
return Result.Ok(
|
|
@@ -385131,7 +385478,8 @@ async function handleProdiaImageRequest({
|
|
|
385131
385478
|
chargedCredits: imageCostCents * DISPLAY_CREDITS_PER_CENT,
|
|
385132
385479
|
lane: "image",
|
|
385133
385480
|
ownerHandle: resChat.ownerHandle,
|
|
385134
|
-
appSlug: resChat.appSlug
|
|
385481
|
+
appSlug: resChat.appSlug,
|
|
385482
|
+
ledger: creditMilestoneLedger(vctx.sql)
|
|
385135
385483
|
})
|
|
385136
385484
|
);
|
|
385137
385485
|
if (rMilestones.isErr()) vctx.logger.Warn().Err(rMilestones).Str("promptId", promptId).Msg("credit-milestones-threw");
|
|
@@ -389219,6 +389567,30 @@ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
|
389219
389567
|
init_performance2();
|
|
389220
389568
|
init_esm();
|
|
389221
389569
|
|
|
389570
|
+
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/settle-time-turn-state.ts
|
|
389571
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
389572
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
389573
|
+
init_performance2();
|
|
389574
|
+
init_esm();
|
|
389575
|
+
async function settleTimeTurnState(vctx, args3) {
|
|
389576
|
+
const rRow = await exception2Result(() => {
|
|
389577
|
+
const cc = vctx.sql.tables.chatContexts;
|
|
389578
|
+
return vctx.sql.db.select({ ownerHandle: cc.ownerHandle, appSlug: cc.appSlug, userId: cc.userId }).from(cc).where(eq(cc.chatId, args3.chatId)).limit(1).then((r2) => r2[0]);
|
|
389579
|
+
});
|
|
389580
|
+
if (rRow.isErr()) vctx.logger.Warn().Err(rRow).Str("chatId", args3.chatId).Msg("settle-address-read-failed");
|
|
389581
|
+
const row = rRow.isOk() ? rRow.Ok() : void 0;
|
|
389582
|
+
const address2 = row !== void 0 && row.userId === args3.userId ? row : args3.resChat;
|
|
389583
|
+
let credits = args3.credits;
|
|
389584
|
+
if (credits !== void 0 && credits.checkedUserId !== void 0 && credits.checkedUserId !== args3.userId) {
|
|
389585
|
+
const rCheck = await exception2Result(() => vctx.billing.checkCredits({ userId: args3.userId }));
|
|
389586
|
+
const fresh = rCheck.isOk() ? rCheck.Ok() : void 0;
|
|
389587
|
+
if (rCheck.isErr()) vctx.logger.Warn().Err(rCheck).Str("chatId", args3.chatId).Msg("settle-credit-read-failed");
|
|
389588
|
+
credits = fresh === void 0 ? void 0 : { ...fresh, checkedUserId: args3.userId };
|
|
389589
|
+
}
|
|
389590
|
+
return { ownerHandle: address2.ownerHandle, appSlug: address2.appSlug, ...credits === void 0 ? {} : { credits } };
|
|
389591
|
+
}
|
|
389592
|
+
__name(settleTimeTurnState, "settleTimeTurnState");
|
|
389593
|
+
|
|
389222
389594
|
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/design-repair.ts
|
|
389223
389595
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
389224
389596
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
@@ -390272,13 +390644,20 @@ async function settlePromptTurn(args3) {
|
|
|
390272
390644
|
const msToFirstToken = msSinceOrigin(turnOrigin, turnLatency.firstTokenAt);
|
|
390273
390645
|
const msToFirstEvidence = msSinceOrigin(turnOrigin, turnLatency.firstEvidenceLineAt);
|
|
390274
390646
|
const msTailAfterBuildValue = agentAssembled === void 0 ? void 0 : msTailAfterBuild(turnLatency);
|
|
390275
|
-
const
|
|
390276
|
-
|
|
390647
|
+
const settleState = await settleTimeTurnState(vctx, {
|
|
390648
|
+
chatId: req2.chatId,
|
|
390649
|
+
userId: req2._auth.verifiedAuth.claims.userId,
|
|
390650
|
+
resChat,
|
|
390651
|
+
credits: facts.credits
|
|
390652
|
+
});
|
|
390653
|
+
const settleCredits = settleState.credits;
|
|
390654
|
+
const usedCycle = creditsUsedCycle(settleCredits);
|
|
390655
|
+
const cycleResetsAt = cycleResetsAtIso(settleCredits);
|
|
390277
390656
|
settledArgs = {
|
|
390278
390657
|
outcome: facts.errored ? "error" : terminal.settled?.applied === true ? "applied" : "no-code",
|
|
390279
390658
|
userId: req2._auth.verifiedAuth.claims.userId,
|
|
390280
|
-
ownerHandle:
|
|
390281
|
-
appSlug:
|
|
390659
|
+
ownerHandle: settleState.ownerHandle,
|
|
390660
|
+
appSlug: settleState.appSlug,
|
|
390282
390661
|
reach: projectTurnReach(terminal.settled, terminal.touchedPaths),
|
|
390283
390662
|
// #5313: WHICH turn this reach belongs to. The agent lane
|
|
390284
390663
|
// splits one user message into a conversation turn and the
|
|
@@ -390316,9 +390695,10 @@ async function settlePromptTurn(args3) {
|
|
|
390316
390695
|
// against attachments and chat length. Only a builder-assembled turn has it.
|
|
390317
390696
|
...preAssembled === void 0 ? {} : { builderModel: preAssembled.model },
|
|
390318
390697
|
...preAssembled?.historyShape === void 0 ? {} : { historyShape: preAssembled.historyShape },
|
|
390319
|
-
// …and the plan and balance the turn's own credit gate already read
|
|
390320
|
-
|
|
390321
|
-
...
|
|
390698
|
+
// …and the plan and balance the turn's own credit gate already read, or the
|
|
390699
|
+
// settling account's own when a sign-in moved the turn (settleTimeTurnState).
|
|
390700
|
+
...settleCredits?.plan === void 0 ? {} : { plan: settleCredits.plan },
|
|
390701
|
+
...settleCredits?.remainingCredits === void 0 ? {} : { creditsRemaining: settleCredits.remainingCredits },
|
|
390322
390702
|
// …and where in the cycle that balance sits (granted − remaining), same read.
|
|
390323
390703
|
...usedCycle === void 0 ? {} : { creditsUsedCycle: usedCycle },
|
|
390324
390704
|
...cycleResetsAt === void 0 ? {} : { cycleResetsAt },
|
|
@@ -390507,7 +390887,7 @@ async function settlePromptTurn(args3) {
|
|
|
390507
390887
|
...terminal.noCodeCause === void 0 || facts.errored || terminal.settled?.applied === true ? {} : { noCodeCause: terminal.noCodeCause },
|
|
390508
390888
|
// Owner directive 2026-10-05: the chat's first build does not send the
|
|
390509
390889
|
// agent to wait for its picture. The same fact the settled event records.
|
|
390510
|
-
...preAssembled?.isInitialTurn === true ? { firstBuild: true } : {}
|
|
390890
|
+
...preAssembled?.isInitialTurn === true ? { firstBuild: true, appUrl: appUrl(resChat.ownerHandle, resChat.appSlug) } : {}
|
|
390511
390891
|
};
|
|
390512
390892
|
if (args3.envelope.rewriteNature !== void 0 && agentAssembled === void 0 && canonicalModelUsage(req2.mode) === "codegen") {
|
|
390513
390893
|
await settleNatureRewrite(vctx, {
|
|
@@ -394253,7 +394633,8 @@ var SERVER_ONLY_SETTINGS = /* @__PURE__ */ new Set([
|
|
|
394253
394633
|
"groupChats",
|
|
394254
394634
|
"groupRoster",
|
|
394255
394635
|
"termsAck",
|
|
394256
|
-
"appHistoryHidden"
|
|
394636
|
+
"appHistoryHidden",
|
|
394637
|
+
"creditMilestones"
|
|
394257
394638
|
]);
|
|
394258
394639
|
function isWireVisible(t3) {
|
|
394259
394640
|
return !SERVER_ONLY_SETTINGS.has(t3);
|
|
@@ -397642,8 +398023,8 @@ var setAudienceArmEvento = {
|
|
|
397642
398023
|
return Result.Ok(EventoResult.Continue);
|
|
397643
398024
|
}
|
|
397644
398025
|
const actingHandle = subject.handle;
|
|
397645
|
-
const
|
|
397646
|
-
if (
|
|
398026
|
+
const normalized3 = req2.state === null ? null : normalizeArmState(req2.state);
|
|
398027
|
+
if (normalized3 === "public" && await getSubjectPrivacySensitive(vctx, {
|
|
397647
398028
|
subjectHandle: actingHandle,
|
|
397648
398029
|
ownerHandle: req2.ownerHandle,
|
|
397649
398030
|
appSlug: req2.appSlug
|
|
@@ -397664,8 +398045,8 @@ var setAudienceArmEvento = {
|
|
|
397664
398045
|
appSlug: req2.appSlug,
|
|
397665
398046
|
// Legacy-vocab echo for the pre-B1 skew window (#4036); B1 reads
|
|
397666
398047
|
// `visibility` (the NORMALIZED canonical stored visibility).
|
|
397667
|
-
state: armStateToLegacyWire(
|
|
397668
|
-
visibility:
|
|
398048
|
+
state: armStateToLegacyWire(normalized3),
|
|
398049
|
+
visibility: normalized3
|
|
397669
398050
|
});
|
|
397670
398051
|
return Result.Ok(EventoResult.Continue);
|
|
397671
398052
|
}
|
|
@@ -402391,13 +402772,6 @@ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
|
402391
402772
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
402392
402773
|
init_performance2();
|
|
402393
402774
|
init_esm();
|
|
402394
|
-
|
|
402395
|
-
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/maker-identity.ts
|
|
402396
|
-
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
402397
|
-
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
402398
|
-
init_performance2();
|
|
402399
|
-
|
|
402400
|
-
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/hubspot-signup.ts
|
|
402401
402775
|
function rosterOf(existing) {
|
|
402402
402776
|
const raw = existing?.clerk_user_ids_all;
|
|
402403
402777
|
if (typeof raw !== "string") return [];
|