@warmdrift/kgauto-compiler 2.0.0-alpha.55 → 2.0.0-alpha.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brain-proxy.d.mts +13 -0
- package/dist/brain-proxy.d.ts +13 -0
- package/dist/brain-proxy.js +10 -1
- package/dist/brain-proxy.mjs +1 -1
- package/dist/{chunk-WVICNOLA.mjs → chunk-IUWFML6Z.mjs} +10 -1
- package/dist/index.js +10 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/brain-proxy.d.mts
CHANGED
|
@@ -59,6 +59,19 @@
|
|
|
59
59
|
* segment of each library POST (`outcomes`, `probe_outcomes`, …) is what
|
|
60
60
|
* `handle()` receives as `segment`.
|
|
61
61
|
*
|
|
62
|
+
* ## Prefer-header relay (alpha.56)
|
|
63
|
+
*
|
|
64
|
+
* `record()` sends `Prefer: return=representation` on its `/outcomes` POST and
|
|
65
|
+
* parses the inserted row id from the PROXY's response to fire the secondary
|
|
66
|
+
* `compile_outcome_advisories` POST. alpha.54/.55 hardcoded
|
|
67
|
+
* `Prefer: return=minimal` toward the brain and returned `{ok:true}` — so the
|
|
68
|
+
* id-parse found nothing and the advisory secondary silently never fired for
|
|
69
|
+
* factory-mounted consumers (PB + GE convergent finding, 2026-07-06). The
|
|
70
|
+
* factory now honors a caller `Prefer: return=representation` header: it is
|
|
71
|
+
* forwarded to the brain and the brain's response body (the inserted row(s))
|
|
72
|
+
* is relayed verbatim on success. Callers that don't send the header keep the
|
|
73
|
+
* `return=minimal` + `{ok:true}` behavior.
|
|
74
|
+
*
|
|
62
75
|
* ## Quality-segment handle resolution (alpha.55)
|
|
63
76
|
*
|
|
64
77
|
* `recordOutcome()` sends `outcome_id` as `CompileResult.handle` (a string),
|
package/dist/brain-proxy.d.ts
CHANGED
|
@@ -59,6 +59,19 @@
|
|
|
59
59
|
* segment of each library POST (`outcomes`, `probe_outcomes`, …) is what
|
|
60
60
|
* `handle()` receives as `segment`.
|
|
61
61
|
*
|
|
62
|
+
* ## Prefer-header relay (alpha.56)
|
|
63
|
+
*
|
|
64
|
+
* `record()` sends `Prefer: return=representation` on its `/outcomes` POST and
|
|
65
|
+
* parses the inserted row id from the PROXY's response to fire the secondary
|
|
66
|
+
* `compile_outcome_advisories` POST. alpha.54/.55 hardcoded
|
|
67
|
+
* `Prefer: return=minimal` toward the brain and returned `{ok:true}` — so the
|
|
68
|
+
* id-parse found nothing and the advisory secondary silently never fired for
|
|
69
|
+
* factory-mounted consumers (PB + GE convergent finding, 2026-07-06). The
|
|
70
|
+
* factory now honors a caller `Prefer: return=representation` header: it is
|
|
71
|
+
* forwarded to the brain and the brain's response body (the inserted row(s))
|
|
72
|
+
* is relayed verbatim on success. Callers that don't send the header keep the
|
|
73
|
+
* `return=minimal` + `{ok:true}` behavior.
|
|
74
|
+
*
|
|
62
75
|
* ## Quality-segment handle resolution (alpha.55)
|
|
63
76
|
*
|
|
64
77
|
* `recordOutcome()` sends `outcome_id` as `CompileResult.handle` (a string),
|
package/dist/brain-proxy.js
CHANGED
|
@@ -136,6 +136,9 @@ function createBrainForwardRoutes(config) {
|
|
|
136
136
|
if (outcome instanceof Response) return outcome;
|
|
137
137
|
row = outcome;
|
|
138
138
|
}
|
|
139
|
+
const wantsRepresentation = /return=representation/i.test(
|
|
140
|
+
req.headers.get("Prefer") ?? ""
|
|
141
|
+
);
|
|
139
142
|
let brainRes;
|
|
140
143
|
try {
|
|
141
144
|
brainRes = await fetchFn(`${brainUrl}/rest/v1/${table}`, {
|
|
@@ -144,7 +147,7 @@ function createBrainForwardRoutes(config) {
|
|
|
144
147
|
apikey: serviceKey,
|
|
145
148
|
Authorization: `Bearer ${serviceKey}`,
|
|
146
149
|
"Content-Type": "application/json",
|
|
147
|
-
Prefer: "return=minimal"
|
|
150
|
+
Prefer: wantsRepresentation ? "return=representation" : "return=minimal"
|
|
148
151
|
},
|
|
149
152
|
body: JSON.stringify(row)
|
|
150
153
|
});
|
|
@@ -156,6 +159,12 @@ function createBrainForwardRoutes(config) {
|
|
|
156
159
|
});
|
|
157
160
|
}
|
|
158
161
|
if (brainRes.ok) {
|
|
162
|
+
if (wantsRepresentation) {
|
|
163
|
+
const text2 = await brainRes.text().catch(() => "");
|
|
164
|
+
if (text2.length > 0) {
|
|
165
|
+
return new Response(text2, { status: 201, headers: JSON_HEADERS });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
159
168
|
return jsonResponse(201, { ok: true });
|
|
160
169
|
}
|
|
161
170
|
const text = await brainRes.text().catch(() => "<no body>");
|
package/dist/brain-proxy.mjs
CHANGED
|
@@ -112,6 +112,9 @@ function createBrainForwardRoutes(config) {
|
|
|
112
112
|
if (outcome instanceof Response) return outcome;
|
|
113
113
|
row = outcome;
|
|
114
114
|
}
|
|
115
|
+
const wantsRepresentation = /return=representation/i.test(
|
|
116
|
+
req.headers.get("Prefer") ?? ""
|
|
117
|
+
);
|
|
115
118
|
let brainRes;
|
|
116
119
|
try {
|
|
117
120
|
brainRes = await fetchFn(`${brainUrl}/rest/v1/${table}`, {
|
|
@@ -120,7 +123,7 @@ function createBrainForwardRoutes(config) {
|
|
|
120
123
|
apikey: serviceKey,
|
|
121
124
|
Authorization: `Bearer ${serviceKey}`,
|
|
122
125
|
"Content-Type": "application/json",
|
|
123
|
-
Prefer: "return=minimal"
|
|
126
|
+
Prefer: wantsRepresentation ? "return=representation" : "return=minimal"
|
|
124
127
|
},
|
|
125
128
|
body: JSON.stringify(row)
|
|
126
129
|
});
|
|
@@ -132,6 +135,12 @@ function createBrainForwardRoutes(config) {
|
|
|
132
135
|
});
|
|
133
136
|
}
|
|
134
137
|
if (brainRes.ok) {
|
|
138
|
+
if (wantsRepresentation) {
|
|
139
|
+
const text2 = await brainRes.text().catch(() => "");
|
|
140
|
+
if (text2.length > 0) {
|
|
141
|
+
return new Response(text2, { status: 201, headers: JSON_HEADERS });
|
|
142
|
+
}
|
|
143
|
+
}
|
|
135
144
|
return jsonResponse(201, { ok: true });
|
|
136
145
|
}
|
|
137
146
|
const text = await brainRes.text().catch(() => "<no body>");
|
package/dist/index.js
CHANGED
|
@@ -6881,6 +6881,9 @@ function createBrainForwardRoutes(config) {
|
|
|
6881
6881
|
if (outcome instanceof Response) return outcome;
|
|
6882
6882
|
row = outcome;
|
|
6883
6883
|
}
|
|
6884
|
+
const wantsRepresentation = /return=representation/i.test(
|
|
6885
|
+
req.headers.get("Prefer") ?? ""
|
|
6886
|
+
);
|
|
6884
6887
|
let brainRes;
|
|
6885
6888
|
try {
|
|
6886
6889
|
brainRes = await fetchFn(`${brainUrl}/rest/v1/${table}`, {
|
|
@@ -6889,7 +6892,7 @@ function createBrainForwardRoutes(config) {
|
|
|
6889
6892
|
apikey: serviceKey,
|
|
6890
6893
|
Authorization: `Bearer ${serviceKey}`,
|
|
6891
6894
|
"Content-Type": "application/json",
|
|
6892
|
-
Prefer: "return=minimal"
|
|
6895
|
+
Prefer: wantsRepresentation ? "return=representation" : "return=minimal"
|
|
6893
6896
|
},
|
|
6894
6897
|
body: JSON.stringify(row)
|
|
6895
6898
|
});
|
|
@@ -6901,6 +6904,12 @@ function createBrainForwardRoutes(config) {
|
|
|
6901
6904
|
});
|
|
6902
6905
|
}
|
|
6903
6906
|
if (brainRes.ok) {
|
|
6907
|
+
if (wantsRepresentation) {
|
|
6908
|
+
const text2 = await brainRes.text().catch(() => "");
|
|
6909
|
+
if (text2.length > 0) {
|
|
6910
|
+
return new Response(text2, { status: 201, headers: JSON_HEADERS });
|
|
6911
|
+
}
|
|
6912
|
+
}
|
|
6904
6913
|
return jsonResponse(201, { ok: true });
|
|
6905
6914
|
}
|
|
6906
6915
|
const text = await brainRes.text().catch(() => "<no body>");
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warmdrift/kgauto-compiler",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.56",
|
|
4
4
|
"description": "Prompt compiler + central learning brain for multi-model AI apps. Swap models without rewriting prompts.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|