Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- api/automation_engine.py +54 -2
- web/src/automation/AutomationBuilder.tsx +0 -0
- web/src/customer-grid/ColumnMenu.tsx +0 -0
- web/src/customer-grid/CustomerGrid.tsx +0 -0
- web/src/customer-grid/apiBridge.ts +41 -0
RELEASES.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": [
|
| 4 |
{
|
| 5 |
"version": "v14",
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "caee549",
|
| 3 |
"releases": [
|
| 4 |
{
|
| 5 |
"version": "v14",
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
caee549
|
api/automation_engine.py
CHANGED
|
@@ -1404,6 +1404,42 @@ def clean_definition(raw, previous=None, username=""):
|
|
| 1404 |
# whose kind says something else is not a preference to respect, it is two halves of one
|
| 1405 |
# answer disagreeing, and the trigger is the half the person actually picked.
|
| 1406 |
kind = "discover_instagram"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1407 |
if kind not in KINDS:
|
| 1408 |
return None, f"unknown automation kind {kind!r}"
|
| 1409 |
name = " ".join(_s(raw.get("name") or prev.get("name") or "", MAX_NAME).split())
|
|
@@ -3173,15 +3209,31 @@ def _merge_candidates(rows):
|
|
| 3173 |
board cards; minting a new one would orphan all of them, so a merge picks a survivor rather
|
| 3174 |
than creating one.
|
| 3175 |
"""
|
| 3176 |
-
groups = {}
|
| 3177 |
for rid in sorted(rows, key=lambda r: (len(str(r)), str(r))):
|
| 3178 |
r = rows[rid]
|
| 3179 |
h = str(r.get("handle") or "").strip()
|
| 3180 |
if not h:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3181 |
continue
|
| 3182 |
groups.setdefault((str(r.get("platform") or PLATFORM_INSTAGRAM).strip(), h),
|
| 3183 |
[]).append((rid, r))
|
| 3184 |
-
out, merged =
|
| 3185 |
for _key, members in groups.items():
|
| 3186 |
if len(members) == 1:
|
| 3187 |
out[members[0][0]] = members[0][1]
|
|
|
|
| 1404 |
# whose kind says something else is not a preference to respect, it is two halves of one
|
| 1405 |
# answer disagreeing, and the trigger is the half the person actually picked.
|
| 1406 |
kind = "discover_instagram"
|
| 1407 |
+
elif (kind == "discover_instagram"
|
| 1408 |
+
and ((prev.get("trigger") or {}) or {}).get("key") == "ig_profile_match"
|
| 1409 |
+
and (trigger or {}).get("key") != "ig_profile_match"):
|
| 1410 |
+
# ββ 2026-08-07 (owner report) β LAW 1 HAS AN INVERSE, AND ITS ABSENCE WAS A MONEY BUG.
|
| 1411 |
+
#
|
| 1412 |
+
# Law 1 above flips the kind TO `discover_instagram` when the trigger says Instagram
|
| 1413 |
+
# discovery. Nothing flipped it BACK. So `kind` was inherited from `prev` forever: switch
|
| 1414 |
+
# the trigger to Manual and the automation stayed `discover_instagram`, which means
|
| 1415 |
+
#
|
| 1416 |
+
# Β· `RUNNERS[kind]` is still `run_discover_instagram`, so pressing **Run now** on a flow
|
| 1417 |
+
# the person had just made MANUAL fired a PAID Bright Data corpus search;
|
| 1418 |
+
# Β· `ig_action_pinned` keys on the kind, so the seeded "Create record" stayed
|
| 1419 |
+
# UNDELETABLE β the owner's report, verbatim: *"When a trigger change from the
|
| 1420 |
+
# instagram trigger, the 'always first' create record just stuck there"*. The server
|
| 1421 |
+
# would have accepted the delete; the CLIENT hid the control, because both halves ask
|
| 1422 |
+
# the kind and the kind was lying.
|
| 1423 |
+
#
|
| 1424 |
+
# β THE TEST IS THAT THE TRIGGER **MOVED**, and the first version of this got it wrong in
|
| 1425 |
+
# a way worth recording. It asked `"trigger" in raw` β but `patch()` builds its raw as
|
| 1426 |
+
# `merged = dict(prev)` plus the caller's keys, so **`"trigger"` is present on EVERY
|
| 1427 |
+
# patch**, and an empty `patch(rt, id, {})` flipped a discovery automation to `plain`.
|
| 1428 |
+
# That turned five `section_bd` checks red and crashed the suite on a `StopIteration`
|
| 1429 |
+
# three sections later. Comparing the RESOLVED key against the PREVIOUS one is the honest
|
| 1430 |
+
# question: did this automation stop being an Instagram search?
|
| 1431 |
+
#
|
| 1432 |
+
# β NARROW ON PURPOSE, twice over. It fires only when the automation WAS on the Instagram
|
| 1433 |
+
# trigger β a `discover_instagram` created with an explicit kind and some other trigger is
|
| 1434 |
+
# somebody's deliberate state, not a mistake to correct. And only FROM
|
| 1435 |
+
# `discover_instagram`: `scrape_db` and `field_instagram` are surviving kinds whose
|
| 1436 |
+
# triggers are their own business, and clobbering them would retire them by accident.
|
| 1437 |
+
#
|
| 1438 |
+
# β IT DOES NOT DELETE THE SEEDED ACTIONS. They stop being pinned, so one click removes
|
| 1439 |
+
# them β but a `create_record` the person has since re-pointed at their own table with
|
| 1440 |
+
# their own values is THEIR action now, and quietly destroying it because a trigger moved
|
| 1441 |
+
# is the silent data loss this module refuses everywhere else.
|
| 1442 |
+
kind = DEFAULT_KIND
|
| 1443 |
if kind not in KINDS:
|
| 1444 |
return None, f"unknown automation kind {kind!r}"
|
| 1445 |
name = " ".join(_s(raw.get("name") or prev.get("name") or "", MAX_NAME).split())
|
|
|
|
| 3209 |
board cards; minting a new one would orphan all of them, so a merge picks a survivor rather
|
| 3210 |
than creating one.
|
| 3211 |
"""
|
| 3212 |
+
groups, keepers = {}, {}
|
| 3213 |
for rid in sorted(rows, key=lambda r: (len(str(r)), str(r))):
|
| 3214 |
r = rows[rid]
|
| 3215 |
h = str(r.get("handle") or "").strip()
|
| 3216 |
if not h:
|
| 3217 |
+
# ββ THESE USED TO BE `continue`d, AND THE OUTPUT REPLACES THE TABLE'S ROWS β so a
|
| 3218 |
+
# row with no handle was SILENTLY DELETED. Owner, 2026-08-07: *"How come when I add a
|
| 3219 |
+
# manual handle in my 'Beauty influencer leads' database, after an automation run, it
|
| 3220 |
+
# gets deleted?"*
|
| 3221 |
+
#
|
| 3222 |
+
# A row you add by hand is born blank and stays blank until you type into it, so the
|
| 3223 |
+
# window is not narrow β it is every row, from creation until the cell is committed.
|
| 3224 |
+
# And before the profile flag shipped (834decd) a typed handle landed in the TYPIST'S
|
| 3225 |
+
# OVERLAY stratum, leaving the definition row's `handle` empty forever: the row was
|
| 3226 |
+
# dropped even after it looked filled in on screen.
|
| 3227 |
+
#
|
| 3228 |
+
# β THE FUNCTION'S JOB IS TO MERGE DUPLICATE CANDIDATES, and a row with no handle is
|
| 3229 |
+
# not a candidate β it is somebody's row. It cannot collide with anything (there is
|
| 3230 |
+
# nothing to key it on), so it is carried through UNTOUCHED rather than judged. A
|
| 3231 |
+
# merge pass that deletes what it cannot classify is not a merge, it is a filter.
|
| 3232 |
+
keepers[rid] = r
|
| 3233 |
continue
|
| 3234 |
groups.setdefault((str(r.get("platform") or PLATFORM_INSTAGRAM).strip(), h),
|
| 3235 |
[]).append((rid, r))
|
| 3236 |
+
out, merged = dict(keepers), 0
|
| 3237 |
for _key, members in groups.items():
|
| 3238 |
if len(members) == 1:
|
| 3239 |
out[members[0][0]] = members[0][1]
|
web/src/automation/AutomationBuilder.tsx
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
web/src/customer-grid/ColumnMenu.tsx
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
web/src/customer-grid/CustomerGrid.tsx
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
web/src/customer-grid/apiBridge.ts
CHANGED
|
@@ -353,6 +353,47 @@ export async function addTableRow(
|
|
| 353 |
* re-types on the way in, so the caller inserts what came BACK β a column ordered under a
|
| 354 |
* key the store does not hold is a column that renders nowhere.
|
| 355 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 356 |
export async function addTableField(
|
| 357 |
tableKey: string,
|
| 358 |
field: { key: string; label: string; type: string }
|
|
|
|
| 353 |
* re-types on the way in, so the caller inserts what came BACK β a column ordered under a
|
| 354 |
* key the store does not hold is a column that renders nowhere.
|
| 355 |
*/
|
| 356 |
+
/**
|
| 357 |
+
* ββ 2026-08-07 (D-79's last half) β PATCH one column's DEFINITION on a user table.
|
| 358 |
+
*
|
| 359 |
+
* β WHY IT EXISTS: wave 25 shipped the profile flag's READER everywhere β the column-menu line,
|
| 360 |
+
* the cell validator, R6's clear-on-write, the one-per-table refusal β and never its WRITER. The
|
| 361 |
+
* route (`PATCH /tables/{key}/fields/{fkey}`) has accepted `profile` since that wave with no
|
| 362 |
+
* client caller, so the enrich action could not be bound to any database a person made
|
| 363 |
+
* themselves. This is that caller.
|
| 364 |
+
*
|
| 365 |
+
* β THE SERVER'S FIELD IS THE ANSWER, never the request β the same rule `addTableField` carries.
|
| 366 |
+
* `_clean_field` enforces `type: 'text'` for a profile flag and refuses a SECOND one with a
|
| 367 |
+
* sentence naming the column that already has it, so the refusal is worth surfacing verbatim.
|
| 368 |
+
*/
|
| 369 |
+
export async function patchTableField(
|
| 370 |
+
tableKey: string,
|
| 371 |
+
fieldKey: string,
|
| 372 |
+
patch: Record<string, unknown>
|
| 373 |
+
): Promise<Field | null> {
|
| 374 |
+
try {
|
| 375 |
+
const res = await fetch(
|
| 376 |
+
`${API_V1}/tables/${encodeURIComponent(tableKey)}/fields/${encodeURIComponent(fieldKey)}`,
|
| 377 |
+
{ method: "PATCH", credentials: CREDENTIALS, headers: JSON_HEADERS,
|
| 378 |
+
body: JSON.stringify(patch) }
|
| 379 |
+
);
|
| 380 |
+
if (handledUnauthorized(res.status)) return null;
|
| 381 |
+
const body = (await readJson(res)) as
|
| 382 |
+
| { field?: Field; detail?: { message?: string } }
|
| 383 |
+
| null;
|
| 384 |
+
if (!res.ok) {
|
| 385 |
+
signal(TOAST_EVENT, typeof body?.detail?.message === "string"
|
| 386 |
+
? body.detail.message
|
| 387 |
+
: `The server answered ${res.status}.`);
|
| 388 |
+
return null;
|
| 389 |
+
}
|
| 390 |
+
return body?.field ?? null;
|
| 391 |
+
} catch {
|
| 392 |
+
signal(TOAST_EVENT, "That change did not reach the server.");
|
| 393 |
+
return null;
|
| 394 |
+
}
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
export async function addTableField(
|
| 398 |
tableKey: string,
|
| 399 |
field: { key: string; label: string; type: string }
|