[{"data":1,"prerenderedAt":4609,"buildId":4610},["ShallowReactive",2],{"doc:\u002Fdata\u002Fdata-model":3,"docs-nav":4406,"surround:\u002Fdata\u002Fdata-model":4604},{"id":4,"title":5,"body":6,"description":4399,"extension":4400,"meta":4401,"navigation":1214,"path":4402,"seo":4403,"stem":4404,"__hash__":4405},"docs\u002Fdata\u002Fdata-model.md","Data Model",{"type":7,"value":8,"toc":4369},"minimark",[9,54,57,62,163,175,177,181,186,247,257,266,270,276,337,343,347,805,812,816,826,995,998,1002,1068,1080,1084,1094,1100,1119,1123,1158,1160,1164,1493,1506,1508,1512,1516,1644,1654,1658,1863,1883,1887,2112,2129,2133,2437,2441,2750,2767,2771,2857,2873,2891,2895,3237,3241,3526,3535,3539,3769,3781,3785,3817,3823,3825,3829,3968,3971,3973,3977,3983,3986,4004,4006,4010,4195,4197,4201,4254,4256,4260,4347,4350,4356,4365],[10,11,12,20,26,37],"ul",{},[13,14,15,19],"li",{},[16,17,18],"strong",{},"Status:"," Frozen (desain), implementasi dimulai dari sini",[13,21,22,25],{},[16,23,24],{},"Storage:"," DO SQLite per cell; Postgres (control plane); R2 (objek); WORM ledger",[13,27,28,31,32,36],{},[16,29,30],{},"ORM:"," Drizzle (",[33,34,35],"code",{},"drizzle-orm\u002Fdurable-sqlite",")",[13,38,39,42,43,46,47,46,50,53],{},[16,40,41],{},"Terkait:"," ",[33,44,45],{},"ARCHITECTURE.md",", ",[33,48,49],{},"03-api\u002FINVENTORY.md",[33,51,52],{},"04-data\u002FIDEMPOTENCY.md",", ADR-0014",[55,56],"hr",{},[58,59,61],"h2",{"id":60},"_1-pembagian-data","1. Pembagian data",[63,64,65,81],"table",{},[66,67,68],"thead",{},[69,70,71,75,78],"tr",{},[72,73,74],"th",{},"Store",[72,76,77],{},"Isi",[72,79,80],{},"Tidak boleh",[82,83,84,98,111,124,137,150],"tbody",{},[69,85,86,92,95],{},[87,88,89],"td",{},[16,90,91],{},"Control plane (Postgres)",[87,93,94],{},"akun, membership, project registry, API key hash\u002Fmetadata, plan, entitlement, invoice ref",[87,96,97],{},"Data keputusan, isi dataset",[69,99,100,105,108],{},[87,101,102],{},[16,103,104],{},"Project cell (SQLite)",[87,106,107],{},"Semua state project: agent, session, decision, dataset metadata, action, approval, planning",[87,109,110],{},"Data lintas project",[69,112,113,118,121],{},[87,114,115],{},[16,116,117],{},"Feed cell (SQLite)",[87,119,120],{},"Signal append-only per topik",[87,122,123],{},"Data project",[69,125,126,131,134],{},[87,127,128],{},[16,129,130],{},"Object storage (R2)",[87,132,133],{},"File dataset mentah, embedding, dokumen, render, audit ledger",[87,135,136],{},"State transaksional",[69,138,139,144,147],{},[87,140,141],{},[16,142,143],{},"Analytics (Neon PG + pgvector)",[87,145,146],{},"Snapshot agregat, embedding untuk ANN",[87,148,149],{},"Sumber kebenaran",[69,151,152,157,160],{},[87,153,154],{},[16,155,156],{},"Audit ledger (R2 Object Lock)",[87,158,159],{},"Entry WORM + hash chain",[87,161,162],{},"Data yang bisa diedit",[164,165,166,167,170,171,174],"p",{},"Aturan: ",[16,168,169],{},"tidak ada foreign key lintas store."," Referensi lintas store memakai ",[33,172,173],{},"public_id",".",[55,176],{},[58,178,180],{"id":179},"_2-strategi-id-dual-id","2. Strategi ID (dual ID)",[182,183,185],"h3",{"id":184},"_21-dua-id-dua-peran","2.1 Dua ID, dua peran",[63,187,188,204],{},[66,189,190],{},[69,191,192,195,198,201],{},[72,193,194],{},"Kolom",[72,196,197],{},"Tipe",[72,199,200],{},"Peran",[72,202,203],{},"Boleh keluar cell?",[82,205,206,230],{},[69,207,208,213,222,225],{},[87,209,210],{},[33,211,212],{},"id",[87,214,215,218,219],{},[33,216,217],{},"INTEGER"," \u002F ",[33,220,221],{},"BIGSERIAL",[87,223,224],{},"Primary key internal, join, FK, urutan",[87,226,227],{},[16,228,229],{},"Tidak pernah",[69,231,232,236,241,244],{},[87,233,234],{},[33,235,173],{},[87,237,238],{},[33,239,240],{},"TEXT",[87,242,243],{},"Identitas eksternal: API, webhook, audit, object key, log",[87,245,246],{},"Ya",[248,249,254],"pre",{"className":250,"code":252,"language":253},[251],"language-text","API request path   → public_id\nResponse `id`      → public_id\nWebhook payload    → public_id\nAudit subject_id   → public_id\nObject key         → public_id\nJoin \u002F FK          → id (integer)\nCursor             → (created_at, id) di-sign\n","text",[33,255,252],{"__ignoreMap":256},"",[164,258,259,262,263,265],{},[16,260,261],{},"Aturan keras:"," internal ",[33,264,212],{}," tidak boleh muncul di response, error, log, webhook, audit,\nobject key, atau prompt model. Test serialisasi harus menolak field internal.",[182,267,269],{"id":268},"_22-bentuk-public_id","2.2 Bentuk public_id",[248,271,274],{"className":272,"code":273,"language":253},[251],"\u003Cprefix>_\u003Cnanoid>\n",[33,275,273],{"__ignoreMap":256},[10,277,278,284,313,320,327,334],{},[13,279,280,283],{},[33,281,282],{},"prefix",": 2–5 huruf kecil, dari registry tetap (lihat §2.3).",[13,285,286,289,290,293,294,46,297,46,300,46,303,46,306,46,309,312],{},[33,287,288],{},"nanoid",": 21 karakter, alphabet base32 Crockford lowercase\n",[33,291,292],{},"0123456789abcdefghjkmnpqrstvwxyz"," (tanpa ",[33,295,296],{},"i",[33,298,299],{},"l",[33,301,302],{},"o",[33,304,305],{},"u",[33,307,308],{},"_",[33,310,311],{},"-",").",[13,314,315,316,319],{},"Entropi: 21 × 5 bit = ",[16,317,318],{},"105 bit","; collision negligible.",[13,321,322,323,326],{},"CSPRNG: ",[33,324,325],{},"crypto.getRandomValues"," (tersedia di Workers).",[13,328,329,330,333],{},"Case-sensitive? ",[16,331,332],{},"Canonical lowercase."," Tolak input yang tidak cocok regex; jangan\ndiam-diam mengubah case.",[13,335,336],{},"Prefix tidak menambah entropi. Jangan memperpendek Nanoid karena ada prefix.",[164,338,339,340,174],{},"Contoh: ",[33,341,342],{},"dec_7f3a9c2e1b4d6f8a5c0ef",[182,344,346],{"id":345},"_23-prefix-registry","2.3 Prefix registry",[63,348,349,362],{},[66,350,351],{},[69,352,353,356,359],{},[72,354,355],{},"Entitas",[72,357,358],{},"Prefix",[72,360,361],{},"Catatan",[82,363,364,377,389,402,414,434,446,459,471,483,495,507,519,531,543,555,567,579,591,603,620,632,644,656,668,680,692,704,716,728,740,752,765,782,793],{},[69,365,366,369,374],{},[87,367,368],{},"Organization",[87,370,371],{},[33,372,373],{},"org_",[87,375,376],{},"control plane",[69,378,379,382,387],{},[87,380,381],{},"User",[87,383,384],{},[33,385,386],{},"usr_",[87,388,376],{},[69,390,391,394,399],{},[87,392,393],{},"Project",[87,395,396],{},[33,397,398],{},"proj_",[87,400,401],{},"control plane; tidak muncul di API mesin",[69,403,404,407,412],{},[87,405,406],{},"API key",[87,408,409],{},[33,410,411],{},"key_",[87,413,376],{},[69,415,416,421,426],{},[87,417,418],{},[16,419,420],{},"Agent",[87,422,423],{},[16,424,425],{},"tanpa prefix",[87,427,428,430,431,36],{},[33,429,173],{}," = slug (",[33,432,433],{},"default.agent",[69,435,436,439,444],{},[87,437,438],{},"Session",[87,440,441],{},[33,442,443],{},"ses_",[87,445],{},[69,447,448,451,456],{},[87,449,450],{},"Entry",[87,452,453],{},[33,454,455],{},"ent_",[87,457,458],{},"transcript\u002Ffork",[69,460,461,464,469],{},[87,462,463],{},"Submission",[87,465,466],{},[33,467,468],{},"sub_",[87,470],{},[69,472,473,476,481],{},[87,474,475],{},"Decision",[87,477,478],{},[33,479,480],{},"dec_",[87,482],{},[69,484,485,488,493],{},[87,486,487],{},"Feedback",[87,489,490],{},[33,491,492],{},"fbk_",[87,494],{},[69,496,497,500,505],{},[87,498,499],{},"Dataset",[87,501,502],{},[33,503,504],{},"ds_",[87,506],{},[69,508,509,512,517],{},[87,510,511],{},"Onboarding source",[87,513,514],{},[33,515,516],{},"src_",[87,518],{},[69,520,521,524,529],{},[87,522,523],{},"Sync",[87,525,526],{},[33,527,528],{},"syn_",[87,530],{},[69,532,533,536,541],{},[87,534,535],{},"Quarantine batch",[87,537,538],{},[33,539,540],{},"qb_",[87,542],{},[69,544,545,548,553],{},[87,546,547],{},"Connector",[87,549,550],{},[33,551,552],{},"cn_",[87,554],{},[69,556,557,560,565],{},[87,558,559],{},"Action",[87,561,562],{},[33,563,564],{},"act_",[87,566],{},[69,568,569,572,577],{},[87,570,571],{},"Action invocation",[87,573,574],{},[33,575,576],{},"inv_",[87,578],{},[69,580,581,584,589],{},[87,582,583],{},"Credential",[87,585,586],{},[33,587,588],{},"crd_",[87,590],{},[69,592,593,596,601],{},[87,594,595],{},"Approval",[87,597,598],{},[33,599,600],{},"apr_",[87,602],{},[69,604,605,608,613],{},[87,606,607],{},"Projection",[87,609,610],{},[33,611,612],{},"prjn_",[87,614,615,616,619],{},"bukan ",[33,617,618],{},"prj_"," agar tidak bentrok dengan project",[69,621,622,625,630],{},[87,623,624],{},"Scenario",[87,626,627],{},[33,628,629],{},"scn_",[87,631],{},[69,633,634,637,642],{},[87,635,636],{},"Deviation",[87,638,639],{},[33,640,641],{},"dev_",[87,643],{},[69,645,646,649,654],{},[87,647,648],{},"Document",[87,650,651],{},[33,652,653],{},"doc_",[87,655],{},[69,657,658,661,666],{},[87,659,660],{},"Correction",[87,662,663],{},[33,664,665],{},"cor_",[87,667],{},[69,669,670,673,678],{},[87,671,672],{},"Eval",[87,674,675],{},[33,676,677],{},"evl_",[87,679],{},[69,681,682,685,690],{},[87,683,684],{},"Job",[87,686,687],{},[33,688,689],{},"job_",[87,691],{},[69,693,694,697,702],{},[87,695,696],{},"Audit entry",[87,698,699],{},[33,700,701],{},"aud_",[87,703],{},[69,705,706,709,714],{},[87,707,708],{},"Signal",[87,710,711],{},[33,712,713],{},"sig_",[87,715],{},[69,717,718,721,726],{},[87,719,720],{},"World subscription",[87,722,723],{},[33,724,725],{},"wsub_",[87,727],{},[69,729,730,733,738],{},[87,731,732],{},"Webhook endpoint",[87,734,735],{},[33,736,737],{},"whk_",[87,739],{},[69,741,742,745,750],{},[87,743,744],{},"Webhook delivery",[87,746,747],{},[33,748,749],{},"whd_",[87,751],{},[69,753,754,757,762],{},[87,755,756],{},"Trace",[87,758,759],{},[33,760,761],{},"tr_",[87,763,764],{},"korelasi, bukan tabel",[69,766,767,770,779],{},[87,768,769],{},"Assumption",[87,771,772,775,776],{},[33,773,774],{},"driver_id"," + ",[33,777,778],{},"version",[87,780,781],{},"natural key",[69,783,784,787,791],{},[87,785,786],{},"Data contract",[87,788,789],{},[33,790,778],{},[87,792,781],{},[69,794,795,798,803],{},[87,796,797],{},"Period",[87,799,800],{},[33,801,802],{},"YYYY-MM",[87,804,781],{},[164,806,807,808,811],{},"Registry disimpan di ",[33,809,810],{},"packages\u002Fcontracts\u002Fids.ts","; validator & parser digenerate dari sana.\nCI gagal jika ada prefix di luar registry.",[182,813,815],{"id":814},"_24-pengecualian-natural-key","2.4 Pengecualian (natural key)",[164,817,818,819,822,823,825],{},"Tabel berikut ",[16,820,821],{},"tidak"," memakai ",[33,824,173],{}," Nanoid karena alamatnya natural:",[63,827,828,841],{},[66,829,830],{},[69,831,832,835,838],{},[72,833,834],{},"Tabel",[72,836,837],{},"Primary key",[72,839,840],{},"Alasan",[82,842,843,858,873,891,906,921,935,950,965,980],{},[69,844,845,850,855],{},[87,846,847],{},[33,848,849],{},"agent_contracts",[87,851,852],{},[33,853,854],{},"(agent_id, version)",[87,856,857],{},"versi kontrak",[69,859,860,865,870],{},[87,861,862],{},[33,863,864],{},"assumptions",[87,866,867],{},[33,868,869],{},"(driver_id, version)",[87,871,872],{},"driver + versi",[69,874,875,880,888],{},[87,876,877],{},[33,878,879],{},"data_contracts",[87,881,882,775,885,887],{},[33,883,884],{},"(id)",[33,886,778],{}," unik",[87,889,890],{},"versi",[69,892,893,898,903],{},[87,894,895],{},[33,896,897],{},"usage_counters",[87,899,900],{},[33,901,902],{},"(period, agent_id, model)",[87,904,905],{},"counter",[69,907,908,913,918],{},[87,909,910],{},[33,911,912],{},"project_settings",[87,914,915],{},[33,916,917],{},"key",[87,919,920],{},"konfigurasi",[69,922,923,928,932],{},[87,924,925],{},[33,926,927],{},"idempotency_keys",[87,929,930],{},[33,931,917],{},[87,933,934],{},"idempotency",[69,936,937,942,947],{},[87,938,939],{},[33,940,941],{},"memberships",[87,943,944],{},[33,945,946],{},"(org_id, user_id)",[87,948,949],{},"relasi",[69,951,952,957,962],{},[87,953,954],{},[33,955,956],{},"periods",[87,958,959],{},[33,960,961],{},"period",[87,963,964],{},"kalender",[69,966,967,972,977],{},[87,968,969],{},[33,970,971],{},"financials",[87,973,974],{},[33,975,976],{},"(period, coa_code)",[87,978,979],{},"baris GL",[69,981,982,987,992],{},[87,983,984],{},[33,985,986],{},"cursors",[87,988,989],{},[33,990,991],{},"subscription_id",[87,993,994],{},"state",[164,996,997],{},"Pengecualian harus didokumentasikan di ADR; jangan menambah tanpa alasan.",[182,999,1001],{"id":1000},"_25-sqlite-vs-postgres","2.5 SQLite vs Postgres",[63,1003,1004,1017],{},[66,1005,1006],{},[69,1007,1008,1010,1015],{},[72,1009,74],{},[72,1011,1012,1013],{},"Internal ",[33,1014,212],{},[72,1016,361],{},[82,1018,1019,1037,1053],{},[69,1020,1021,1024,1030],{},[87,1022,1023],{},"DO SQLite",[87,1025,1026,1029],{},[33,1027,1028],{},"INTEGER PRIMARY KEY"," (rowid)",[87,1031,1032,1033,1036],{},"64-bit; tanpa ",[33,1034,1035],{},"AUTOINCREMENT"," kecuali butuh monotonic ketat",[69,1038,1039,1042,1047],{},[87,1040,1041],{},"Postgres control plane",[87,1043,1044],{},[33,1045,1046],{},"BIGSERIAL PRIMARY KEY",[87,1048,1049,1052],{},[33,1050,1051],{},"bigserial"," hanya di sini",[69,1054,1055,1058,1063],{},[87,1056,1057],{},"Neon analytics",[87,1059,1060],{},[33,1061,1062],{},"BIGINT",[87,1064,1065,1066],{},"salinan internal + ",[33,1067,173],{},[164,1069,1070,1071,1073,1074,1076,1077,1079],{},"Jangan memakai ",[33,1072,1035],{}," secara default: ia menambah biaya dan tabel jarang\nhard-delete. Jika sebuah tabel bisa hard-delete dan ",[33,1075,212],{},"-nya dirujuk FK, gunakan\n",[33,1078,1035],{}," atau larang reuse lewat kebijakan erase.",[182,1081,1083],{"id":1082},"_26-cursor","2.6 Cursor",[164,1085,1086,1087,1089,1090,1093],{},"Karena ",[33,1088,173],{}," Nanoid ",[16,1091,1092],{},"tidak sortable",", cursor pagination memakai:",[248,1095,1098],{"className":1096,"code":1097,"language":253},[251],"cursor = base64url(HMAC(secret, created_at || \":\" || id))\n",[33,1099,1097],{"__ignoreMap":256},[164,1101,1102,1103,1106,1107,1109,1110,775,1113,1115,1116,174],{},"Server memvalidasi signature, men-decode, lalu ",[33,1104,1105],{},"WHERE (created_at, id) \u003C (?, ?)",".\nJangan mengekspos ",[33,1108,212],{}," mentah. Alternatif: cursor berisi ",[33,1111,1112],{},"created_at",[33,1114,173],{},"\n(tanpa internal), dengan index ",[33,1117,1118],{},"(created_at, public_id)",[182,1120,1122],{"id":1121},"_27-audit-replay","2.7 Audit & replay",[10,1124,1125,1133,1141,1152],{},[13,1126,1127,1130,1131,174],{},[33,1128,1129],{},"audit_outbox.subject_id"," = ",[33,1132,173],{},[13,1134,1135,1136,1138,1139,174],{},"Hash chain dihitung dari canonical entry yang memuat ",[33,1137,173],{},", bukan ",[33,1140,212],{},[13,1142,1143,1130,1146,1148,1149,312],{},[33,1144,1145],{},"evidence.ref",[33,1147,173],{}," (mis. ",[33,1150,1151],{},"ds_...:row:\u003Cnatural key>",[13,1153,1154,1155,1157],{},"Replay tidak boleh bergantung pada ",[33,1156,212],{}," yang bisa berubah saat restore\u002Fmigrasi.",[55,1159],{},[58,1161,1163],{"id":1162},"_3-control-plane","3. Control plane",[248,1165,1169],{"className":1166,"code":1167,"language":1168,"meta":256,"style":256},"language-sql shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","-- organizations\nid            bigserial primary key,\npublic_id     text not null unique,            -- org_...\nname          text not null,\nslug          text unique not null,\ncreated_at    timestamptz not null\n\n-- users\nid            bigserial primary key,\npublic_id     text not null unique,            -- usr_...\nemail         text unique not null,\nname          text,\ncreated_at    timestamptz not null\n\n-- memberships\norg_id        bigint not null references organizations(id),\nuser_id       bigint not null references users(id),\nrole          text not null,                   -- owner|admin|member|billing|auditor\ncreated_at    timestamptz not null,\nprimary key (org_id, user_id)\n\n-- projects (registry; bukan data keputusan)\nid            bigserial primary key,\npublic_id     text not null unique,            -- proj_...\norg_id        bigint references organizations(id),\nname          text not null,\nvertical      text not null,                   -- generic|\u003Cvertical-pack>\nresidency     jsonb not null,                  -- {region,bucketRegion,modelAllowlist}\ncell_name     text not null unique,            -- DO name \u002F actor id\nstatus        text not null,                   -- provisioning|active|suspended|deleted\ncreated_at    timestamptz not null\n\n-- api_keys (hanya hash + prefix). Tidak ada human\u002Fmachine: scope menentukan.\nid            bigserial primary key,\npublic_id     text not null unique,            -- key_...\nproject_id    bigint references projects(id),\nprefix        text not null,\nhash          text not null,                   -- PBKDF2-SHA256\nsalt          text not null,\niterations    integer not null default 100000,\nname          text,\nscopes        text,                            -- JSON array; default read-only\nenvironment   text not null default 'live',    -- live|sandbox (juga di prefix)\nexpires_at    timestamptz,\ncreated_by    text,                            -- public id pembuat (metadata)\nlast_used_at  timestamptz,\nrevoked_at    timestamptz\n\n-- plans \u002F entitlements\nproject_id    bigint primary key references projects(id),\nplan          text not null,                   -- build|starter|growth|enterprise\nlimits        jsonb not null,\nmodel_funding jsonb not null,                  -- byok|platform_credits|hybrid\nbilling_ref   text,\nupdated_at    timestamptz not null\n","sql",[33,1170,1171,1179,1185,1191,1197,1203,1209,1216,1222,1227,1233,1239,1245,1250,1255,1261,1267,1273,1279,1285,1291,1296,1302,1307,1313,1319,1324,1330,1336,1342,1348,1353,1358,1364,1369,1375,1381,1387,1393,1399,1405,1410,1416,1422,1428,1434,1440,1446,1451,1457,1463,1469,1475,1481,1487],{"__ignoreMap":256},[1172,1173,1176],"span",{"class":1174,"line":1175},"line",1,[1172,1177,1178],{},"-- organizations\n",[1172,1180,1182],{"class":1174,"line":1181},2,[1172,1183,1184],{},"id            bigserial primary key,\n",[1172,1186,1188],{"class":1174,"line":1187},3,[1172,1189,1190],{},"public_id     text not null unique,            -- org_...\n",[1172,1192,1194],{"class":1174,"line":1193},4,[1172,1195,1196],{},"name          text not null,\n",[1172,1198,1200],{"class":1174,"line":1199},5,[1172,1201,1202],{},"slug          text unique not null,\n",[1172,1204,1206],{"class":1174,"line":1205},6,[1172,1207,1208],{},"created_at    timestamptz not null\n",[1172,1210,1212],{"class":1174,"line":1211},7,[1172,1213,1215],{"emptyLinePlaceholder":1214},true,"\n",[1172,1217,1219],{"class":1174,"line":1218},8,[1172,1220,1221],{},"-- users\n",[1172,1223,1225],{"class":1174,"line":1224},9,[1172,1226,1184],{},[1172,1228,1230],{"class":1174,"line":1229},10,[1172,1231,1232],{},"public_id     text not null unique,            -- usr_...\n",[1172,1234,1236],{"class":1174,"line":1235},11,[1172,1237,1238],{},"email         text unique not null,\n",[1172,1240,1242],{"class":1174,"line":1241},12,[1172,1243,1244],{},"name          text,\n",[1172,1246,1248],{"class":1174,"line":1247},13,[1172,1249,1208],{},[1172,1251,1253],{"class":1174,"line":1252},14,[1172,1254,1215],{"emptyLinePlaceholder":1214},[1172,1256,1258],{"class":1174,"line":1257},15,[1172,1259,1260],{},"-- memberships\n",[1172,1262,1264],{"class":1174,"line":1263},16,[1172,1265,1266],{},"org_id        bigint not null references organizations(id),\n",[1172,1268,1270],{"class":1174,"line":1269},17,[1172,1271,1272],{},"user_id       bigint not null references users(id),\n",[1172,1274,1276],{"class":1174,"line":1275},18,[1172,1277,1278],{},"role          text not null,                   -- owner|admin|member|billing|auditor\n",[1172,1280,1282],{"class":1174,"line":1281},19,[1172,1283,1284],{},"created_at    timestamptz not null,\n",[1172,1286,1288],{"class":1174,"line":1287},20,[1172,1289,1290],{},"primary key (org_id, user_id)\n",[1172,1292,1294],{"class":1174,"line":1293},21,[1172,1295,1215],{"emptyLinePlaceholder":1214},[1172,1297,1299],{"class":1174,"line":1298},22,[1172,1300,1301],{},"-- projects (registry; bukan data keputusan)\n",[1172,1303,1305],{"class":1174,"line":1304},23,[1172,1306,1184],{},[1172,1308,1310],{"class":1174,"line":1309},24,[1172,1311,1312],{},"public_id     text not null unique,            -- proj_...\n",[1172,1314,1316],{"class":1174,"line":1315},25,[1172,1317,1318],{},"org_id        bigint references organizations(id),\n",[1172,1320,1322],{"class":1174,"line":1321},26,[1172,1323,1196],{},[1172,1325,1327],{"class":1174,"line":1326},27,[1172,1328,1329],{},"vertical      text not null,                   -- generic|\u003Cvertical-pack>\n",[1172,1331,1333],{"class":1174,"line":1332},28,[1172,1334,1335],{},"residency     jsonb not null,                  -- {region,bucketRegion,modelAllowlist}\n",[1172,1337,1339],{"class":1174,"line":1338},29,[1172,1340,1341],{},"cell_name     text not null unique,            -- DO name \u002F actor id\n",[1172,1343,1345],{"class":1174,"line":1344},30,[1172,1346,1347],{},"status        text not null,                   -- provisioning|active|suspended|deleted\n",[1172,1349,1351],{"class":1174,"line":1350},31,[1172,1352,1208],{},[1172,1354,1356],{"class":1174,"line":1355},32,[1172,1357,1215],{"emptyLinePlaceholder":1214},[1172,1359,1361],{"class":1174,"line":1360},33,[1172,1362,1363],{},"-- api_keys (hanya hash + prefix). Tidak ada human\u002Fmachine: scope menentukan.\n",[1172,1365,1367],{"class":1174,"line":1366},34,[1172,1368,1184],{},[1172,1370,1372],{"class":1174,"line":1371},35,[1172,1373,1374],{},"public_id     text not null unique,            -- key_...\n",[1172,1376,1378],{"class":1174,"line":1377},36,[1172,1379,1380],{},"project_id    bigint references projects(id),\n",[1172,1382,1384],{"class":1174,"line":1383},37,[1172,1385,1386],{},"prefix        text not null,\n",[1172,1388,1390],{"class":1174,"line":1389},38,[1172,1391,1392],{},"hash          text not null,                   -- PBKDF2-SHA256\n",[1172,1394,1396],{"class":1174,"line":1395},39,[1172,1397,1398],{},"salt          text not null,\n",[1172,1400,1402],{"class":1174,"line":1401},40,[1172,1403,1404],{},"iterations    integer not null default 100000,\n",[1172,1406,1408],{"class":1174,"line":1407},41,[1172,1409,1244],{},[1172,1411,1413],{"class":1174,"line":1412},42,[1172,1414,1415],{},"scopes        text,                            -- JSON array; default read-only\n",[1172,1417,1419],{"class":1174,"line":1418},43,[1172,1420,1421],{},"environment   text not null default 'live',    -- live|sandbox (juga di prefix)\n",[1172,1423,1425],{"class":1174,"line":1424},44,[1172,1426,1427],{},"expires_at    timestamptz,\n",[1172,1429,1431],{"class":1174,"line":1430},45,[1172,1432,1433],{},"created_by    text,                            -- public id pembuat (metadata)\n",[1172,1435,1437],{"class":1174,"line":1436},46,[1172,1438,1439],{},"last_used_at  timestamptz,\n",[1172,1441,1443],{"class":1174,"line":1442},47,[1172,1444,1445],{},"revoked_at    timestamptz\n",[1172,1447,1449],{"class":1174,"line":1448},48,[1172,1450,1215],{"emptyLinePlaceholder":1214},[1172,1452,1454],{"class":1174,"line":1453},49,[1172,1455,1456],{},"-- plans \u002F entitlements\n",[1172,1458,1460],{"class":1174,"line":1459},50,[1172,1461,1462],{},"project_id    bigint primary key references projects(id),\n",[1172,1464,1466],{"class":1174,"line":1465},51,[1172,1467,1468],{},"plan          text not null,                   -- build|starter|growth|enterprise\n",[1172,1470,1472],{"class":1174,"line":1471},52,[1172,1473,1474],{},"limits        jsonb not null,\n",[1172,1476,1478],{"class":1174,"line":1477},53,[1172,1479,1480],{},"model_funding jsonb not null,                  -- byok|platform_credits|hybrid\n",[1172,1482,1484],{"class":1174,"line":1483},54,[1172,1485,1486],{},"billing_ref   text,\n",[1172,1488,1490],{"class":1174,"line":1489},55,[1172,1491,1492],{},"updated_at    timestamptz not null\n",[164,1494,1495,1498,1499,1502,1503,1505],{},[16,1496,1497],{},"Kenapa API key di control plane:"," lookup prefix harus murah dan tidak boleh memanggil\ncell lain di jalur latency. Cell menerima ",[33,1500,1501],{},"projectId"," (internal) hasil resolusi; API tidak\npernah menerima ",[33,1504,1501],{}," dari klien.",[55,1507],{},[58,1509,1511],{"id":1510},"_4-project-cell","4. Project cell",[182,1513,1515],{"id":1514},"_41-agents-contracts","4.1 Agents & contracts",[248,1517,1519],{"className":1166,"code":1518,"language":1168,"meta":256,"style":256},"create table agents (\n  id                    integer primary key,\n  public_id             text not null unique,     -- slug: default.agent\n  mode                  text not null,            -- shadow|assist|auto\n  model                 text not null,            -- local:* | ext:*\n  reviewer_model        text,\n  escalation_threshold  real not null default 0.7,\n  tools                 text not null,            -- JSON array\n  instructions          text,\n  budget_usd_per_month  real,\n  contract_version      text not null,\n  policy_version        text not null,\n  created_at            text not null,\n  updated_at            text not null\n);\n\ncreate table agent_contracts (\n  agent_id        integer not null references agents(id),\n  version         text not null,\n  input_schema    text not null,                  -- JSON Schema\n  output_schema   text not null,\n  reason_codes    text not null,                  -- JSON array\n  created_at      text not null,\n  primary key (agent_id, version)\n);\n",[33,1520,1521,1526,1531,1536,1541,1546,1551,1556,1561,1566,1571,1576,1581,1586,1591,1596,1600,1605,1610,1615,1620,1625,1630,1635,1640],{"__ignoreMap":256},[1172,1522,1523],{"class":1174,"line":1175},[1172,1524,1525],{},"create table agents (\n",[1172,1527,1528],{"class":1174,"line":1181},[1172,1529,1530],{},"  id                    integer primary key,\n",[1172,1532,1533],{"class":1174,"line":1187},[1172,1534,1535],{},"  public_id             text not null unique,     -- slug: default.agent\n",[1172,1537,1538],{"class":1174,"line":1193},[1172,1539,1540],{},"  mode                  text not null,            -- shadow|assist|auto\n",[1172,1542,1543],{"class":1174,"line":1199},[1172,1544,1545],{},"  model                 text not null,            -- local:* | ext:*\n",[1172,1547,1548],{"class":1174,"line":1205},[1172,1549,1550],{},"  reviewer_model        text,\n",[1172,1552,1553],{"class":1174,"line":1211},[1172,1554,1555],{},"  escalation_threshold  real not null default 0.7,\n",[1172,1557,1558],{"class":1174,"line":1218},[1172,1559,1560],{},"  tools                 text not null,            -- JSON array\n",[1172,1562,1563],{"class":1174,"line":1224},[1172,1564,1565],{},"  instructions          text,\n",[1172,1567,1568],{"class":1174,"line":1229},[1172,1569,1570],{},"  budget_usd_per_month  real,\n",[1172,1572,1573],{"class":1174,"line":1235},[1172,1574,1575],{},"  contract_version      text not null,\n",[1172,1577,1578],{"class":1174,"line":1241},[1172,1579,1580],{},"  policy_version        text not null,\n",[1172,1582,1583],{"class":1174,"line":1247},[1172,1584,1585],{},"  created_at            text not null,\n",[1172,1587,1588],{"class":1174,"line":1252},[1172,1589,1590],{},"  updated_at            text not null\n",[1172,1592,1593],{"class":1174,"line":1257},[1172,1594,1595],{},");\n",[1172,1597,1598],{"class":1174,"line":1263},[1172,1599,1215],{"emptyLinePlaceholder":1214},[1172,1601,1602],{"class":1174,"line":1269},[1172,1603,1604],{},"create table agent_contracts (\n",[1172,1606,1607],{"class":1174,"line":1275},[1172,1608,1609],{},"  agent_id        integer not null references agents(id),\n",[1172,1611,1612],{"class":1174,"line":1281},[1172,1613,1614],{},"  version         text not null,\n",[1172,1616,1617],{"class":1174,"line":1287},[1172,1618,1619],{},"  input_schema    text not null,                  -- JSON Schema\n",[1172,1621,1622],{"class":1174,"line":1293},[1172,1623,1624],{},"  output_schema   text not null,\n",[1172,1626,1627],{"class":1174,"line":1298},[1172,1628,1629],{},"  reason_codes    text not null,                  -- JSON array\n",[1172,1631,1632],{"class":1174,"line":1304},[1172,1633,1634],{},"  created_at      text not null,\n",[1172,1636,1637],{"class":1174,"line":1309},[1172,1638,1639],{},"  primary key (agent_id, version)\n",[1172,1641,1642],{"class":1174,"line":1315},[1172,1643,1595],{},[164,1645,1646,1647,1649,1650,1653],{},"Agent sengaja memakai slug sebagai ",[33,1648,173],{}," karena API dan konfigurasi memakai nama\nagent. Jangan menambahkan prefix ",[33,1651,1652],{},"agent_"," tanpa ADR baru.",[182,1655,1657],{"id":1656},"_42-sessions-entries","4.2 Sessions & entries",[248,1659,1661],{"className":1166,"code":1660,"language":1168,"meta":256,"style":256},"create table sessions (\n  id              integer primary key,\n  public_id       text not null unique,           -- ses_...\n  agent_id        integer not null references agents(id),\n  parent_id       integer references sessions(id),\n  forked_at       integer references entries(id), -- entry internal\n  ownership       text not null,                  -- ownerless|task\n  status          text not null,                  -- idle|running|waiting_approval|closed\n  overrides       text,                           -- JSON\n  model           text,\n  created_at      text not null,\n  updated_at      text not null\n);\ncreate index sessions_agent on sessions(agent_id, created_at desc);\ncreate index sessions_parent on sessions(parent_id);\n\ncreate table entries (\n  id              integer primary key,\n  public_id       text not null unique,           -- ent_...\n  session_id      integer not null references sessions(id),\n  role            text not null,                  -- user|assistant|tool|system\n  content         text,\n  tool_name       text,\n  tool_args       text,                           -- JSON (redacted)\n  cost_input      integer default 0,\n  cost_output     integer default 0,\n  cost_usd        real default 0,\n  at              text not null\n);\ncreate index entries_session on entries(session_id, at);\n\ncreate table submissions (\n  id              integer primary key,\n  public_id       text not null unique,           -- sub_...\n  session_id      integer not null references sessions(id),\n  request_id      text not null,                  -- Idempotency-Key\n  state           text not null,                  -- queued|running|settled|unaffected\n  answer_entry_id integer references entries(id),\n  trace_id        text,                           -- tr_...\n  created_at      text not null\n);\ncreate unique index submissions_request on submissions(request_id);\n",[33,1662,1663,1668,1673,1678,1682,1687,1692,1697,1702,1707,1712,1716,1721,1725,1730,1735,1739,1744,1748,1753,1758,1763,1768,1773,1778,1783,1788,1793,1798,1802,1807,1811,1816,1820,1825,1829,1834,1839,1844,1849,1854,1858],{"__ignoreMap":256},[1172,1664,1665],{"class":1174,"line":1175},[1172,1666,1667],{},"create table sessions (\n",[1172,1669,1670],{"class":1174,"line":1181},[1172,1671,1672],{},"  id              integer primary key,\n",[1172,1674,1675],{"class":1174,"line":1187},[1172,1676,1677],{},"  public_id       text not null unique,           -- ses_...\n",[1172,1679,1680],{"class":1174,"line":1193},[1172,1681,1609],{},[1172,1683,1684],{"class":1174,"line":1199},[1172,1685,1686],{},"  parent_id       integer references sessions(id),\n",[1172,1688,1689],{"class":1174,"line":1205},[1172,1690,1691],{},"  forked_at       integer references entries(id), -- entry internal\n",[1172,1693,1694],{"class":1174,"line":1211},[1172,1695,1696],{},"  ownership       text not null,                  -- ownerless|task\n",[1172,1698,1699],{"class":1174,"line":1218},[1172,1700,1701],{},"  status          text not null,                  -- idle|running|waiting_approval|closed\n",[1172,1703,1704],{"class":1174,"line":1224},[1172,1705,1706],{},"  overrides       text,                           -- JSON\n",[1172,1708,1709],{"class":1174,"line":1229},[1172,1710,1711],{},"  model           text,\n",[1172,1713,1714],{"class":1174,"line":1235},[1172,1715,1634],{},[1172,1717,1718],{"class":1174,"line":1241},[1172,1719,1720],{},"  updated_at      text not null\n",[1172,1722,1723],{"class":1174,"line":1247},[1172,1724,1595],{},[1172,1726,1727],{"class":1174,"line":1252},[1172,1728,1729],{},"create index sessions_agent on sessions(agent_id, created_at desc);\n",[1172,1731,1732],{"class":1174,"line":1257},[1172,1733,1734],{},"create index sessions_parent on sessions(parent_id);\n",[1172,1736,1737],{"class":1174,"line":1263},[1172,1738,1215],{"emptyLinePlaceholder":1214},[1172,1740,1741],{"class":1174,"line":1269},[1172,1742,1743],{},"create table entries (\n",[1172,1745,1746],{"class":1174,"line":1275},[1172,1747,1672],{},[1172,1749,1750],{"class":1174,"line":1281},[1172,1751,1752],{},"  public_id       text not null unique,           -- ent_...\n",[1172,1754,1755],{"class":1174,"line":1287},[1172,1756,1757],{},"  session_id      integer not null references sessions(id),\n",[1172,1759,1760],{"class":1174,"line":1293},[1172,1761,1762],{},"  role            text not null,                  -- user|assistant|tool|system\n",[1172,1764,1765],{"class":1174,"line":1298},[1172,1766,1767],{},"  content         text,\n",[1172,1769,1770],{"class":1174,"line":1304},[1172,1771,1772],{},"  tool_name       text,\n",[1172,1774,1775],{"class":1174,"line":1309},[1172,1776,1777],{},"  tool_args       text,                           -- JSON (redacted)\n",[1172,1779,1780],{"class":1174,"line":1315},[1172,1781,1782],{},"  cost_input      integer default 0,\n",[1172,1784,1785],{"class":1174,"line":1321},[1172,1786,1787],{},"  cost_output     integer default 0,\n",[1172,1789,1790],{"class":1174,"line":1326},[1172,1791,1792],{},"  cost_usd        real default 0,\n",[1172,1794,1795],{"class":1174,"line":1332},[1172,1796,1797],{},"  at              text not null\n",[1172,1799,1800],{"class":1174,"line":1338},[1172,1801,1595],{},[1172,1803,1804],{"class":1174,"line":1344},[1172,1805,1806],{},"create index entries_session on entries(session_id, at);\n",[1172,1808,1809],{"class":1174,"line":1350},[1172,1810,1215],{"emptyLinePlaceholder":1214},[1172,1812,1813],{"class":1174,"line":1355},[1172,1814,1815],{},"create table submissions (\n",[1172,1817,1818],{"class":1174,"line":1360},[1172,1819,1672],{},[1172,1821,1822],{"class":1174,"line":1366},[1172,1823,1824],{},"  public_id       text not null unique,           -- sub_...\n",[1172,1826,1827],{"class":1174,"line":1371},[1172,1828,1757],{},[1172,1830,1831],{"class":1174,"line":1377},[1172,1832,1833],{},"  request_id      text not null,                  -- Idempotency-Key\n",[1172,1835,1836],{"class":1174,"line":1383},[1172,1837,1838],{},"  state           text not null,                  -- queued|running|settled|unaffected\n",[1172,1840,1841],{"class":1174,"line":1389},[1172,1842,1843],{},"  answer_entry_id integer references entries(id),\n",[1172,1845,1846],{"class":1174,"line":1395},[1172,1847,1848],{},"  trace_id        text,                           -- tr_...\n",[1172,1850,1851],{"class":1174,"line":1401},[1172,1852,1853],{},"  created_at      text not null\n",[1172,1855,1856],{"class":1174,"line":1407},[1172,1857,1595],{},[1172,1859,1860],{"class":1174,"line":1412},[1172,1861,1862],{},"create unique index submissions_request on submissions(request_id);\n",[164,1864,1865,42,1868,775,1871,1874,1875,1877,1878,1880,1881,174],{},[16,1866,1867],{},"Fork:",[33,1869,1870],{},"sessions.parent_id",[33,1872,1873],{},"forked_at","; entry anak tidak menyalin entry induk.\nQuery transcript menggabungkan induk sampai ",[33,1876,1873],{}," + entry anak. Internal ",[33,1879,212],{}," hanya\ndipakai join; API mengembalikan ",[33,1882,173],{},[182,1884,1886],{"id":1885},"_43-decisions","4.3 Decisions",[248,1888,1890],{"className":1166,"code":1889,"language":1168,"meta":256,"style":256},"create table decisions (\n  id                     integer primary key,\n  public_id              text not null unique,     -- dec_...\n  agent_id               integer not null references agents(id),\n  session_id             integer references sessions(id),\n  status                 text not null,            -- queued|running|decided|needs_review|...\n  mode                   text not null,             -- shadow|assist|auto\n  action                 text,\n  reason_codes           text,                      -- JSON array\n  confidence             real,\n  evidence               text,                      -- JSON array of public refs\n  rationale              text,\n  missing_evidence       text,\n  execution              text not null default 'advisory',\n  proposed_invocation    text,                      -- JSON\n  invocation_id          integer references action_invocations(id),\n  escalated              integer not null default 0,\n  model_used             text,\n  policy_version         text not null,\n  contract_version       text not null,\n  feature_snapshot_hash  text,\n  input_hash             text not null,\n  cost_input             integer default 0,\n  cost_output            integer default 0,\n  cost_usd               real default 0,\n  latency_ms             integer,\n  trace_id               text not null,             -- tr_...\n  approval_id            integer references approvals(id),\n  created_at             text not null,\n  decided_at             text\n);\ncreate index decisions_status on decisions(status, created_at desc);\ncreate index decisions_agent on decisions(agent_id, created_at desc);\ncreate index decisions_session on decisions(session_id);\n\ncreate table decision_feedback (\n  id              integer primary key,\n  public_id       text not null unique,             -- fbk_...\n  decision_id     integer not null references decisions(id),\n  outcome         text not null,\n  actual          text,\n  note            text,\n  observed_at     text,\n  created_at      text not null\n);\n",[33,1891,1892,1897,1902,1907,1912,1917,1922,1927,1932,1937,1942,1947,1952,1957,1962,1967,1972,1977,1982,1987,1992,1997,2002,2007,2012,2017,2022,2027,2032,2037,2042,2046,2051,2056,2061,2065,2070,2074,2079,2084,2089,2094,2099,2104,2108],{"__ignoreMap":256},[1172,1893,1894],{"class":1174,"line":1175},[1172,1895,1896],{},"create table decisions (\n",[1172,1898,1899],{"class":1174,"line":1181},[1172,1900,1901],{},"  id                     integer primary key,\n",[1172,1903,1904],{"class":1174,"line":1187},[1172,1905,1906],{},"  public_id              text not null unique,     -- dec_...\n",[1172,1908,1909],{"class":1174,"line":1193},[1172,1910,1911],{},"  agent_id               integer not null references agents(id),\n",[1172,1913,1914],{"class":1174,"line":1199},[1172,1915,1916],{},"  session_id             integer references sessions(id),\n",[1172,1918,1919],{"class":1174,"line":1205},[1172,1920,1921],{},"  status                 text not null,            -- queued|running|decided|needs_review|...\n",[1172,1923,1924],{"class":1174,"line":1211},[1172,1925,1926],{},"  mode                   text not null,             -- shadow|assist|auto\n",[1172,1928,1929],{"class":1174,"line":1218},[1172,1930,1931],{},"  action                 text,\n",[1172,1933,1934],{"class":1174,"line":1224},[1172,1935,1936],{},"  reason_codes           text,                      -- JSON array\n",[1172,1938,1939],{"class":1174,"line":1229},[1172,1940,1941],{},"  confidence             real,\n",[1172,1943,1944],{"class":1174,"line":1235},[1172,1945,1946],{},"  evidence               text,                      -- JSON array of public refs\n",[1172,1948,1949],{"class":1174,"line":1241},[1172,1950,1951],{},"  rationale              text,\n",[1172,1953,1954],{"class":1174,"line":1247},[1172,1955,1956],{},"  missing_evidence       text,\n",[1172,1958,1959],{"class":1174,"line":1252},[1172,1960,1961],{},"  execution              text not null default 'advisory',\n",[1172,1963,1964],{"class":1174,"line":1257},[1172,1965,1966],{},"  proposed_invocation    text,                      -- JSON\n",[1172,1968,1969],{"class":1174,"line":1263},[1172,1970,1971],{},"  invocation_id          integer references action_invocations(id),\n",[1172,1973,1974],{"class":1174,"line":1269},[1172,1975,1976],{},"  escalated              integer not null default 0,\n",[1172,1978,1979],{"class":1174,"line":1275},[1172,1980,1981],{},"  model_used             text,\n",[1172,1983,1984],{"class":1174,"line":1281},[1172,1985,1986],{},"  policy_version         text not null,\n",[1172,1988,1989],{"class":1174,"line":1287},[1172,1990,1991],{},"  contract_version       text not null,\n",[1172,1993,1994],{"class":1174,"line":1293},[1172,1995,1996],{},"  feature_snapshot_hash  text,\n",[1172,1998,1999],{"class":1174,"line":1298},[1172,2000,2001],{},"  input_hash             text not null,\n",[1172,2003,2004],{"class":1174,"line":1304},[1172,2005,2006],{},"  cost_input             integer default 0,\n",[1172,2008,2009],{"class":1174,"line":1309},[1172,2010,2011],{},"  cost_output            integer default 0,\n",[1172,2013,2014],{"class":1174,"line":1315},[1172,2015,2016],{},"  cost_usd               real default 0,\n",[1172,2018,2019],{"class":1174,"line":1321},[1172,2020,2021],{},"  latency_ms             integer,\n",[1172,2023,2024],{"class":1174,"line":1326},[1172,2025,2026],{},"  trace_id               text not null,             -- tr_...\n",[1172,2028,2029],{"class":1174,"line":1332},[1172,2030,2031],{},"  approval_id            integer references approvals(id),\n",[1172,2033,2034],{"class":1174,"line":1338},[1172,2035,2036],{},"  created_at             text not null,\n",[1172,2038,2039],{"class":1174,"line":1344},[1172,2040,2041],{},"  decided_at             text\n",[1172,2043,2044],{"class":1174,"line":1350},[1172,2045,1595],{},[1172,2047,2048],{"class":1174,"line":1355},[1172,2049,2050],{},"create index decisions_status on decisions(status, created_at desc);\n",[1172,2052,2053],{"class":1174,"line":1360},[1172,2054,2055],{},"create index decisions_agent on decisions(agent_id, created_at desc);\n",[1172,2057,2058],{"class":1174,"line":1366},[1172,2059,2060],{},"create index decisions_session on decisions(session_id);\n",[1172,2062,2063],{"class":1174,"line":1371},[1172,2064,1215],{"emptyLinePlaceholder":1214},[1172,2066,2067],{"class":1174,"line":1377},[1172,2068,2069],{},"create table decision_feedback (\n",[1172,2071,2072],{"class":1174,"line":1383},[1172,2073,1672],{},[1172,2075,2076],{"class":1174,"line":1389},[1172,2077,2078],{},"  public_id       text not null unique,             -- fbk_...\n",[1172,2080,2081],{"class":1174,"line":1395},[1172,2082,2083],{},"  decision_id     integer not null references decisions(id),\n",[1172,2085,2086],{"class":1174,"line":1401},[1172,2087,2088],{},"  outcome         text not null,\n",[1172,2090,2091],{"class":1174,"line":1407},[1172,2092,2093],{},"  actual          text,\n",[1172,2095,2096],{"class":1174,"line":1412},[1172,2097,2098],{},"  note            text,\n",[1172,2100,2101],{"class":1174,"line":1418},[1172,2102,2103],{},"  observed_at     text,\n",[1172,2105,2106],{"class":1174,"line":1424},[1172,2107,1853],{},[1172,2109,2110],{"class":1174,"line":1430},[1172,2111,1595],{},[164,2113,2114,775,2117,2120,2121,2124,2125,2128],{},[33,2115,2116],{},"feature_snapshot_hash",[33,2118,2119],{},"input_hash"," adalah dasar replay. Jangan pernah update baris\n",[33,2122,2123],{},"decisions"," setelah ",[33,2126,2127],{},"decided","; koreksi = baris baru + relasi.",[182,2130,2132],{"id":2131},"_44-datasets-onboarding-sources-data-contract","4.4 Datasets, onboarding sources, data contract",[248,2134,2136],{"className":1166,"code":2135,"language":1168,"meta":256,"style":256},"create table onboarding_sources (\n  id              integer primary key,\n  public_id       text not null unique,             -- src_...\n  type            text not null,                    -- s3|postgres_cdc|webhook|upload\n  config          text not null,                    -- JSON (tanpa secret plaintext)\n  status          text not null,\n  created_at      text not null\n);\n\ncreate table datasets (\n  id                 integer primary key,\n  public_id          text not null unique,          -- ds_...\n  source_id          integer references onboarding_sources(id),\n  name               text not null,\n  entity             text not null,\n  format             text not null,                 -- csv|ndjson|parquet\n  status             text not null,                 -- registered|uploading|ingesting|ready|...\n  pii_classification text not null,                 -- none|low|high\n  rows               integer,\n  checksum           text,\n  object_key         text,                          -- R2\n  schema_json        text,\n  quality_gates      text,                          -- JSON\n  created_at         text not null\n);\n\ncreate table data_contracts (\n  id             integer primary key,\n  version        text not null unique,              -- \"3\"\n  project        text not null,\n  owner          text not null,\n  document       text not null,                     -- YAML\u002FJSON canonical\n  hash           text not null,\n  status         text not null,                     -- draft|active|superseded\n  approved_by    text,                              -- usr_... \u002F key_...\n  approved_at    text,\n  created_at     text not null\n);\n\ncreate table syncs (\n  id                    integer primary key,\n  public_id             text not null unique,       -- syn_...\n  source_id             integer not null references onboarding_sources(id),\n  contract_id           integer not null references data_contracts(id),\n  status                text not null,              -- active|paused|drifted|failed\n  last_batch_at         text,\n  lag_seconds           integer,\n  quarantined_batches   integer not null default 0,\n  decisions_frozen      integer not null default 0,\n  created_at            text not null\n);\n\ncreate table quarantine_batches (\n  id            integer primary key,\n  public_id     text not null unique,               -- qb_...\n  sync_id       integer not null references syncs(id),\n  received_at   text not null,\n  rows          integer not null,\n  violations    text not null,                      -- JSON\n  payload_key   text                                -- R2 untuk audit\n);\n",[33,2137,2138,2143,2147,2152,2157,2162,2167,2171,2175,2179,2184,2189,2194,2199,2204,2209,2214,2219,2224,2229,2234,2239,2244,2249,2254,2258,2262,2267,2272,2277,2282,2287,2292,2297,2302,2307,2312,2317,2321,2325,2330,2334,2339,2344,2349,2354,2359,2364,2369,2374,2379,2383,2387,2392,2397,2402,2408,2414,2420,2426,2432],{"__ignoreMap":256},[1172,2139,2140],{"class":1174,"line":1175},[1172,2141,2142],{},"create table onboarding_sources (\n",[1172,2144,2145],{"class":1174,"line":1181},[1172,2146,1672],{},[1172,2148,2149],{"class":1174,"line":1187},[1172,2150,2151],{},"  public_id       text not null unique,             -- src_...\n",[1172,2153,2154],{"class":1174,"line":1193},[1172,2155,2156],{},"  type            text not null,                    -- s3|postgres_cdc|webhook|upload\n",[1172,2158,2159],{"class":1174,"line":1199},[1172,2160,2161],{},"  config          text not null,                    -- JSON (tanpa secret plaintext)\n",[1172,2163,2164],{"class":1174,"line":1205},[1172,2165,2166],{},"  status          text not null,\n",[1172,2168,2169],{"class":1174,"line":1211},[1172,2170,1853],{},[1172,2172,2173],{"class":1174,"line":1218},[1172,2174,1595],{},[1172,2176,2177],{"class":1174,"line":1224},[1172,2178,1215],{"emptyLinePlaceholder":1214},[1172,2180,2181],{"class":1174,"line":1229},[1172,2182,2183],{},"create table datasets (\n",[1172,2185,2186],{"class":1174,"line":1235},[1172,2187,2188],{},"  id                 integer primary key,\n",[1172,2190,2191],{"class":1174,"line":1241},[1172,2192,2193],{},"  public_id          text not null unique,          -- ds_...\n",[1172,2195,2196],{"class":1174,"line":1247},[1172,2197,2198],{},"  source_id          integer references onboarding_sources(id),\n",[1172,2200,2201],{"class":1174,"line":1252},[1172,2202,2203],{},"  name               text not null,\n",[1172,2205,2206],{"class":1174,"line":1257},[1172,2207,2208],{},"  entity             text not null,\n",[1172,2210,2211],{"class":1174,"line":1263},[1172,2212,2213],{},"  format             text not null,                 -- csv|ndjson|parquet\n",[1172,2215,2216],{"class":1174,"line":1269},[1172,2217,2218],{},"  status             text not null,                 -- registered|uploading|ingesting|ready|...\n",[1172,2220,2221],{"class":1174,"line":1275},[1172,2222,2223],{},"  pii_classification text not null,                 -- none|low|high\n",[1172,2225,2226],{"class":1174,"line":1281},[1172,2227,2228],{},"  rows               integer,\n",[1172,2230,2231],{"class":1174,"line":1287},[1172,2232,2233],{},"  checksum           text,\n",[1172,2235,2236],{"class":1174,"line":1293},[1172,2237,2238],{},"  object_key         text,                          -- R2\n",[1172,2240,2241],{"class":1174,"line":1298},[1172,2242,2243],{},"  schema_json        text,\n",[1172,2245,2246],{"class":1174,"line":1304},[1172,2247,2248],{},"  quality_gates      text,                          -- JSON\n",[1172,2250,2251],{"class":1174,"line":1309},[1172,2252,2253],{},"  created_at         text not null\n",[1172,2255,2256],{"class":1174,"line":1315},[1172,2257,1595],{},[1172,2259,2260],{"class":1174,"line":1321},[1172,2261,1215],{"emptyLinePlaceholder":1214},[1172,2263,2264],{"class":1174,"line":1326},[1172,2265,2266],{},"create table data_contracts (\n",[1172,2268,2269],{"class":1174,"line":1332},[1172,2270,2271],{},"  id             integer primary key,\n",[1172,2273,2274],{"class":1174,"line":1338},[1172,2275,2276],{},"  version        text not null unique,              -- \"3\"\n",[1172,2278,2279],{"class":1174,"line":1344},[1172,2280,2281],{},"  project        text not null,\n",[1172,2283,2284],{"class":1174,"line":1350},[1172,2285,2286],{},"  owner          text not null,\n",[1172,2288,2289],{"class":1174,"line":1355},[1172,2290,2291],{},"  document       text not null,                     -- YAML\u002FJSON canonical\n",[1172,2293,2294],{"class":1174,"line":1360},[1172,2295,2296],{},"  hash           text not null,\n",[1172,2298,2299],{"class":1174,"line":1366},[1172,2300,2301],{},"  status         text not null,                     -- draft|active|superseded\n",[1172,2303,2304],{"class":1174,"line":1371},[1172,2305,2306],{},"  approved_by    text,                              -- usr_... \u002F key_...\n",[1172,2308,2309],{"class":1174,"line":1377},[1172,2310,2311],{},"  approved_at    text,\n",[1172,2313,2314],{"class":1174,"line":1383},[1172,2315,2316],{},"  created_at     text not null\n",[1172,2318,2319],{"class":1174,"line":1389},[1172,2320,1595],{},[1172,2322,2323],{"class":1174,"line":1395},[1172,2324,1215],{"emptyLinePlaceholder":1214},[1172,2326,2327],{"class":1174,"line":1401},[1172,2328,2329],{},"create table syncs (\n",[1172,2331,2332],{"class":1174,"line":1407},[1172,2333,1530],{},[1172,2335,2336],{"class":1174,"line":1412},[1172,2337,2338],{},"  public_id             text not null unique,       -- syn_...\n",[1172,2340,2341],{"class":1174,"line":1418},[1172,2342,2343],{},"  source_id             integer not null references onboarding_sources(id),\n",[1172,2345,2346],{"class":1174,"line":1424},[1172,2347,2348],{},"  contract_id           integer not null references data_contracts(id),\n",[1172,2350,2351],{"class":1174,"line":1430},[1172,2352,2353],{},"  status                text not null,              -- active|paused|drifted|failed\n",[1172,2355,2356],{"class":1174,"line":1436},[1172,2357,2358],{},"  last_batch_at         text,\n",[1172,2360,2361],{"class":1174,"line":1442},[1172,2362,2363],{},"  lag_seconds           integer,\n",[1172,2365,2366],{"class":1174,"line":1448},[1172,2367,2368],{},"  quarantined_batches   integer not null default 0,\n",[1172,2370,2371],{"class":1174,"line":1453},[1172,2372,2373],{},"  decisions_frozen      integer not null default 0,\n",[1172,2375,2376],{"class":1174,"line":1459},[1172,2377,2378],{},"  created_at            text not null\n",[1172,2380,2381],{"class":1174,"line":1465},[1172,2382,1595],{},[1172,2384,2385],{"class":1174,"line":1471},[1172,2386,1215],{"emptyLinePlaceholder":1214},[1172,2388,2389],{"class":1174,"line":1477},[1172,2390,2391],{},"create table quarantine_batches (\n",[1172,2393,2394],{"class":1174,"line":1483},[1172,2395,2396],{},"  id            integer primary key,\n",[1172,2398,2399],{"class":1174,"line":1489},[1172,2400,2401],{},"  public_id     text not null unique,               -- qb_...\n",[1172,2403,2405],{"class":1174,"line":2404},56,[1172,2406,2407],{},"  sync_id       integer not null references syncs(id),\n",[1172,2409,2411],{"class":1174,"line":2410},57,[1172,2412,2413],{},"  received_at   text not null,\n",[1172,2415,2417],{"class":1174,"line":2416},58,[1172,2418,2419],{},"  rows          integer not null,\n",[1172,2421,2423],{"class":1174,"line":2422},59,[1172,2424,2425],{},"  violations    text not null,                      -- JSON\n",[1172,2427,2429],{"class":1174,"line":2428},60,[1172,2430,2431],{},"  payload_key   text                                -- R2 untuk audit\n",[1172,2433,2435],{"class":1174,"line":2434},61,[1172,2436,1595],{},[182,2438,2440],{"id":2439},"_45-connectors-actions-invocations-credentials","4.5 Connectors, actions, invocations, credentials",[248,2442,2444],{"className":1166,"code":2443,"language":1168,"meta":256,"style":256},"create table connectors (\n  id            integer primary key,\n  public_id     text not null unique,               -- cn_...\n  type          text not null,                      -- openapi|mcp|declarative\n  url           text,\n  spec          text,                               -- JSON\u002FYAML\n  warning       text,                               -- indikasi prompt injection\n  status        text not null,                      -- active|disabled\n  created_at    text not null\n);\n\ncreate table actions (\n  id                   integer primary key,\n  public_id            text not null unique,        -- act_...\n  connector_id         integer references connectors(id),\n  name                 text unique not null,        -- record.request_documents\n  risk                 text not null,               -- read|write_low|write_high|financial\n  endpoint             text not null,               -- JSON\n  args_schema          text not null,               -- JSON\n  idempotency          text not null,               -- JSON\n  response_fields      text,                        -- JSON\n  redact_fields        text,                        -- JSON\n  guardrails           text not null,               -- JSON\n  replay               text not null,               -- safe|unsafe\n  enabled              integer not null default 0,\n  created_at           text not null,\n  updated_at           text not null\n);\n\ncreate table action_invocations (\n  id                    integer primary key,\n  public_id             text not null unique,       -- inv_...\n  action_id             integer not null references actions(id),\n  decision_id           integer references decisions(id),\n  status                text not null,              -- proposed|approved|executing|succeeded|...\n  args                  text not null,              -- JSON (context + model)\n  idempotency_key       text not null,\n  request_hash          text,\n  response_hash         text,\n  response_sanitized    text,                       -- JSON, hanya fields\n  error                 text,\n  actor_id              text,                       -- usr_... \u002F key_...\n  reconciled_by         text,\n  reconciled_at         text,\n  created_at            text not null,\n  updated_at            text not null\n);\ncreate index invocations_status on action_invocations(status, created_at desc);\ncreate unique index invocations_idem on action_invocations(idempotency_key);\n\ncreate table credentials (\n  id              integer primary key,\n  public_id       text not null unique,             -- crd_...\n  kind            text not null,                    -- model|action\n  provider        text not null,                    -- ext:anthropic|onprem:enterprise|connector\n  ciphertext      text not null,                    -- envelope encryption\n  kms_key_ref     text not null,\n  metadata        text,                             -- JSON (last4, expiry)\n  last_validated  text,\n  valid           integer,\n  revoked_at      text,\n  created_at      text not null\n);\n",[33,2445,2446,2451,2455,2460,2465,2470,2475,2480,2485,2490,2494,2498,2503,2508,2513,2518,2523,2528,2533,2538,2543,2548,2553,2558,2563,2568,2573,2578,2582,2586,2591,2595,2600,2605,2610,2615,2620,2625,2630,2635,2640,2645,2650,2655,2660,2664,2668,2672,2677,2682,2686,2691,2695,2700,2705,2710,2715,2720,2725,2730,2735,2740,2745],{"__ignoreMap":256},[1172,2447,2448],{"class":1174,"line":1175},[1172,2449,2450],{},"create table connectors (\n",[1172,2452,2453],{"class":1174,"line":1181},[1172,2454,2396],{},[1172,2456,2457],{"class":1174,"line":1187},[1172,2458,2459],{},"  public_id     text not null unique,               -- cn_...\n",[1172,2461,2462],{"class":1174,"line":1193},[1172,2463,2464],{},"  type          text not null,                      -- openapi|mcp|declarative\n",[1172,2466,2467],{"class":1174,"line":1199},[1172,2468,2469],{},"  url           text,\n",[1172,2471,2472],{"class":1174,"line":1205},[1172,2473,2474],{},"  spec          text,                               -- JSON\u002FYAML\n",[1172,2476,2477],{"class":1174,"line":1211},[1172,2478,2479],{},"  warning       text,                               -- indikasi prompt injection\n",[1172,2481,2482],{"class":1174,"line":1218},[1172,2483,2484],{},"  status        text not null,                      -- active|disabled\n",[1172,2486,2487],{"class":1174,"line":1224},[1172,2488,2489],{},"  created_at    text not null\n",[1172,2491,2492],{"class":1174,"line":1229},[1172,2493,1595],{},[1172,2495,2496],{"class":1174,"line":1235},[1172,2497,1215],{"emptyLinePlaceholder":1214},[1172,2499,2500],{"class":1174,"line":1241},[1172,2501,2502],{},"create table actions (\n",[1172,2504,2505],{"class":1174,"line":1247},[1172,2506,2507],{},"  id                   integer primary key,\n",[1172,2509,2510],{"class":1174,"line":1252},[1172,2511,2512],{},"  public_id            text not null unique,        -- act_...\n",[1172,2514,2515],{"class":1174,"line":1257},[1172,2516,2517],{},"  connector_id         integer references connectors(id),\n",[1172,2519,2520],{"class":1174,"line":1263},[1172,2521,2522],{},"  name                 text unique not null,        -- record.request_documents\n",[1172,2524,2525],{"class":1174,"line":1269},[1172,2526,2527],{},"  risk                 text not null,               -- read|write_low|write_high|financial\n",[1172,2529,2530],{"class":1174,"line":1275},[1172,2531,2532],{},"  endpoint             text not null,               -- JSON\n",[1172,2534,2535],{"class":1174,"line":1281},[1172,2536,2537],{},"  args_schema          text not null,               -- JSON\n",[1172,2539,2540],{"class":1174,"line":1287},[1172,2541,2542],{},"  idempotency          text not null,               -- JSON\n",[1172,2544,2545],{"class":1174,"line":1293},[1172,2546,2547],{},"  response_fields      text,                        -- JSON\n",[1172,2549,2550],{"class":1174,"line":1298},[1172,2551,2552],{},"  redact_fields        text,                        -- JSON\n",[1172,2554,2555],{"class":1174,"line":1304},[1172,2556,2557],{},"  guardrails           text not null,               -- JSON\n",[1172,2559,2560],{"class":1174,"line":1309},[1172,2561,2562],{},"  replay               text not null,               -- safe|unsafe\n",[1172,2564,2565],{"class":1174,"line":1315},[1172,2566,2567],{},"  enabled              integer not null default 0,\n",[1172,2569,2570],{"class":1174,"line":1321},[1172,2571,2572],{},"  created_at           text not null,\n",[1172,2574,2575],{"class":1174,"line":1326},[1172,2576,2577],{},"  updated_at           text not null\n",[1172,2579,2580],{"class":1174,"line":1332},[1172,2581,1595],{},[1172,2583,2584],{"class":1174,"line":1338},[1172,2585,1215],{"emptyLinePlaceholder":1214},[1172,2587,2588],{"class":1174,"line":1344},[1172,2589,2590],{},"create table action_invocations (\n",[1172,2592,2593],{"class":1174,"line":1350},[1172,2594,1530],{},[1172,2596,2597],{"class":1174,"line":1355},[1172,2598,2599],{},"  public_id             text not null unique,       -- inv_...\n",[1172,2601,2602],{"class":1174,"line":1360},[1172,2603,2604],{},"  action_id             integer not null references actions(id),\n",[1172,2606,2607],{"class":1174,"line":1366},[1172,2608,2609],{},"  decision_id           integer references decisions(id),\n",[1172,2611,2612],{"class":1174,"line":1371},[1172,2613,2614],{},"  status                text not null,              -- proposed|approved|executing|succeeded|...\n",[1172,2616,2617],{"class":1174,"line":1377},[1172,2618,2619],{},"  args                  text not null,              -- JSON (context + model)\n",[1172,2621,2622],{"class":1174,"line":1383},[1172,2623,2624],{},"  idempotency_key       text not null,\n",[1172,2626,2627],{"class":1174,"line":1389},[1172,2628,2629],{},"  request_hash          text,\n",[1172,2631,2632],{"class":1174,"line":1395},[1172,2633,2634],{},"  response_hash         text,\n",[1172,2636,2637],{"class":1174,"line":1401},[1172,2638,2639],{},"  response_sanitized    text,                       -- JSON, hanya fields\n",[1172,2641,2642],{"class":1174,"line":1407},[1172,2643,2644],{},"  error                 text,\n",[1172,2646,2647],{"class":1174,"line":1412},[1172,2648,2649],{},"  actor_id              text,                       -- usr_... \u002F key_...\n",[1172,2651,2652],{"class":1174,"line":1418},[1172,2653,2654],{},"  reconciled_by         text,\n",[1172,2656,2657],{"class":1174,"line":1424},[1172,2658,2659],{},"  reconciled_at         text,\n",[1172,2661,2662],{"class":1174,"line":1430},[1172,2663,1585],{},[1172,2665,2666],{"class":1174,"line":1436},[1172,2667,1590],{},[1172,2669,2670],{"class":1174,"line":1442},[1172,2671,1595],{},[1172,2673,2674],{"class":1174,"line":1448},[1172,2675,2676],{},"create index invocations_status on action_invocations(status, created_at desc);\n",[1172,2678,2679],{"class":1174,"line":1453},[1172,2680,2681],{},"create unique index invocations_idem on action_invocations(idempotency_key);\n",[1172,2683,2684],{"class":1174,"line":1459},[1172,2685,1215],{"emptyLinePlaceholder":1214},[1172,2687,2688],{"class":1174,"line":1465},[1172,2689,2690],{},"create table credentials (\n",[1172,2692,2693],{"class":1174,"line":1471},[1172,2694,1672],{},[1172,2696,2697],{"class":1174,"line":1477},[1172,2698,2699],{},"  public_id       text not null unique,             -- crd_...\n",[1172,2701,2702],{"class":1174,"line":1483},[1172,2703,2704],{},"  kind            text not null,                    -- model|action\n",[1172,2706,2707],{"class":1174,"line":1489},[1172,2708,2709],{},"  provider        text not null,                    -- ext:anthropic|onprem:enterprise|connector\n",[1172,2711,2712],{"class":1174,"line":2404},[1172,2713,2714],{},"  ciphertext      text not null,                    -- envelope encryption\n",[1172,2716,2717],{"class":1174,"line":2410},[1172,2718,2719],{},"  kms_key_ref     text not null,\n",[1172,2721,2722],{"class":1174,"line":2416},[1172,2723,2724],{},"  metadata        text,                             -- JSON (last4, expiry)\n",[1172,2726,2727],{"class":1174,"line":2422},[1172,2728,2729],{},"  last_validated  text,\n",[1172,2731,2732],{"class":1174,"line":2428},[1172,2733,2734],{},"  valid           integer,\n",[1172,2736,2737],{"class":1174,"line":2434},[1172,2738,2739],{},"  revoked_at      text,\n",[1172,2741,2743],{"class":1174,"line":2742},62,[1172,2744,1853],{},[1172,2746,2748],{"class":1174,"line":2747},63,[1172,2749,1595],{},[164,2751,2752,2762,2763,2766],{},[16,2753,2754,2755,46,2758,2761],{},"Kredensial tidak pernah masuk ",[33,2756,2757],{},"agents.instructions",[33,2759,2760],{},"entries.content",", atau prompt.","\nKolom ",[33,2764,2765],{},"ciphertext"," hanya didekripsi di action-proxy\u002Fprovider-gateway.",[182,2768,2770],{"id":2769},"_46-approvals","4.6 Approvals",[248,2772,2774],{"className":1166,"code":2773,"language":1168,"meta":256,"style":256},"create table approvals (\n  id              integer primary key,\n  public_id       text not null unique,             -- apr_...\n  subject_type    text not null,                    -- decision|contract|assumption|projection|agent-mode|document|action-invocation\n  subject_id      text not null,                    -- public_id subjek (polymorphic)\n  state           text not null,                    -- pending|approved|rejected|expired\n  required_role   text not null,                    -- reviewer|approver|admin\n  requested_by    text not null,                    -- usr_... (manusia)\n  decided_by      text,\n  decided_at      text,\n  note            text,\n  conditions      text,                             -- JSON array\n  due_at          text,\n  created_at      text not null\n);\ncreate index approvals_pending on approvals(state, due_at);\ncreate index approvals_subject on approvals(subject_type, subject_id);\n",[33,2775,2776,2781,2785,2790,2795,2800,2805,2810,2815,2820,2825,2829,2834,2839,2843,2847,2852],{"__ignoreMap":256},[1172,2777,2778],{"class":1174,"line":1175},[1172,2779,2780],{},"create table approvals (\n",[1172,2782,2783],{"class":1174,"line":1181},[1172,2784,1672],{},[1172,2786,2787],{"class":1174,"line":1187},[1172,2788,2789],{},"  public_id       text not null unique,             -- apr_...\n",[1172,2791,2792],{"class":1174,"line":1193},[1172,2793,2794],{},"  subject_type    text not null,                    -- decision|contract|assumption|projection|agent-mode|document|action-invocation\n",[1172,2796,2797],{"class":1174,"line":1199},[1172,2798,2799],{},"  subject_id      text not null,                    -- public_id subjek (polymorphic)\n",[1172,2801,2802],{"class":1174,"line":1205},[1172,2803,2804],{},"  state           text not null,                    -- pending|approved|rejected|expired\n",[1172,2806,2807],{"class":1174,"line":1211},[1172,2808,2809],{},"  required_role   text not null,                    -- reviewer|approver|admin\n",[1172,2811,2812],{"class":1174,"line":1218},[1172,2813,2814],{},"  requested_by    text not null,                    -- usr_... (manusia)\n",[1172,2816,2817],{"class":1174,"line":1224},[1172,2818,2819],{},"  decided_by      text,\n",[1172,2821,2822],{"class":1174,"line":1229},[1172,2823,2824],{},"  decided_at      text,\n",[1172,2826,2827],{"class":1174,"line":1235},[1172,2828,2098],{},[1172,2830,2831],{"class":1174,"line":1241},[1172,2832,2833],{},"  conditions      text,                             -- JSON array\n",[1172,2835,2836],{"class":1174,"line":1247},[1172,2837,2838],{},"  due_at          text,\n",[1172,2840,2841],{"class":1174,"line":1252},[1172,2842,1853],{},[1172,2844,2845],{"class":1174,"line":1257},[1172,2846,1595],{},[1172,2848,2849],{"class":1174,"line":1263},[1172,2850,2851],{},"create index approvals_pending on approvals(state, due_at);\n",[1172,2853,2854],{"class":1174,"line":1269},[1172,2855,2856],{},"create index approvals_subject on approvals(subject_type, subject_id);\n",[164,2858,2859,2862,2863,2865,2866,2869,2870,2872],{},[33,2860,2861],{},"subject_id"," sengaja ",[33,2864,173],{}," karena subjeknya polymorphic. Jika perlu join, tambahkan\n",[33,2867,2868],{},"subject_internal_id integer"," nullable yang ",[16,2871,821],{}," diekspos.",[164,2874,2875,2876,2879,2880,2883,2884,2887,2888,2890],{},"Four-eyes: ",[33,2877,2878],{},"requested_by != decided_by",". Untuk ",[33,2881,2882],{},"financial",", minimal satu ",[33,2885,2886],{},"approver","\ndan satu ",[33,2889,2886],{}," kedua (lihat RBAC).",[182,2892,2894],{"id":2893},"_47-planning","4.7 Planning",[248,2896,2898],{"className":1166,"code":2897,"language":1168,"meta":256,"style":256},"create table assumptions (\n  driver_id       text not null,\n  version         text not null,\n  label           text not null,\n  value           real not null,\n  unit            text not null,\n  source_ref      text not null,                    -- wajib\n  confidence      real,\n  class           text not null,                    -- free|closing\n  elasticity      real,\n  impacted_lines  text,                             -- JSON\n  approved_by     text,\n  approved_at     text,\n  superseded_by   text,\n  created_at      text not null,\n  primary key (driver_id, version)\n);\n\ncreate table projections (\n  id                    integer primary key,\n  public_id             text not null unique,       -- prjn_...\n  as_of                 text not null,\n  horizon_years         integer not null,\n  assumption_version    text not null,\n  baseline_period       text not null,\n  statements            text not null,              -- JSON\n  ratios                text not null,              -- JSON\n  constraints           text not null,              -- JSON\n  narrative             text,\n  input_hash            text not null,\n  created_at            text not null\n);\n\ncreate table scenarios (\n  id              integer primary key,\n  public_id       text not null unique,             -- scn_...\n  projection_id   integer not null references projections(id),\n  name            text not null,                    -- base|optimis|stres-1\n  triggers        text not null,                    -- JSON\n  result          text not null,                    -- JSON\n  created_at      text not null\n);\n\ncreate table deviations (\n  id              integer primary key,\n  public_id       text not null unique,             -- dev_...\n  projection_id   integer not null references projections(id),\n  period          text not null,\n  line_id         text not null,\n  actual          real not null,\n  planned         real not null,\n  delta           real not null,\n  delta_percent   real,\n  material        integer not null,\n  explanation     text,\n  evidence        text\n);\n\ncreate table periods (\n  period          text primary key,                 -- YYYY-MM\n  closed_at       text\n);\n\ncreate table financials (\n  period          text not null,\n  coa_code        text not null,\n  amount          real not null,\n  statement       text not null,                    -- neraca|laba_rugi|komitmen_kontinjensi\n  primary key (period, coa_code)\n);\n",[33,2899,2900,2905,2910,2914,2919,2924,2929,2934,2939,2944,2949,2954,2959,2964,2969,2973,2978,2982,2986,2991,2995,3000,3005,3010,3015,3020,3025,3030,3035,3040,3045,3049,3053,3057,3062,3066,3071,3076,3081,3086,3091,3095,3099,3103,3108,3112,3117,3121,3126,3131,3136,3141,3146,3151,3156,3161,3166,3170,3174,3179,3184,3189,3193,3197,3203,3208,3214,3220,3226,3232],{"__ignoreMap":256},[1172,2901,2902],{"class":1174,"line":1175},[1172,2903,2904],{},"create table assumptions (\n",[1172,2906,2907],{"class":1174,"line":1181},[1172,2908,2909],{},"  driver_id       text not null,\n",[1172,2911,2912],{"class":1174,"line":1187},[1172,2913,1614],{},[1172,2915,2916],{"class":1174,"line":1193},[1172,2917,2918],{},"  label           text not null,\n",[1172,2920,2921],{"class":1174,"line":1199},[1172,2922,2923],{},"  value           real not null,\n",[1172,2925,2926],{"class":1174,"line":1205},[1172,2927,2928],{},"  unit            text not null,\n",[1172,2930,2931],{"class":1174,"line":1211},[1172,2932,2933],{},"  source_ref      text not null,                    -- wajib\n",[1172,2935,2936],{"class":1174,"line":1218},[1172,2937,2938],{},"  confidence      real,\n",[1172,2940,2941],{"class":1174,"line":1224},[1172,2942,2943],{},"  class           text not null,                    -- free|closing\n",[1172,2945,2946],{"class":1174,"line":1229},[1172,2947,2948],{},"  elasticity      real,\n",[1172,2950,2951],{"class":1174,"line":1235},[1172,2952,2953],{},"  impacted_lines  text,                             -- JSON\n",[1172,2955,2956],{"class":1174,"line":1241},[1172,2957,2958],{},"  approved_by     text,\n",[1172,2960,2961],{"class":1174,"line":1247},[1172,2962,2963],{},"  approved_at     text,\n",[1172,2965,2966],{"class":1174,"line":1252},[1172,2967,2968],{},"  superseded_by   text,\n",[1172,2970,2971],{"class":1174,"line":1257},[1172,2972,1634],{},[1172,2974,2975],{"class":1174,"line":1263},[1172,2976,2977],{},"  primary key (driver_id, version)\n",[1172,2979,2980],{"class":1174,"line":1269},[1172,2981,1595],{},[1172,2983,2984],{"class":1174,"line":1275},[1172,2985,1215],{"emptyLinePlaceholder":1214},[1172,2987,2988],{"class":1174,"line":1281},[1172,2989,2990],{},"create table projections (\n",[1172,2992,2993],{"class":1174,"line":1287},[1172,2994,1530],{},[1172,2996,2997],{"class":1174,"line":1293},[1172,2998,2999],{},"  public_id             text not null unique,       -- prjn_...\n",[1172,3001,3002],{"class":1174,"line":1298},[1172,3003,3004],{},"  as_of                 text not null,\n",[1172,3006,3007],{"class":1174,"line":1304},[1172,3008,3009],{},"  horizon_years         integer not null,\n",[1172,3011,3012],{"class":1174,"line":1309},[1172,3013,3014],{},"  assumption_version    text not null,\n",[1172,3016,3017],{"class":1174,"line":1315},[1172,3018,3019],{},"  baseline_period       text not null,\n",[1172,3021,3022],{"class":1174,"line":1321},[1172,3023,3024],{},"  statements            text not null,              -- JSON\n",[1172,3026,3027],{"class":1174,"line":1326},[1172,3028,3029],{},"  ratios                text not null,              -- JSON\n",[1172,3031,3032],{"class":1174,"line":1332},[1172,3033,3034],{},"  constraints           text not null,              -- JSON\n",[1172,3036,3037],{"class":1174,"line":1338},[1172,3038,3039],{},"  narrative             text,\n",[1172,3041,3042],{"class":1174,"line":1344},[1172,3043,3044],{},"  input_hash            text not null,\n",[1172,3046,3047],{"class":1174,"line":1350},[1172,3048,2378],{},[1172,3050,3051],{"class":1174,"line":1355},[1172,3052,1595],{},[1172,3054,3055],{"class":1174,"line":1360},[1172,3056,1215],{"emptyLinePlaceholder":1214},[1172,3058,3059],{"class":1174,"line":1366},[1172,3060,3061],{},"create table scenarios (\n",[1172,3063,3064],{"class":1174,"line":1371},[1172,3065,1672],{},[1172,3067,3068],{"class":1174,"line":1377},[1172,3069,3070],{},"  public_id       text not null unique,             -- scn_...\n",[1172,3072,3073],{"class":1174,"line":1383},[1172,3074,3075],{},"  projection_id   integer not null references projections(id),\n",[1172,3077,3078],{"class":1174,"line":1389},[1172,3079,3080],{},"  name            text not null,                    -- base|optimis|stres-1\n",[1172,3082,3083],{"class":1174,"line":1395},[1172,3084,3085],{},"  triggers        text not null,                    -- JSON\n",[1172,3087,3088],{"class":1174,"line":1401},[1172,3089,3090],{},"  result          text not null,                    -- JSON\n",[1172,3092,3093],{"class":1174,"line":1407},[1172,3094,1853],{},[1172,3096,3097],{"class":1174,"line":1412},[1172,3098,1595],{},[1172,3100,3101],{"class":1174,"line":1418},[1172,3102,1215],{"emptyLinePlaceholder":1214},[1172,3104,3105],{"class":1174,"line":1424},[1172,3106,3107],{},"create table deviations (\n",[1172,3109,3110],{"class":1174,"line":1430},[1172,3111,1672],{},[1172,3113,3114],{"class":1174,"line":1436},[1172,3115,3116],{},"  public_id       text not null unique,             -- dev_...\n",[1172,3118,3119],{"class":1174,"line":1442},[1172,3120,3075],{},[1172,3122,3123],{"class":1174,"line":1448},[1172,3124,3125],{},"  period          text not null,\n",[1172,3127,3128],{"class":1174,"line":1453},[1172,3129,3130],{},"  line_id         text not null,\n",[1172,3132,3133],{"class":1174,"line":1459},[1172,3134,3135],{},"  actual          real not null,\n",[1172,3137,3138],{"class":1174,"line":1465},[1172,3139,3140],{},"  planned         real not null,\n",[1172,3142,3143],{"class":1174,"line":1471},[1172,3144,3145],{},"  delta           real not null,\n",[1172,3147,3148],{"class":1174,"line":1477},[1172,3149,3150],{},"  delta_percent   real,\n",[1172,3152,3153],{"class":1174,"line":1483},[1172,3154,3155],{},"  material        integer not null,\n",[1172,3157,3158],{"class":1174,"line":1489},[1172,3159,3160],{},"  explanation     text,\n",[1172,3162,3163],{"class":1174,"line":2404},[1172,3164,3165],{},"  evidence        text\n",[1172,3167,3168],{"class":1174,"line":2410},[1172,3169,1595],{},[1172,3171,3172],{"class":1174,"line":2416},[1172,3173,1215],{"emptyLinePlaceholder":1214},[1172,3175,3176],{"class":1174,"line":2422},[1172,3177,3178],{},"create table periods (\n",[1172,3180,3181],{"class":1174,"line":2428},[1172,3182,3183],{},"  period          text primary key,                 -- YYYY-MM\n",[1172,3185,3186],{"class":1174,"line":2434},[1172,3187,3188],{},"  closed_at       text\n",[1172,3190,3191],{"class":1174,"line":2742},[1172,3192,1595],{},[1172,3194,3195],{"class":1174,"line":2747},[1172,3196,1215],{"emptyLinePlaceholder":1214},[1172,3198,3200],{"class":1174,"line":3199},64,[1172,3201,3202],{},"create table financials (\n",[1172,3204,3206],{"class":1174,"line":3205},65,[1172,3207,3125],{},[1172,3209,3211],{"class":1174,"line":3210},66,[1172,3212,3213],{},"  coa_code        text not null,\n",[1172,3215,3217],{"class":1174,"line":3216},67,[1172,3218,3219],{},"  amount          real not null,\n",[1172,3221,3223],{"class":1174,"line":3222},68,[1172,3224,3225],{},"  statement       text not null,                    -- neraca|laba_rugi|komitmen_kontinjensi\n",[1172,3227,3229],{"class":1174,"line":3228},69,[1172,3230,3231],{},"  primary key (period, coa_code)\n",[1172,3233,3235],{"class":1174,"line":3234},70,[1172,3236,1595],{},[182,3238,3240],{"id":3239},"_48-evals-documents-jobs-usage","4.8 Evals, documents, jobs, usage",[248,3242,3244],{"className":1166,"code":3243,"language":1168,"meta":256,"style":256},"create table evals (\n  id              integer primary key,\n  public_id       text not null unique,             -- evl_...\n  type            text not null,\n  status          text not null,\n  dataset_id      integer references datasets(id),\n  agent_id        integer references agents(id),\n  metrics         text,                             -- JSON\n  breakdown       text,                             -- JSON\n  sample_size     integer,\n  created_at      text not null\n);\n\ncreate table documents (\n  id              integer primary key,\n  public_id       text not null unique,             -- doc_...\n  template        text not null,\n  format          text not null,                    -- pdf|docx|xlsx\n  status          text not null,\n  object_key      text,\n  checksum        text,\n  created_at      text not null\n);\n\ncreate table document_corrections (\n  id              integer primary key,\n  public_id       text not null unique,             -- cor_...\n  document_id     integer not null references documents(id),\n  field           text not null,\n  original_value  text,\n  corrected_value text not null,\n  reason          text,\n  actor_id        text not null,\n  created_at      text not null\n);\n\ncreate table jobs (\n  id              integer primary key,\n  public_id       text not null unique,             -- job_...\n  type            text not null,                    -- backfill|eval|render|projection|...\n  status          text not null,                    -- queued|running|paused|completed|failed|canceled\n  progress        real not null default 0,\n  checkpoint      text,                             -- JSON\n  result          text,                             -- JSON\n  error           text,                             -- Problem JSON\n  created_at      text not null,\n  updated_at      text not null\n);\ncreate index jobs_status on jobs(status, created_at desc);\n\ncreate table usage_counters (\n  period          text not null,                    -- YYYY-MM\n  agent_id        integer not null,\n  model           text not null,                    -- 'none' untuk non-model\n  input_tokens    integer not null default 0,\n  output_tokens   integer not null default 0,\n  usd             real not null default 0,\n  decisions       integer not null default 0,\n  primary key (period, agent_id, model)\n);\n",[33,3245,3246,3251,3255,3260,3265,3269,3274,3279,3284,3289,3294,3298,3302,3306,3311,3315,3320,3325,3330,3334,3339,3344,3348,3352,3356,3361,3365,3370,3375,3380,3385,3390,3395,3400,3404,3408,3412,3417,3421,3426,3431,3436,3441,3446,3451,3456,3460,3464,3468,3473,3477,3482,3487,3492,3497,3502,3507,3512,3517,3522],{"__ignoreMap":256},[1172,3247,3248],{"class":1174,"line":1175},[1172,3249,3250],{},"create table evals (\n",[1172,3252,3253],{"class":1174,"line":1181},[1172,3254,1672],{},[1172,3256,3257],{"class":1174,"line":1187},[1172,3258,3259],{},"  public_id       text not null unique,             -- evl_...\n",[1172,3261,3262],{"class":1174,"line":1193},[1172,3263,3264],{},"  type            text not null,\n",[1172,3266,3267],{"class":1174,"line":1199},[1172,3268,2166],{},[1172,3270,3271],{"class":1174,"line":1205},[1172,3272,3273],{},"  dataset_id      integer references datasets(id),\n",[1172,3275,3276],{"class":1174,"line":1211},[1172,3277,3278],{},"  agent_id        integer references agents(id),\n",[1172,3280,3281],{"class":1174,"line":1218},[1172,3282,3283],{},"  metrics         text,                             -- JSON\n",[1172,3285,3286],{"class":1174,"line":1224},[1172,3287,3288],{},"  breakdown       text,                             -- JSON\n",[1172,3290,3291],{"class":1174,"line":1229},[1172,3292,3293],{},"  sample_size     integer,\n",[1172,3295,3296],{"class":1174,"line":1235},[1172,3297,1853],{},[1172,3299,3300],{"class":1174,"line":1241},[1172,3301,1595],{},[1172,3303,3304],{"class":1174,"line":1247},[1172,3305,1215],{"emptyLinePlaceholder":1214},[1172,3307,3308],{"class":1174,"line":1252},[1172,3309,3310],{},"create table documents (\n",[1172,3312,3313],{"class":1174,"line":1257},[1172,3314,1672],{},[1172,3316,3317],{"class":1174,"line":1263},[1172,3318,3319],{},"  public_id       text not null unique,             -- doc_...\n",[1172,3321,3322],{"class":1174,"line":1269},[1172,3323,3324],{},"  template        text not null,\n",[1172,3326,3327],{"class":1174,"line":1275},[1172,3328,3329],{},"  format          text not null,                    -- pdf|docx|xlsx\n",[1172,3331,3332],{"class":1174,"line":1281},[1172,3333,2166],{},[1172,3335,3336],{"class":1174,"line":1287},[1172,3337,3338],{},"  object_key      text,\n",[1172,3340,3341],{"class":1174,"line":1293},[1172,3342,3343],{},"  checksum        text,\n",[1172,3345,3346],{"class":1174,"line":1298},[1172,3347,1853],{},[1172,3349,3350],{"class":1174,"line":1304},[1172,3351,1595],{},[1172,3353,3354],{"class":1174,"line":1309},[1172,3355,1215],{"emptyLinePlaceholder":1214},[1172,3357,3358],{"class":1174,"line":1315},[1172,3359,3360],{},"create table document_corrections (\n",[1172,3362,3363],{"class":1174,"line":1321},[1172,3364,1672],{},[1172,3366,3367],{"class":1174,"line":1326},[1172,3368,3369],{},"  public_id       text not null unique,             -- cor_...\n",[1172,3371,3372],{"class":1174,"line":1332},[1172,3373,3374],{},"  document_id     integer not null references documents(id),\n",[1172,3376,3377],{"class":1174,"line":1338},[1172,3378,3379],{},"  field           text not null,\n",[1172,3381,3382],{"class":1174,"line":1344},[1172,3383,3384],{},"  original_value  text,\n",[1172,3386,3387],{"class":1174,"line":1350},[1172,3388,3389],{},"  corrected_value text not null,\n",[1172,3391,3392],{"class":1174,"line":1355},[1172,3393,3394],{},"  reason          text,\n",[1172,3396,3397],{"class":1174,"line":1360},[1172,3398,3399],{},"  actor_id        text not null,\n",[1172,3401,3402],{"class":1174,"line":1366},[1172,3403,1853],{},[1172,3405,3406],{"class":1174,"line":1371},[1172,3407,1595],{},[1172,3409,3410],{"class":1174,"line":1377},[1172,3411,1215],{"emptyLinePlaceholder":1214},[1172,3413,3414],{"class":1174,"line":1383},[1172,3415,3416],{},"create table jobs (\n",[1172,3418,3419],{"class":1174,"line":1389},[1172,3420,1672],{},[1172,3422,3423],{"class":1174,"line":1395},[1172,3424,3425],{},"  public_id       text not null unique,             -- job_...\n",[1172,3427,3428],{"class":1174,"line":1401},[1172,3429,3430],{},"  type            text not null,                    -- backfill|eval|render|projection|...\n",[1172,3432,3433],{"class":1174,"line":1407},[1172,3434,3435],{},"  status          text not null,                    -- queued|running|paused|completed|failed|canceled\n",[1172,3437,3438],{"class":1174,"line":1412},[1172,3439,3440],{},"  progress        real not null default 0,\n",[1172,3442,3443],{"class":1174,"line":1418},[1172,3444,3445],{},"  checkpoint      text,                             -- JSON\n",[1172,3447,3448],{"class":1174,"line":1424},[1172,3449,3450],{},"  result          text,                             -- JSON\n",[1172,3452,3453],{"class":1174,"line":1430},[1172,3454,3455],{},"  error           text,                             -- Problem JSON\n",[1172,3457,3458],{"class":1174,"line":1436},[1172,3459,1634],{},[1172,3461,3462],{"class":1174,"line":1442},[1172,3463,1720],{},[1172,3465,3466],{"class":1174,"line":1448},[1172,3467,1595],{},[1172,3469,3470],{"class":1174,"line":1453},[1172,3471,3472],{},"create index jobs_status on jobs(status, created_at desc);\n",[1172,3474,3475],{"class":1174,"line":1459},[1172,3476,1215],{"emptyLinePlaceholder":1214},[1172,3478,3479],{"class":1174,"line":1465},[1172,3480,3481],{},"create table usage_counters (\n",[1172,3483,3484],{"class":1174,"line":1471},[1172,3485,3486],{},"  period          text not null,                    -- YYYY-MM\n",[1172,3488,3489],{"class":1174,"line":1477},[1172,3490,3491],{},"  agent_id        integer not null,\n",[1172,3493,3494],{"class":1174,"line":1483},[1172,3495,3496],{},"  model           text not null,                    -- 'none' untuk non-model\n",[1172,3498,3499],{"class":1174,"line":1489},[1172,3500,3501],{},"  input_tokens    integer not null default 0,\n",[1172,3503,3504],{"class":1174,"line":2404},[1172,3505,3506],{},"  output_tokens   integer not null default 0,\n",[1172,3508,3509],{"class":1174,"line":2410},[1172,3510,3511],{},"  usd             real not null default 0,\n",[1172,3513,3514],{"class":1174,"line":2416},[1172,3515,3516],{},"  decisions       integer not null default 0,\n",[1172,3518,3519],{"class":1174,"line":2422},[1172,3520,3521],{},"  primary key (period, agent_id, model)\n",[1172,3523,3524],{"class":1174,"line":2428},[1172,3525,1595],{},[164,3527,3528,3530,3531,3534],{},[33,3529,897],{}," adalah satu-satunya sumber budget. Ditulis dalam transaksi yang sama\ndengan keputusan (single writer = akurat). ",[33,3532,3533],{},"agent_id"," internal; API menampilkan slug.",[182,3536,3538],{"id":3537},"_49-idempotency-audit-outbox-webhook","4.9 Idempotency, audit outbox, webhook",[248,3540,3542],{"className":1166,"code":3541,"language":1168,"meta":256,"style":256},"create table idempotency_keys (\n  key             text primary key,\n  request_hash    text not null,\n  response_status integer,\n  response_body   text,\n  resource_public_id text,\n  expires_at      text not null,\n  created_at      text not null\n);\ncreate index idempotency_expiry on idempotency_keys(expires_at);\n\ncreate table audit_outbox (\n  id              integer primary key,\n  public_id       text not null unique,             -- aud_...\n  type            text not null,\n  actor           text not null,                    -- usr_... \u002F key_...\n  actor_type      text not null,                    -- user|key (atribusi saja)\n  subject_id      text,                             -- public_id\n  payload_hash    text not null,\n  prev_hash       text,\n  hash            text not null,\n  at              text not null,\n  delivered_at    text\n);\ncreate index audit_outbox_undelivered on audit_outbox(delivered_at) where delivered_at is null;\n\ncreate table webhook_endpoints (\n  id              integer primary key,\n  public_id       text not null unique,             -- whk_...\n  url             text not null,\n  secret_cipher   text not null,\n  events          text not null,                    -- JSON\n  status          text not null,\n  created_at      text not null\n);\n\ncreate table webhook_deliveries (\n  id              integer primary key,\n  public_id       text not null unique,             -- whd_...\n  endpoint_id     integer not null references webhook_endpoints(id),\n  event           text not null,\n  status          text not null,                    -- pending|delivered|failed|dropped\n  attempts        integer not null default 0,\n  response_code   integer,\n  next_attempt_at text,\n  idempotency_key text not null unique,\n  created_at      text not null\n);\n",[33,3543,3544,3549,3554,3559,3564,3569,3574,3579,3583,3587,3592,3596,3601,3605,3610,3614,3619,3624,3629,3634,3639,3644,3649,3654,3658,3663,3667,3672,3676,3681,3686,3691,3696,3700,3704,3708,3712,3717,3721,3726,3731,3736,3741,3746,3751,3756,3761,3765],{"__ignoreMap":256},[1172,3545,3546],{"class":1174,"line":1175},[1172,3547,3548],{},"create table idempotency_keys (\n",[1172,3550,3551],{"class":1174,"line":1181},[1172,3552,3553],{},"  key             text primary key,\n",[1172,3555,3556],{"class":1174,"line":1187},[1172,3557,3558],{},"  request_hash    text not null,\n",[1172,3560,3561],{"class":1174,"line":1193},[1172,3562,3563],{},"  response_status integer,\n",[1172,3565,3566],{"class":1174,"line":1199},[1172,3567,3568],{},"  response_body   text,\n",[1172,3570,3571],{"class":1174,"line":1205},[1172,3572,3573],{},"  resource_public_id text,\n",[1172,3575,3576],{"class":1174,"line":1211},[1172,3577,3578],{},"  expires_at      text not null,\n",[1172,3580,3581],{"class":1174,"line":1218},[1172,3582,1853],{},[1172,3584,3585],{"class":1174,"line":1224},[1172,3586,1595],{},[1172,3588,3589],{"class":1174,"line":1229},[1172,3590,3591],{},"create index idempotency_expiry on idempotency_keys(expires_at);\n",[1172,3593,3594],{"class":1174,"line":1235},[1172,3595,1215],{"emptyLinePlaceholder":1214},[1172,3597,3598],{"class":1174,"line":1241},[1172,3599,3600],{},"create table audit_outbox (\n",[1172,3602,3603],{"class":1174,"line":1247},[1172,3604,1672],{},[1172,3606,3607],{"class":1174,"line":1252},[1172,3608,3609],{},"  public_id       text not null unique,             -- aud_...\n",[1172,3611,3612],{"class":1174,"line":1257},[1172,3613,3264],{},[1172,3615,3616],{"class":1174,"line":1263},[1172,3617,3618],{},"  actor           text not null,                    -- usr_... \u002F key_...\n",[1172,3620,3621],{"class":1174,"line":1269},[1172,3622,3623],{},"  actor_type      text not null,                    -- user|key (atribusi saja)\n",[1172,3625,3626],{"class":1174,"line":1275},[1172,3627,3628],{},"  subject_id      text,                             -- public_id\n",[1172,3630,3631],{"class":1174,"line":1281},[1172,3632,3633],{},"  payload_hash    text not null,\n",[1172,3635,3636],{"class":1174,"line":1287},[1172,3637,3638],{},"  prev_hash       text,\n",[1172,3640,3641],{"class":1174,"line":1293},[1172,3642,3643],{},"  hash            text not null,\n",[1172,3645,3646],{"class":1174,"line":1298},[1172,3647,3648],{},"  at              text not null,\n",[1172,3650,3651],{"class":1174,"line":1304},[1172,3652,3653],{},"  delivered_at    text\n",[1172,3655,3656],{"class":1174,"line":1309},[1172,3657,1595],{},[1172,3659,3660],{"class":1174,"line":1315},[1172,3661,3662],{},"create index audit_outbox_undelivered on audit_outbox(delivered_at) where delivered_at is null;\n",[1172,3664,3665],{"class":1174,"line":1321},[1172,3666,1215],{"emptyLinePlaceholder":1214},[1172,3668,3669],{"class":1174,"line":1326},[1172,3670,3671],{},"create table webhook_endpoints (\n",[1172,3673,3674],{"class":1174,"line":1332},[1172,3675,1672],{},[1172,3677,3678],{"class":1174,"line":1338},[1172,3679,3680],{},"  public_id       text not null unique,             -- whk_...\n",[1172,3682,3683],{"class":1174,"line":1344},[1172,3684,3685],{},"  url             text not null,\n",[1172,3687,3688],{"class":1174,"line":1350},[1172,3689,3690],{},"  secret_cipher   text not null,\n",[1172,3692,3693],{"class":1174,"line":1355},[1172,3694,3695],{},"  events          text not null,                    -- JSON\n",[1172,3697,3698],{"class":1174,"line":1360},[1172,3699,2166],{},[1172,3701,3702],{"class":1174,"line":1366},[1172,3703,1853],{},[1172,3705,3706],{"class":1174,"line":1371},[1172,3707,1595],{},[1172,3709,3710],{"class":1174,"line":1377},[1172,3711,1215],{"emptyLinePlaceholder":1214},[1172,3713,3714],{"class":1174,"line":1383},[1172,3715,3716],{},"create table webhook_deliveries (\n",[1172,3718,3719],{"class":1174,"line":1389},[1172,3720,1672],{},[1172,3722,3723],{"class":1174,"line":1395},[1172,3724,3725],{},"  public_id       text not null unique,             -- whd_...\n",[1172,3727,3728],{"class":1174,"line":1401},[1172,3729,3730],{},"  endpoint_id     integer not null references webhook_endpoints(id),\n",[1172,3732,3733],{"class":1174,"line":1407},[1172,3734,3735],{},"  event           text not null,\n",[1172,3737,3738],{"class":1174,"line":1412},[1172,3739,3740],{},"  status          text not null,                    -- pending|delivered|failed|dropped\n",[1172,3742,3743],{"class":1174,"line":1418},[1172,3744,3745],{},"  attempts        integer not null default 0,\n",[1172,3747,3748],{"class":1174,"line":1424},[1172,3749,3750],{},"  response_code   integer,\n",[1172,3752,3753],{"class":1174,"line":1430},[1172,3754,3755],{},"  next_attempt_at text,\n",[1172,3757,3758],{"class":1174,"line":1436},[1172,3759,3760],{},"  idempotency_key text not null unique,\n",[1172,3762,3763],{"class":1174,"line":1442},[1172,3764,1853],{},[1172,3766,3767],{"class":1174,"line":1448},[1172,3768,1595],{},[164,3770,166,3771,3780],{},[16,3772,3773,3774,775,3777,3779],{},"mutasi domain + ",[33,3775,3776],{},"audit_outbox",[33,3778,897],{}," dalam satu transaksi.","\nJika salah satu gagal, transaksi rollback. Pengiriman ke WORM dilakukan async oleh worker.",[182,3782,3784],{"id":3783},"_410-settings","4.10 Settings",[248,3786,3788],{"className":1166,"code":3787,"language":1168,"meta":256,"style":256},"create table project_settings (\n  key             text primary key,\n  value           text not null,\n  updated_at      text not null\n);\n-- keys: budget_limit_usd, plan, retention_days, residency, model_funding, ...\n",[33,3789,3790,3795,3799,3804,3808,3812],{"__ignoreMap":256},[1172,3791,3792],{"class":1174,"line":1175},[1172,3793,3794],{},"create table project_settings (\n",[1172,3796,3797],{"class":1174,"line":1181},[1172,3798,3553],{},[1172,3800,3801],{"class":1174,"line":1187},[1172,3802,3803],{},"  value           text not null,\n",[1172,3805,3806],{"class":1174,"line":1193},[1172,3807,1720],{},[1172,3809,3810],{"class":1174,"line":1199},[1172,3811,1595],{},[1172,3813,3814],{"class":1174,"line":1205},[1172,3815,3816],{},"-- keys: budget_limit_usd, plan, retention_days, residency, model_funding, ...\n",[164,3818,3819,3820],{},"Entitlement disinkronkan dari billing via webhook, disimpan di cell. ",[16,3821,3822],{},"Jalur kritis tidak\npernah memanggil vendor billing.",[55,3824],{},[58,3826,3828],{"id":3827},"_5-feed-cell","5. Feed cell",[248,3830,3832],{"className":1166,"code":3831,"language":1168,"meta":256,"style":256},"create table signals (\n  id              integer primary key,\n  public_id       text not null unique,             -- sig_...\n  topic           text not null,\n  at              text not null,\n  summary         text not null,\n  source          text not null,                    -- URI wajib\n  confidence      real,\n  entities        text,                             -- JSON\n  drivers         text,                             -- JSON\n  content_hash    text not null\n);\ncreate index signals_topic_time on signals(topic, at desc);\ncreate unique index signals_dedup on signals(content_hash);\n\ncreate table subscriptions (\n  id              integer primary key,\n  public_id       text not null unique,             -- wsub_...\n  topics          text not null,                    -- JSON\n  webhook_url     text,\n  filters         text,\n  created_at      text not null\n);\n\ncreate table cursors (\n  subscription_id integer primary key references subscriptions(id),\n  cursor          text not null,\n  updated_at      text not null\n);\n",[33,3833,3834,3839,3843,3848,3853,3857,3862,3867,3871,3876,3881,3886,3890,3895,3900,3904,3909,3913,3918,3923,3928,3933,3937,3941,3945,3950,3955,3960,3964],{"__ignoreMap":256},[1172,3835,3836],{"class":1174,"line":1175},[1172,3837,3838],{},"create table signals (\n",[1172,3840,3841],{"class":1174,"line":1181},[1172,3842,1672],{},[1172,3844,3845],{"class":1174,"line":1187},[1172,3846,3847],{},"  public_id       text not null unique,             -- sig_...\n",[1172,3849,3850],{"class":1174,"line":1193},[1172,3851,3852],{},"  topic           text not null,\n",[1172,3854,3855],{"class":1174,"line":1199},[1172,3856,3648],{},[1172,3858,3859],{"class":1174,"line":1205},[1172,3860,3861],{},"  summary         text not null,\n",[1172,3863,3864],{"class":1174,"line":1211},[1172,3865,3866],{},"  source          text not null,                    -- URI wajib\n",[1172,3868,3869],{"class":1174,"line":1218},[1172,3870,2938],{},[1172,3872,3873],{"class":1174,"line":1224},[1172,3874,3875],{},"  entities        text,                             -- JSON\n",[1172,3877,3878],{"class":1174,"line":1229},[1172,3879,3880],{},"  drivers         text,                             -- JSON\n",[1172,3882,3883],{"class":1174,"line":1235},[1172,3884,3885],{},"  content_hash    text not null\n",[1172,3887,3888],{"class":1174,"line":1241},[1172,3889,1595],{},[1172,3891,3892],{"class":1174,"line":1247},[1172,3893,3894],{},"create index signals_topic_time on signals(topic, at desc);\n",[1172,3896,3897],{"class":1174,"line":1252},[1172,3898,3899],{},"create unique index signals_dedup on signals(content_hash);\n",[1172,3901,3902],{"class":1174,"line":1257},[1172,3903,1215],{"emptyLinePlaceholder":1214},[1172,3905,3906],{"class":1174,"line":1263},[1172,3907,3908],{},"create table subscriptions (\n",[1172,3910,3911],{"class":1174,"line":1269},[1172,3912,1672],{},[1172,3914,3915],{"class":1174,"line":1275},[1172,3916,3917],{},"  public_id       text not null unique,             -- wsub_...\n",[1172,3919,3920],{"class":1174,"line":1281},[1172,3921,3922],{},"  topics          text not null,                    -- JSON\n",[1172,3924,3925],{"class":1174,"line":1287},[1172,3926,3927],{},"  webhook_url     text,\n",[1172,3929,3930],{"class":1174,"line":1293},[1172,3931,3932],{},"  filters         text,\n",[1172,3934,3935],{"class":1174,"line":1298},[1172,3936,1853],{},[1172,3938,3939],{"class":1174,"line":1304},[1172,3940,1595],{},[1172,3942,3943],{"class":1174,"line":1309},[1172,3944,1215],{"emptyLinePlaceholder":1214},[1172,3946,3947],{"class":1174,"line":1315},[1172,3948,3949],{},"create table cursors (\n",[1172,3951,3952],{"class":1174,"line":1321},[1172,3953,3954],{},"  subscription_id integer primary key references subscriptions(id),\n",[1172,3956,3957],{"class":1174,"line":1326},[1172,3958,3959],{},"  cursor          text not null,\n",[1172,3961,3962],{"class":1174,"line":1332},[1172,3963,1720],{},[1172,3965,3966],{"class":1174,"line":1338},[1172,3967,1595],{},[164,3969,3970],{},"Feed cell append-only. Tidak ada update\u002Fdelete signal kecuali retensi (hapus partisi lama).",[55,3972],{},[58,3974,3976],{"id":3975},"_6-object-storage-layout","6. Object storage layout",[248,3978,3981],{"className":3979,"code":3980,"language":253},[251],"s3:\u002F\u002Fagnestra-\u003Cregion>\u002F\n  projects\u002F\u003CprojectPublicId>\u002F\n    datasets\u002F\u003CdatasetPublicId>\u002Fraw\u002F\u003Cfile>\n    datasets\u002F\u003CdatasetPublicId>\u002Fembeddings\u002F\u003Cshard>.bin\n    documents\u002F\u003CdocumentPublicId>\u002F\u003Cfile>.pdf\n    exports\u002F\u003CexportPublicId>.zip\n    snapshots\u002F\u003Ctimestamp>.sqlite\n  audit\u002F\u003CprojectPublicId>\u002F\u003Cyyyy>\u002F\u003Cmm>\u002F\u003CauditPublicId>.json\n  audit\u002F\u003CprojectPublicId>\u002Fchain\u002F\u003CauditPublicId>.proof\n  feeds\u002F\u003Ctopic>\u002F\u003Cyyyy>\u002F\u003Cmm>\u002F\u003CsignalPublicId>.json\n",[33,3982,3980],{"__ignoreMap":256},[164,3984,3985],{},"Bucket policy:",[10,3987,3988,3991,3994,3997],{},[13,3989,3990],{},"Project hanya bisa mengakses prefix-nya (presigned URL).",[13,3992,3993],{},"Audit prefix: Object Lock COMPLIANCE, retensi per tier.",[13,3995,3996],{},"Snapshot read-only untuk analytics loader.",[13,3998,3999],{},[16,4000,4001,4002,174],{},"Tidak ada object key yang memakai internal ",[33,4003,212],{},[55,4005],{},[58,4007,4009],{"id":4008},"_7-invariant-constraint","7. Invariant & constraint",[63,4011,4012,4025],{},[66,4013,4014],{},[69,4015,4016,4019,4022],{},[72,4017,4018],{},"#",[72,4020,4021],{},"Invariant",[72,4023,4024],{},"Penegakan",[82,4026,4027,4038,4052,4065,4078,4089,4100,4114,4125,4136,4150,4161,4171,4182],{},[69,4028,4029,4032,4035],{},[87,4030,4031],{},"1",[87,4033,4034],{},"Satu project = satu cell",[87,4036,4037],{},"Registry + nama cell unique",[69,4039,4040,4043,4049],{},[87,4041,4042],{},"2",[87,4044,4045,4046],{},"Tidak ada ",[33,4047,4048],{},"tenant_id",[87,4050,4051],{},"Review schema + test",[69,4053,4054,4057,4062],{},[87,4055,4056],{},"3",[87,4058,1012,4059,4061],{},[33,4060,212],{}," tidak pernah keluar",[87,4063,4064],{},"Serializer whitelist + test",[69,4066,4067,4070,4075],{},[87,4068,4069],{},"4",[87,4071,4072,4074],{},[33,4073,173],{}," unik per tabel",[87,4076,4077],{},"Unique index",[69,4079,4080,4083,4086],{},[87,4081,4082],{},"5",[87,4084,4085],{},"Prefix sesuai registry",[87,4087,4088],{},"Validator + CI",[69,4090,4091,4094,4097],{},[87,4092,4093],{},"6",[87,4095,4096],{},"Decision final immutable",[87,4098,4099],{},"Trigger\u002Fguard di repository",[69,4101,4102,4105,4108],{},[87,4103,4104],{},"7",[87,4106,4107],{},"Audit outbox dalam transaksi",[87,4109,4110,4111],{},"Satu ",[33,4112,4113],{},"db.batch",[69,4115,4116,4119,4122],{},[87,4117,4118],{},"8",[87,4120,4121],{},"Budget akurat",[87,4123,4124],{},"Single writer + counter",[69,4126,4127,4130,4133],{},[87,4128,4129],{},"9",[87,4131,4132],{},"Kredensial tidak di plaintext",[87,4134,4135],{},"Enkripsi + akses hanya proxy",[69,4137,4138,4141,4144],{},[87,4139,4140],{},"10",[87,4142,4143],{},"Evidence milik project",[87,4145,4146,4147,4149],{},"Resolusi ",[33,4148,173],{}," sebelum simpan",[69,4151,4152,4155,4158],{},[87,4153,4154],{},"11",[87,4156,4157],{},"Contract version immutable",[87,4159,4160],{},"Insert-only",[69,4162,4163,4166,4169],{},[87,4164,4165],{},"12",[87,4167,4168],{},"Idempotency key unik per project",[87,4170,4077],{},[69,4172,4173,4176,4179],{},[87,4174,4175],{},"13",[87,4177,4178],{},"Soft delete + erasure async",[87,4180,4181],{},"Status + job",[69,4183,4184,4187,4192],{},[87,4185,4186],{},"14",[87,4188,4189,4190],{},"Foreign key memakai internal ",[33,4191,212],{},[87,4193,4194],{},"Schema review",[55,4196],{},[58,4198,4200],{"id":4199},"_8-migrasi","8. Migrasi",[10,4202,4203,4210,4221,4224,4231,4234,4241],{},[13,4204,4205,4206,4209],{},"Drizzle Kit menghasilkan SQL; dijalankan di ",[33,4207,4208],{},"blockConcurrencyWhile"," saat cell start.",[13,4211,4212,4213,4216,4217,4220],{},"Migrasi harus ",[16,4214,4215],{},"idempoten"," dan ",[16,4218,4219],{},"maju saja"," (tidak ada down migration di produksi).",[13,4222,4223],{},"Migrasi berat (backfill kolom) dipisah ke Job, bukan di jalur start.",[13,4225,4226,4227,4230],{},"Setiap migrasi punya test di ",[33,4228,4229],{},"@cloudflare\u002Fvitest-pool-workers"," dengan data seed.",[13,4232,4233],{},"Fallback raw SQL hanya untuk migrasi kritis yang didukung Drizzle belum stabil.",[13,4235,4236,4237,4240],{},"Sebelum deploy: ",[33,4238,4239],{},"wrangler deploy --dry-run"," + migrasi di staging.",[13,4242,4243,4244,4246,4247,4250,4251,4253],{},"Penambahan ",[33,4245,173],{}," pada tabel lama: buat kolom nullable → isi → unique index →\njadikan ",[33,4248,4249],{},"NOT NULL","; jangan pernah mengubah ",[33,4252,173],{}," setelah dipublikasikan.",[55,4255],{},[58,4257,4259],{"id":4258},"_9-retensi-erasure","9. Retensi & erasure",[63,4261,4262,4274],{},[66,4263,4264],{},[69,4265,4266,4269,4272],{},[72,4267,4268],{},"Data",[72,4270,4271],{},"Retensi default",[72,4273,361],{},[82,4275,4276,4287,4298,4308,4318,4328,4337],{},[69,4277,4278,4281,4284],{},[87,4279,4280],{},"Decision trace",[87,4282,4283],{},"sesuai tier (7 hari–7 tahun)",[87,4285,4286],{},"WORM untuk Enterprise",[69,4288,4289,4292,4295],{},[87,4290,4291],{},"Audit ledger",[87,4293,4294],{},"sesuai tier",[87,4296,4297],{},"Object Lock tidak bisa dihapus sebelum retainUntil",[69,4299,4300,4303,4306],{},[87,4301,4302],{},"Dataset mentah",[87,4304,4305],{},"sampai dihapus project",[87,4307],{},[69,4309,4310,4313,4316],{},[87,4311,4312],{},"Session\u002Fentry",[87,4314,4315],{},"90 hari idle",[87,4317],{},[69,4319,4320,4323,4326],{},[87,4321,4322],{},"Idempotency key",[87,4324,4325],{},"24 jam",[87,4327],{},[69,4329,4330,4332,4335],{},[87,4331,684],{},[87,4333,4334],{},"30 hari",[87,4336],{},[69,4338,4339,4342,4345],{},[87,4340,4341],{},"Feed signal",[87,4343,4344],{},"30–365 hari per topik",[87,4346],{},[164,4348,4349],{},"Erasure:",[248,4351,4354],{"className":4352,"code":4353,"language":253},[251],"DELETE \u002F_ops\u002Ferasure\u002F{publicId} → Job\n  → soft delete (status=deleting)\n  → hapus objek non-WORM\n  → WORM tetap sampai retainUntil (catatan hukum)\n  → tulis audit proof penghapusan\n  → hard delete metadata\n",[33,4355,4353],{"__ignoreMap":256},[164,4357,4358,4359,4361,4362,4364],{},"Erasure menghapus child rows berdasarkan internal ",[33,4360,212],{},"; ",[33,4363,173],{}," dicatat di audit proof\nsebelum dihapus.",[4366,4367,4368],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":256,"searchDepth":1187,"depth":1187,"links":4370},[4371,4372,4381,4382,4394,4395,4396,4397,4398],{"id":60,"depth":1181,"text":61},{"id":179,"depth":1181,"text":180,"children":4373},[4374,4375,4376,4377,4378,4379,4380],{"id":184,"depth":1187,"text":185},{"id":268,"depth":1187,"text":269},{"id":345,"depth":1187,"text":346},{"id":814,"depth":1187,"text":815},{"id":1000,"depth":1187,"text":1001},{"id":1082,"depth":1187,"text":1083},{"id":1121,"depth":1187,"text":1122},{"id":1162,"depth":1181,"text":1163},{"id":1510,"depth":1181,"text":1511,"children":4383},[4384,4385,4386,4387,4388,4389,4390,4391,4392,4393],{"id":1514,"depth":1187,"text":1515},{"id":1656,"depth":1187,"text":1657},{"id":1885,"depth":1187,"text":1886},{"id":2131,"depth":1187,"text":2132},{"id":2439,"depth":1187,"text":2440},{"id":2769,"depth":1187,"text":2770},{"id":2893,"depth":1187,"text":2894},{"id":3239,"depth":1187,"text":3240},{"id":3537,"depth":1187,"text":3538},{"id":3783,"depth":1187,"text":3784},{"id":3827,"depth":1181,"text":3828},{"id":3975,"depth":1181,"text":3976},{"id":4008,"depth":1181,"text":4009},{"id":4199,"depth":1181,"text":4200},{"id":4258,"depth":1181,"text":4259},"Aturan: tidak ada foreign key lintas store. Referensi lintas store memakai publicid.","md",{},"\u002Fdata\u002Fdata-model",{"title":5,"description":4399},"data\u002Fdata-model","L-AMcRSsWkQdimP-87hpusboQk20UFJ5i8651opEBW0",[4407,4411,4415,4419,4423,4427,4431,4435,4439,4443,4447,4451,4455,4459,4463,4467,4471,4475,4478,4482,4486,4490,4494,4498,4502,4506,4510,4514,4517,4518,4522,4525,4529,4533,4537,4541,4545,4549,4553,4557,4560,4564,4568,4572,4576,4580,4584,4588,4592,4596,4600],{"title":4408,"path":4409,"description":4410},"ADR-0001 — Satu project = satu cell SQLite","\u002Fadr\u002Fadr-0001-cell-per-project","Platform multi-tenant untuk bank dan lender. Isolasi data adalah syarat procurement, bukan fitur tambahan. Pendekatan umum (satu database, WHERE tenantid) membuat satu bug query me",{"title":4412,"path":4413,"description":4414},"ADR-0002 — Spec-first, bukan Zod-first","\u002Fadr\u002Fadr-0002-spec-first","Kontrak API sudah final (OpenAPI 3.1, 78 path, 20 webhook). Pilihan: menulis Zod schema lalu generate spec, atau memakai spec sebagai sumber dan generate tipe\u002Fvalidator.",{"title":4416,"path":4417,"description":4418},"ADR-0003 — pi-durable di dalam cell","\u002Fadr\u002Fadr-0003-pi-durable-in-cell","pi-durable adalah harness agent (storage + conversation + checkpoint), bukan infrastruktur. Ia butuh satu proses yang memiliki satu storage pada satu waktu — persis model Durable O",{"title":4420,"path":4421,"description":4422},"ADR-0004 — Cloudflare DO untuk SaaS, celld untuk enterprise","\u002Fadr\u002Fadr-0004-cloudflare-saas-celld-enterprise","celld menyatakan satu fleet = satu deployment aplikasi dan tidak untuk multi-tenant yang saling tidak percaya. Produk ini adalah SaaS multi-tenant, tetapi bank enterprise butuh sel",{"title":4424,"path":4425,"description":4426},"ADR-0005 — Advisory adalah default","\u002Fadr\u002Fadr-0005-advisory-default","Platform bisa mengembalikan usulan aksi (advisory) atau mengeksekusi sendiri (actuating). Actuating memberi nilai lebih tetapi menambah risiko, kredensial write, dan review keamana",{"title":4428,"path":4429,"description":4430},"ADR-0006 — AI mengusulkan, kode memutuskan, manusia menyetujui","\u002Fadr\u002Fadr-0006-ai-proposes-code-decides","Angka kredit dan proyeksi RBB harus replayable, auditabel, dan tahan pemeriksaan. Output LLM tidak memenuhi ketiganya untuk angka.",{"title":4432,"path":4433,"description":4434},"ADR-0007 — Audit ledger WORM + hash chain","\u002Fadr\u002Fadr-0007-worm-audit-ledger","Audit trail di SQLite bisa diubah oleh bug atau operator. Bagi bank, \"bisa diubah\" berarti \"tidak bisa dipakai sebagai bukti\".",{"title":4436,"path":4437,"description":4438},"ADR-0008 — BYOK default, Polar untuk self-serve","\u002Fadr\u002Fadr-0008-byok-default-polar","Dua sumbu: plan dan model funding. Markup token rapuh terhadap negosiasi dan penurunan harga model. Polar adalah Merchant of Record yang menangani VAT global dan payout ke Indonesi",{"title":4440,"path":4441,"description":4442},"ADR-0009 — Projection engine deterministik","\u002Fadr\u002Fadr-0009-deterministic-projection-engine","RBB menuntut konsistensi akuntansi, asal-usul asumsi, dan deviasi yang dapat dijelaskan. LLM tidak bisa menghasilkan proyeksi 3 tahun yang replayable dan balance.",{"title":4444,"path":4445,"description":4446},"ADR-0010 — Residency sebagai atribut kelas satu","\u002Fadr\u002Fadr-0010-residency-first-class","Bank tidak boleh menempatkan data nasabah di luar yurisdiksi dan tidak boleh mengirim data ke model di luar allowlist. Residency yang implisit tidak bisa dijual.",{"title":4448,"path":4449,"description":4450},"ADR-0011 — Analytics read path di Neon","\u002Fadr\u002Fadr-0011-analytics-read-path","Cell single-threaded. Query agregat 60 bulan × 20 segmen × 34 provinsi akan memblokir semua write. Vector search juga dibutuhkan untuk dokumen.",{"title":4452,"path":4453,"description":4454},"ADR-0012 — Action layer, tanpa tool generik","\u002Fadr\u002Fadr-0012-action-layer-no-generic-tools","AI perlu memanggil API software klien. Memberi httprequest generik berarti blast radius tanpa batas dan tidak ada audit per efek samping.",{"title":4456,"path":4457,"description":4458},"ADR-0013 — Onboarding berjalan di cell project","\u002Fadr\u002Fadr-0013-onboarding-in-project-cell","Topologi awal menyebut cell onboarding:\u003Cproject terpisah. Namun onboarding butuh akses langsung ke dataset, data contract, quality gate, dan conversation yang sama dengan project. ",{"title":4460,"path":4461,"description":4462},"ADR-0014 — Dual ID: integer internal + public Nanoid berprefix","\u002Fadr\u002Fadr-0014-dual-id-public-nanoid","ID saat ini dirancang sebagai prefixed ULID tunggal (dec01JBQ...). ULID memberi sortability, tetapi:",{"title":4464,"path":4465,"description":4466},"ADR-0015 — Free-Tier MVP Deviations","\u002Fadr\u002Fadr-0015-free-tier-mvp-deviations","Untuk MVP yang bisa diuji end-to-end, kami menerima lima deviasi sadar dari dokumen arsitektur. Semuanya diisolasi di adapter\u002Fboundary agar bisa diganti tanpa mengubah domain.",{"title":4468,"path":4469,"description":4470},"ADR-0016 — Core software-agnostic, domain lewat vertical packs","\u002Fadr\u002Fadr-0016-core-vs-vertical-packs","Agnestra awalnya dideskripsikan dengan contoh perbankan yang sangat kuat: RBB, loan underwriting, POJK, dan materialitas bank. Akibatnya produk terbaca sebagai aplikasi RBB, bukan ",{"title":4472,"path":4473,"description":4474},"ADR-0017 — Business policy dimiliki provider aplikasi","\u002Fadr\u002Fadr-0017-policy-owned-by-provider","Core sempat memuat policy contoh untuk loan underwriting dan support triage. Itu membuat Agnestra terlihat sebagai produk lending\u002Fsupport, dan memaksa tim Agnestra memelihara atura",{"title":4476,"path":4477,"description":256},"ADR-0018 — Projection dan perhitungan domain dimiliki provider","\u002Fadr\u002Fadr-0018-projection-owned-by-provider",{"title":4479,"path":4480,"description":4481},"ADR-0019 — BYOK provider registry, vendor-neutral","\u002Fadr\u002Fadr-0019-byok-provider-registry","Agnestra sempat berpikir tentang integrasi Laya\u002FJEV sebagai sesuatu yang harus disediakan produk. Itu salah: Laya\u002FJEV adalah provider System One, bukan bagian dari core. Pola yang ",{"title":4483,"path":4484,"description":4485},"ADR-0020 — Satu jenis kredensial, otorisasi lewat scope","\u002Fadr\u002Fadr-0020-single-credential-scope-authorization","Status: Accepted (2026-11-27) Supersedes: sebagian ADR-0005 (advisory default) dan ADR-0015 (human dev key) Terkait: ADR-0017 (business policy milik provider aplikasi)",{"title":4487,"path":4488,"description":4489},"Architecture Decision Records","\u002Fadr","Format: ADR-NNNN — Judul. Status: Accepted, Superseded by ADR-N, Deprecated.",{"title":4491,"path":4492,"description":4493},"Control-plane API","\u002Fapi\u002Fcontrol-plane","Route yang berjalan di Worker sebelum proxy ke ProjectCell. Semua butuh auth kecuali GET \u002Fv1\u002Finvitations\u002F{token}.",{"title":4495,"path":4496,"description":4497},"API Conventions","\u002Fapi\u002Fconventions","Dokumen ini mengikat semua endpoint. Jika implementasi berbeda, salah satu harus diubah — dan perubahan spec lebih dulu.",{"title":4499,"path":4500,"description":4501},"Error Catalog","\u002Fapi\u002Ferror-catalog","Aturan:",{"title":4503,"path":4504,"description":4505},"API Inventory","\u002Fapi\u002Finventory","Semua operasi membawa metadata x-agnestra-scope, x-agnestra-actor, x-agnestra-danger, dan x-agnestra-idempotent. bun run test:api menjaga parity.",{"title":4507,"path":4508,"description":4509},"Architecture","\u002Farchitecture\u002Farchitecture","Agnestra terdiri dari empat bidang yang tidak boleh saling menulis langsung:",{"title":4511,"path":4512,"description":4513},"Provider Model — BYOK, vendor-neutral","\u002Farchitecture\u002Fprovider-model","Agnestra bukan penyedia model dan bukan integrasi vendor. Agnestra adalah lapisan koneksi + governance antara software penyedia dan provider AI apa pun.",{"title":4515,"path":4516,"description":261},"Runtime Model — di mana kode berjalan","\u002Farchitecture\u002Fruntime-model",{"title":5,"path":4402,"description":4399},{"title":4519,"path":4520,"description":4521},"Idempotency & Exactly-Once","\u002Fdata\u002Fidempotency","Ketiganya harus merujuk ke operasi yang sama. Jika salah satu berbeda, retry akan menggandakan efek.",{"title":4523,"path":4524,"description":4501},"Engineering Handbook","\u002Fdelivery\u002Fengineering",{"title":4526,"path":4527,"description":4528},"Implementation Status — Free-Tier MVP","\u002Fdelivery\u002Fimplementation-status","Health check:",{"title":4530,"path":4531,"description":4532},"MVP — 2 Minggu Pertama","\u002Fdelivery\u002Fmvp-2-weeks","Jangan menginisialisasi harness di constructor. Ukur wake latency.",{"title":4534,"path":4535,"description":4536},"Roadmap","\u002Fdelivery\u002Froadmap","Tidak dikerjakan: pool, Neon, docs site, billing, marketing.",{"title":4538,"path":4539,"description":4540},"Action Contract","\u002Fdomain\u002Faction-contract","Satu tool HTTP generik = blast radius tanpa batas. Semua efek samping harus melewati action layer yang mendeklarasikan: nama, skema argumen, klasifikasi risiko, izin, approval, ide",{"title":4542,"path":4543,"description":4544},"Data Contract & Onboarding","\u002Fdomain\u002Fdata-contract","Onboarding bukan fitur pendukung; onboarding adalah produknya. Metrik yang menentukan hidup-mati platform ini adalah time-to-first-decision: dari unggah data ke keputusan pertama y",{"title":4546,"path":4547,"description":4548},"Decision Contract","\u002Fdomain\u002Fdecision-contract","Satu decision adalah satu keluaran yang:",{"title":4550,"path":4551,"description":4552},"UX — Sitemap, Shell, Routes","\u002Ffrontend\u002Fux","Jangan satukan dashboard admin dan review console. Operator 200 kasus\u002Fhari tidak boleh tersesat ke halaman Usage.",{"title":4554,"path":4555,"description":4556},"Agnestra — Engineering Documentation","\u002F","Agnestra adalah integration layer dua arah antara AI dan software existing: konteks masuk, aksi keluar, bukti untuk keduanya.",{"title":4558,"path":4559,"description":4501},"Brand & Naming Lock","\u002Fproduct\u002Fbrand",{"title":4561,"path":4562,"description":4563},"Glossary","\u002Fproduct\u002Fglossary","Istilah di dokumen ini kanonik. Gunakan ejaan ini di kode, UI, dan API.",{"title":4565,"path":4566,"description":4567},"PRD — Agnestra","\u002Fproduct\u002Fprd","Agnestra adalah integration layer dua arah antara AI dan software existing. Ia bukan chatbot, bukan proxy model, dan bukan BI tool. Ia menghubungkan dua arah sekaligus:",{"title":4569,"path":4570,"description":4571},"GitHub OAuth","\u002Fsecurity\u002Fgithub-oauth","OAuth tidak membuat API key. API key hanya dibuat eksplisit dari halaman Access atau POST \u002Fv1\u002Faccess\u002Fkeys.",{"title":4573,"path":4574,"description":4575},"Incident case studies dan kaitannya dengan Agnestra","\u002Fsecurity\u002Fincident-case-studies","Dokumen ini memetakan insiden\u002Fkerentanan publik ke komponen Agnestra. Bukan klaim bahwa Agnestra pernah mengalami insiden yang sama.",{"title":4577,"path":4578,"description":4579},"RBAC & Approval Model","\u002Fsecurity\u002Frbac","Peran bersifat aditif; satu user bisa punya beberapa peran. owner org (control plane) lebih tinggi dari admin project.",{"title":4581,"path":4582,"description":4583},"Security","\u002Fsecurity\u002Fsecurity","Aset paling berharga: kredensial bucket = akar otoritas seluruh fleet. Ia tidak boleh berada di cell, log, atau image publik.",{"title":4585,"path":4586,"description":4587},"Repo Layout & Boundaries","\u002Fstack\u002Frepo-layout","Prefix ID (publicid):",{"title":4589,"path":4590,"description":4591},"Stack","\u002Fstack\u002Fstack","Zod 4.6.7 tersedia, tetapi tidak dipakai sebagai sumber kontrak. Ajv mengompilasi dari spec yang sama; satu sumber, tidak ada drift.",{"title":4593,"path":4594,"description":4595},"Vertical Packs","\u002Fverticals","Agnestra core is software-agnostic: it connects agents to any software through contracts, connectors, actions, evidence, approvals, and audit. A vertical pack is an optional module",{"title":4597,"path":4598,"description":4599},"Lending — Loan Approval","\u002Fverticals\u002Flending\u002Fintegration","Loan approval sudah punya scorecard, policy, dan data. AI tidak menggantikan scorecard. AI masuk di tempat yang mahal secara manusiawi dan rendah risikonya:",{"title":4601,"path":4602,"description":4603},"Planning — RBB (Rencana Bisnis Bank)","\u002Fverticals\u002Frbb\u002Fplanning","RBB bukan masalah forecasting. Menjualnya sebagai \"AI memprediksi angka RBB\" akan kalah di dua front sekaligus: akurasi (horizon 3 tahun, data terbatas) dan kepatuhan (OJK menuntut",[4605,4607],{"title":4515,"path":4516,"stem":4606,"description":261,"children":-1},"architecture\u002Fruntime-model",{"title":4519,"path":4520,"stem":4608,"description":4521,"children":-1},"data\u002Fidempotency",1795854666265,"d0d08295-956b-4ec1-8c0e-d08e29a6b41a"]