@langchain/langgraph-sdk 1.8.3 → 1.8.4
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/ui/hitl-interrupt-payload.cjs +25 -17
- package/dist/ui/hitl-interrupt-payload.cjs.map +1 -1
- package/dist/ui/hitl-interrupt-payload.d.cts +3 -2
- package/dist/ui/hitl-interrupt-payload.d.cts.map +1 -1
- package/dist/ui/hitl-interrupt-payload.d.ts +3 -2
- package/dist/ui/hitl-interrupt-payload.d.ts.map +1 -1
- package/dist/ui/hitl-interrupt-payload.js +25 -17
- package/dist/ui/hitl-interrupt-payload.js.map +1 -1
- package/dist/ui/interrupts.cjs +2 -1
- package/dist/ui/interrupts.cjs.map +1 -1
- package/dist/ui/interrupts.d.cts +2 -1
- package/dist/ui/interrupts.d.cts.map +1 -1
- package/dist/ui/interrupts.d.ts +2 -1
- package/dist/ui/interrupts.d.ts.map +1 -1
- package/dist/ui/interrupts.js +2 -1
- package/dist/ui/interrupts.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,42 +5,50 @@
|
|
|
5
5
|
* camelCase. Normalize known HITL fields on interrupt payloads at read time.
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
-
* Copy a plain object
|
|
8
|
+
* Copy a plain object and expose both casing styles for a field.
|
|
9
|
+
*
|
|
10
|
+
* camelCase is treated as canonical when both keys are present so newer
|
|
11
|
+
* consumers keep the current behavior while legacy snake_case access still
|
|
12
|
+
* resolves to the same value.
|
|
9
13
|
*/
|
|
10
|
-
function
|
|
14
|
+
function aliasCasePair(item, camel, snake) {
|
|
11
15
|
if (item === null || typeof item !== "object" || Array.isArray(item)) return item;
|
|
12
16
|
const o = item;
|
|
13
17
|
const merged = o[camel] ?? o[snake];
|
|
14
|
-
const next = {};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
next[
|
|
18
|
+
const next = { ...o };
|
|
19
|
+
if (merged !== void 0) {
|
|
20
|
+
next[camel] = merged;
|
|
21
|
+
next[snake] = merged;
|
|
18
22
|
}
|
|
19
|
-
if (merged !== void 0) next[camel] = merged;
|
|
20
23
|
return next;
|
|
21
24
|
}
|
|
22
25
|
function mapArrayAlias(raw, camel, snake) {
|
|
23
26
|
if (!Array.isArray(raw)) return raw;
|
|
24
|
-
return raw.map((item) =>
|
|
27
|
+
return raw.map((item) => aliasCasePair(item, camel, snake));
|
|
25
28
|
}
|
|
26
29
|
/**
|
|
27
|
-
* If `value` looks like a HITL request object
|
|
28
|
-
*
|
|
30
|
+
* If `value` looks like a HITL request object, expose both the new camelCase
|
|
31
|
+
* keys and the deprecated snake_case aliases so older apps keep working while
|
|
32
|
+
* migrating to the new shape.
|
|
29
33
|
*/
|
|
30
34
|
function normalizeHitlInterruptPayload(value) {
|
|
31
35
|
if (value === null || typeof value !== "object") return value;
|
|
32
36
|
if (Array.isArray(value)) return value.map((v) => normalizeHitlInterruptPayload(v));
|
|
33
37
|
const obj = value;
|
|
34
38
|
if (!("action_requests" in obj || "actionRequests" in obj || "review_configs" in obj || "reviewConfigs" in obj)) return value;
|
|
35
|
-
const next = {};
|
|
36
|
-
for (const [k, v] of Object.entries(obj)) {
|
|
37
|
-
if (k === "action_requests" || k === "actionRequests" || k === "review_configs" || k === "reviewConfigs") continue;
|
|
38
|
-
next[k] = v;
|
|
39
|
-
}
|
|
39
|
+
const next = { ...obj };
|
|
40
40
|
const actionRequestsRaw = obj.actionRequests ?? obj.action_requests;
|
|
41
|
-
if (actionRequestsRaw !== void 0)
|
|
41
|
+
if (actionRequestsRaw !== void 0) {
|
|
42
|
+
const actionRequests = mapArrayAlias(actionRequestsRaw, "name", "action_name");
|
|
43
|
+
next.actionRequests = actionRequests;
|
|
44
|
+
next.action_requests = actionRequests;
|
|
45
|
+
}
|
|
42
46
|
const reviewConfigsRaw = obj.reviewConfigs ?? obj.review_configs;
|
|
43
|
-
if (reviewConfigsRaw !== void 0)
|
|
47
|
+
if (reviewConfigsRaw !== void 0) {
|
|
48
|
+
const reviewConfigs = mapArrayAlias(reviewConfigsRaw, "allowedDecisions", "allowed_decisions");
|
|
49
|
+
next.reviewConfigs = reviewConfigs;
|
|
50
|
+
next.review_configs = reviewConfigs;
|
|
51
|
+
}
|
|
44
52
|
return next;
|
|
45
53
|
}
|
|
46
54
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hitl-interrupt-payload.cjs","names":[],"sources":["../../src/ui/hitl-interrupt-payload.ts"],"sourcesContent":["/**\n * Human-in-the-loop interrupt values from the LangGraph API may use\n * snake_case (Python server) while JS clients and LangChain types expect\n * camelCase. Normalize known HITL fields on interrupt payloads at read time.\n */\n\n/**\n * Copy a plain object
|
|
1
|
+
{"version":3,"file":"hitl-interrupt-payload.cjs","names":[],"sources":["../../src/ui/hitl-interrupt-payload.ts"],"sourcesContent":["/**\n * Human-in-the-loop interrupt values from the LangGraph API may use\n * snake_case (Python server) while JS clients and LangChain types expect\n * camelCase. Normalize known HITL fields on interrupt payloads at read time.\n */\n\n/**\n * Copy a plain object and expose both casing styles for a field.\n *\n * camelCase is treated as canonical when both keys are present so newer\n * consumers keep the current behavior while legacy snake_case access still\n * resolves to the same value.\n */\nfunction aliasCasePair(item: unknown, camel: string, snake: string): unknown {\n if (item === null || typeof item !== \"object\" || Array.isArray(item)) {\n return item;\n }\n const o = item as Record<string, unknown>;\n const merged = o[camel] ?? o[snake];\n const next: Record<string, unknown> = { ...o };\n if (merged !== undefined) {\n next[camel] = merged;\n next[snake] = merged;\n }\n return next;\n}\n\nfunction mapArrayAlias(raw: unknown, camel: string, snake: string): unknown {\n if (!Array.isArray(raw)) return raw;\n return raw.map((item) => aliasCasePair(item, camel, snake));\n}\n\n/**\n * If `value` looks like a HITL request object, expose both the new camelCase\n * keys and the deprecated snake_case aliases so older apps keep working while\n * migrating to the new shape.\n */\nexport function normalizeHitlInterruptPayload(value: unknown): unknown {\n if (value === null || typeof value !== \"object\") {\n return value;\n }\n if (Array.isArray(value)) {\n return value.map((v) => normalizeHitlInterruptPayload(v));\n }\n const obj = value as Record<string, unknown>;\n const isHitlLike =\n \"action_requests\" in obj ||\n \"actionRequests\" in obj ||\n \"review_configs\" in obj ||\n \"reviewConfigs\" in obj;\n if (!isHitlLike) {\n return value;\n }\n\n const next: Record<string, unknown> = { ...obj };\n\n const actionRequestsRaw = obj.actionRequests ?? obj.action_requests;\n if (actionRequestsRaw !== undefined) {\n const actionRequests = mapArrayAlias(\n actionRequestsRaw,\n \"name\",\n \"action_name\"\n );\n next.actionRequests = actionRequests;\n next.action_requests = actionRequests;\n }\n const reviewConfigsRaw = obj.reviewConfigs ?? obj.review_configs;\n if (reviewConfigsRaw !== undefined) {\n const reviewConfigs = mapArrayAlias(\n reviewConfigsRaw,\n \"allowedDecisions\",\n \"allowed_decisions\"\n );\n next.reviewConfigs = reviewConfigs;\n next.review_configs = reviewConfigs;\n }\n return next;\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,SAAS,cAAc,MAAe,OAAe,OAAwB;AAC3E,KAAI,SAAS,QAAQ,OAAO,SAAS,YAAY,MAAM,QAAQ,KAAK,CAClE,QAAO;CAET,MAAM,IAAI;CACV,MAAM,SAAS,EAAE,UAAU,EAAE;CAC7B,MAAM,OAAgC,EAAE,GAAG,GAAG;AAC9C,KAAI,WAAW,KAAA,GAAW;AACxB,OAAK,SAAS;AACd,OAAK,SAAS;;AAEhB,QAAO;;AAGT,SAAS,cAAc,KAAc,OAAe,OAAwB;AAC1E,KAAI,CAAC,MAAM,QAAQ,IAAI,CAAE,QAAO;AAChC,QAAO,IAAI,KAAK,SAAS,cAAc,MAAM,OAAO,MAAM,CAAC;;;;;;;AAQ7D,SAAgB,8BAA8B,OAAyB;AACrE,KAAI,UAAU,QAAQ,OAAO,UAAU,SACrC,QAAO;AAET,KAAI,MAAM,QAAQ,MAAM,CACtB,QAAO,MAAM,KAAK,MAAM,8BAA8B,EAAE,CAAC;CAE3D,MAAM,MAAM;AAMZ,KAAI,EAJF,qBAAqB,OACrB,oBAAoB,OACpB,oBAAoB,OACpB,mBAAmB,KAEnB,QAAO;CAGT,MAAM,OAAgC,EAAE,GAAG,KAAK;CAEhD,MAAM,oBAAoB,IAAI,kBAAkB,IAAI;AACpD,KAAI,sBAAsB,KAAA,GAAW;EACnC,MAAM,iBAAiB,cACrB,mBACA,QACA,cACD;AACD,OAAK,iBAAiB;AACtB,OAAK,kBAAkB;;CAEzB,MAAM,mBAAmB,IAAI,iBAAiB,IAAI;AAClD,KAAI,qBAAqB,KAAA,GAAW;EAClC,MAAM,gBAAgB,cACpB,kBACA,oBACA,oBACD;AACD,OAAK,gBAAgB;AACrB,OAAK,iBAAiB;;AAExB,QAAO"}
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
* camelCase. Normalize known HITL fields on interrupt payloads at read time.
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
-
* If `value` looks like a HITL request object
|
|
9
|
-
*
|
|
8
|
+
* If `value` looks like a HITL request object, expose both the new camelCase
|
|
9
|
+
* keys and the deprecated snake_case aliases so older apps keep working while
|
|
10
|
+
* migrating to the new shape.
|
|
10
11
|
*/
|
|
11
12
|
declare function normalizeHitlInterruptPayload(value: unknown): unknown;
|
|
12
13
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hitl-interrupt-payload.d.cts","names":[],"sources":["../../src/ui/hitl-interrupt-payload.ts"],"mappings":";;AAqCA
|
|
1
|
+
{"version":3,"file":"hitl-interrupt-payload.d.cts","names":[],"sources":["../../src/ui/hitl-interrupt-payload.ts"],"mappings":";;AAqCA;;;;;;;;;iBAAgB,6BAAA,CAA8B,KAAA"}
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
* camelCase. Normalize known HITL fields on interrupt payloads at read time.
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
-
* If `value` looks like a HITL request object
|
|
9
|
-
*
|
|
8
|
+
* If `value` looks like a HITL request object, expose both the new camelCase
|
|
9
|
+
* keys and the deprecated snake_case aliases so older apps keep working while
|
|
10
|
+
* migrating to the new shape.
|
|
10
11
|
*/
|
|
11
12
|
declare function normalizeHitlInterruptPayload(value: unknown): unknown;
|
|
12
13
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hitl-interrupt-payload.d.ts","names":[],"sources":["../../src/ui/hitl-interrupt-payload.ts"],"mappings":";;AAqCA
|
|
1
|
+
{"version":3,"file":"hitl-interrupt-payload.d.ts","names":[],"sources":["../../src/ui/hitl-interrupt-payload.ts"],"mappings":";;AAqCA;;;;;;;;;iBAAgB,6BAAA,CAA8B,KAAA"}
|
|
@@ -5,42 +5,50 @@
|
|
|
5
5
|
* camelCase. Normalize known HITL fields on interrupt payloads at read time.
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
-
* Copy a plain object
|
|
8
|
+
* Copy a plain object and expose both casing styles for a field.
|
|
9
|
+
*
|
|
10
|
+
* camelCase is treated as canonical when both keys are present so newer
|
|
11
|
+
* consumers keep the current behavior while legacy snake_case access still
|
|
12
|
+
* resolves to the same value.
|
|
9
13
|
*/
|
|
10
|
-
function
|
|
14
|
+
function aliasCasePair(item, camel, snake) {
|
|
11
15
|
if (item === null || typeof item !== "object" || Array.isArray(item)) return item;
|
|
12
16
|
const o = item;
|
|
13
17
|
const merged = o[camel] ?? o[snake];
|
|
14
|
-
const next = {};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
next[
|
|
18
|
+
const next = { ...o };
|
|
19
|
+
if (merged !== void 0) {
|
|
20
|
+
next[camel] = merged;
|
|
21
|
+
next[snake] = merged;
|
|
18
22
|
}
|
|
19
|
-
if (merged !== void 0) next[camel] = merged;
|
|
20
23
|
return next;
|
|
21
24
|
}
|
|
22
25
|
function mapArrayAlias(raw, camel, snake) {
|
|
23
26
|
if (!Array.isArray(raw)) return raw;
|
|
24
|
-
return raw.map((item) =>
|
|
27
|
+
return raw.map((item) => aliasCasePair(item, camel, snake));
|
|
25
28
|
}
|
|
26
29
|
/**
|
|
27
|
-
* If `value` looks like a HITL request object
|
|
28
|
-
*
|
|
30
|
+
* If `value` looks like a HITL request object, expose both the new camelCase
|
|
31
|
+
* keys and the deprecated snake_case aliases so older apps keep working while
|
|
32
|
+
* migrating to the new shape.
|
|
29
33
|
*/
|
|
30
34
|
function normalizeHitlInterruptPayload(value) {
|
|
31
35
|
if (value === null || typeof value !== "object") return value;
|
|
32
36
|
if (Array.isArray(value)) return value.map((v) => normalizeHitlInterruptPayload(v));
|
|
33
37
|
const obj = value;
|
|
34
38
|
if (!("action_requests" in obj || "actionRequests" in obj || "review_configs" in obj || "reviewConfigs" in obj)) return value;
|
|
35
|
-
const next = {};
|
|
36
|
-
for (const [k, v] of Object.entries(obj)) {
|
|
37
|
-
if (k === "action_requests" || k === "actionRequests" || k === "review_configs" || k === "reviewConfigs") continue;
|
|
38
|
-
next[k] = v;
|
|
39
|
-
}
|
|
39
|
+
const next = { ...obj };
|
|
40
40
|
const actionRequestsRaw = obj.actionRequests ?? obj.action_requests;
|
|
41
|
-
if (actionRequestsRaw !== void 0)
|
|
41
|
+
if (actionRequestsRaw !== void 0) {
|
|
42
|
+
const actionRequests = mapArrayAlias(actionRequestsRaw, "name", "action_name");
|
|
43
|
+
next.actionRequests = actionRequests;
|
|
44
|
+
next.action_requests = actionRequests;
|
|
45
|
+
}
|
|
42
46
|
const reviewConfigsRaw = obj.reviewConfigs ?? obj.review_configs;
|
|
43
|
-
if (reviewConfigsRaw !== void 0)
|
|
47
|
+
if (reviewConfigsRaw !== void 0) {
|
|
48
|
+
const reviewConfigs = mapArrayAlias(reviewConfigsRaw, "allowedDecisions", "allowed_decisions");
|
|
49
|
+
next.reviewConfigs = reviewConfigs;
|
|
50
|
+
next.review_configs = reviewConfigs;
|
|
51
|
+
}
|
|
44
52
|
return next;
|
|
45
53
|
}
|
|
46
54
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hitl-interrupt-payload.js","names":[],"sources":["../../src/ui/hitl-interrupt-payload.ts"],"sourcesContent":["/**\n * Human-in-the-loop interrupt values from the LangGraph API may use\n * snake_case (Python server) while JS clients and LangChain types expect\n * camelCase. Normalize known HITL fields on interrupt payloads at read time.\n */\n\n/**\n * Copy a plain object
|
|
1
|
+
{"version":3,"file":"hitl-interrupt-payload.js","names":[],"sources":["../../src/ui/hitl-interrupt-payload.ts"],"sourcesContent":["/**\n * Human-in-the-loop interrupt values from the LangGraph API may use\n * snake_case (Python server) while JS clients and LangChain types expect\n * camelCase. Normalize known HITL fields on interrupt payloads at read time.\n */\n\n/**\n * Copy a plain object and expose both casing styles for a field.\n *\n * camelCase is treated as canonical when both keys are present so newer\n * consumers keep the current behavior while legacy snake_case access still\n * resolves to the same value.\n */\nfunction aliasCasePair(item: unknown, camel: string, snake: string): unknown {\n if (item === null || typeof item !== \"object\" || Array.isArray(item)) {\n return item;\n }\n const o = item as Record<string, unknown>;\n const merged = o[camel] ?? o[snake];\n const next: Record<string, unknown> = { ...o };\n if (merged !== undefined) {\n next[camel] = merged;\n next[snake] = merged;\n }\n return next;\n}\n\nfunction mapArrayAlias(raw: unknown, camel: string, snake: string): unknown {\n if (!Array.isArray(raw)) return raw;\n return raw.map((item) => aliasCasePair(item, camel, snake));\n}\n\n/**\n * If `value` looks like a HITL request object, expose both the new camelCase\n * keys and the deprecated snake_case aliases so older apps keep working while\n * migrating to the new shape.\n */\nexport function normalizeHitlInterruptPayload(value: unknown): unknown {\n if (value === null || typeof value !== \"object\") {\n return value;\n }\n if (Array.isArray(value)) {\n return value.map((v) => normalizeHitlInterruptPayload(v));\n }\n const obj = value as Record<string, unknown>;\n const isHitlLike =\n \"action_requests\" in obj ||\n \"actionRequests\" in obj ||\n \"review_configs\" in obj ||\n \"reviewConfigs\" in obj;\n if (!isHitlLike) {\n return value;\n }\n\n const next: Record<string, unknown> = { ...obj };\n\n const actionRequestsRaw = obj.actionRequests ?? obj.action_requests;\n if (actionRequestsRaw !== undefined) {\n const actionRequests = mapArrayAlias(\n actionRequestsRaw,\n \"name\",\n \"action_name\"\n );\n next.actionRequests = actionRequests;\n next.action_requests = actionRequests;\n }\n const reviewConfigsRaw = obj.reviewConfigs ?? obj.review_configs;\n if (reviewConfigsRaw !== undefined) {\n const reviewConfigs = mapArrayAlias(\n reviewConfigsRaw,\n \"allowedDecisions\",\n \"allowed_decisions\"\n );\n next.reviewConfigs = reviewConfigs;\n next.review_configs = reviewConfigs;\n }\n return next;\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,SAAS,cAAc,MAAe,OAAe,OAAwB;AAC3E,KAAI,SAAS,QAAQ,OAAO,SAAS,YAAY,MAAM,QAAQ,KAAK,CAClE,QAAO;CAET,MAAM,IAAI;CACV,MAAM,SAAS,EAAE,UAAU,EAAE;CAC7B,MAAM,OAAgC,EAAE,GAAG,GAAG;AAC9C,KAAI,WAAW,KAAA,GAAW;AACxB,OAAK,SAAS;AACd,OAAK,SAAS;;AAEhB,QAAO;;AAGT,SAAS,cAAc,KAAc,OAAe,OAAwB;AAC1E,KAAI,CAAC,MAAM,QAAQ,IAAI,CAAE,QAAO;AAChC,QAAO,IAAI,KAAK,SAAS,cAAc,MAAM,OAAO,MAAM,CAAC;;;;;;;AAQ7D,SAAgB,8BAA8B,OAAyB;AACrE,KAAI,UAAU,QAAQ,OAAO,UAAU,SACrC,QAAO;AAET,KAAI,MAAM,QAAQ,MAAM,CACtB,QAAO,MAAM,KAAK,MAAM,8BAA8B,EAAE,CAAC;CAE3D,MAAM,MAAM;AAMZ,KAAI,EAJF,qBAAqB,OACrB,oBAAoB,OACpB,oBAAoB,OACpB,mBAAmB,KAEnB,QAAO;CAGT,MAAM,OAAgC,EAAE,GAAG,KAAK;CAEhD,MAAM,oBAAoB,IAAI,kBAAkB,IAAI;AACpD,KAAI,sBAAsB,KAAA,GAAW;EACnC,MAAM,iBAAiB,cACrB,mBACA,QACA,cACD;AACD,OAAK,iBAAiB;AACtB,OAAK,kBAAkB;;CAEzB,MAAM,mBAAmB,IAAI,iBAAiB,IAAI;AAClD,KAAI,qBAAqB,KAAA,GAAW;EAClC,MAAM,gBAAgB,cACpB,kBACA,oBACA,oBACD;AACD,OAAK,gBAAgB;AACrB,OAAK,iBAAiB;;AAExB,QAAO"}
|
package/dist/ui/interrupts.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const require_hitl_interrupt_payload = require("./hitl-interrupt-payload.cjs");
|
|
2
2
|
//#region src/ui/interrupts.ts
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Normalizes HITL interrupt payloads to expose camelCase fields plus deprecated
|
|
5
|
+
* snake_case aliases for compatibility during migration.
|
|
5
6
|
*/
|
|
6
7
|
function normalizeInterruptForClient(interrupt) {
|
|
7
8
|
if (interrupt.value === void 0) return interrupt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interrupts.cjs","names":["normalizeHitlInterruptPayload"],"sources":["../../src/ui/interrupts.ts"],"sourcesContent":["import { normalizeHitlInterruptPayload } from \"./hitl-interrupt-payload.js\";\nimport { Interrupt, ThreadState } from \"../schema.js\";\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"interrupts.cjs","names":["normalizeHitlInterruptPayload"],"sources":["../../src/ui/interrupts.ts"],"sourcesContent":["import { normalizeHitlInterruptPayload } from \"./hitl-interrupt-payload.js\";\nimport { Interrupt, ThreadState } from \"../schema.js\";\n\n/**\n * Normalizes HITL interrupt payloads to expose camelCase fields plus deprecated\n * snake_case aliases for compatibility during migration.\n */\nexport function normalizeInterruptForClient<T = unknown>(\n interrupt: Interrupt<T>\n): Interrupt<T> {\n if (interrupt.value === undefined) {\n return interrupt;\n }\n return {\n ...interrupt,\n value: normalizeHitlInterruptPayload(interrupt.value) as T,\n };\n}\n\n/**\n * Applies {@link normalizeInterruptForClient} to each interrupt.\n */\nexport function normalizeInterruptsList<T = unknown>(\n interrupts: Interrupt<T>[]\n): Interrupt<T>[] {\n return interrupts.map((i) => normalizeInterruptForClient(i));\n}\n\nexport function extractInterrupts<InterruptType = unknown>(\n values: unknown,\n options?: {\n isLoading: boolean;\n threadState: ThreadState | undefined;\n error: unknown;\n }\n): Interrupt<InterruptType> | undefined {\n if (\n typeof values === \"object\" &&\n values != null &&\n \"__interrupt__\" in values &&\n Array.isArray(values.__interrupt__)\n ) {\n const valueInterrupts = values.__interrupt__ as Interrupt<InterruptType>[];\n if (valueInterrupts.length === 0) return { when: \"breakpoint\" };\n if (valueInterrupts.length === 1) {\n return normalizeInterruptForClient(valueInterrupts[0]);\n }\n\n // TODO: fix the typing of interrupts if multiple interrupts are returned\n const normalized = valueInterrupts.map((i) =>\n normalizeInterruptForClient(i)\n );\n return normalized as unknown as Interrupt<InterruptType> | undefined;\n }\n\n // If we're deferring to old interrupt detection logic, don't show the interrupt if the stream is loading\n if (options?.isLoading) return undefined;\n\n const interrupts = options?.threadState?.tasks?.at(-1)?.interrupts;\n if (interrupts == null || interrupts.length === 0) {\n // check if there's a next task present\n const next = options?.threadState?.next ?? [];\n if (!next.length || options?.error != null) return undefined;\n return { when: \"breakpoint\" };\n }\n\n // Return only the current interrupt\n return normalizeInterruptForClient(\n interrupts.at(-1) as Interrupt<InterruptType>\n );\n}\n"],"mappings":";;;;;;AAOA,SAAgB,4BACd,WACc;AACd,KAAI,UAAU,UAAU,KAAA,EACtB,QAAO;AAET,QAAO;EACL,GAAG;EACH,OAAOA,+BAAAA,8BAA8B,UAAU,MAAM;EACtD;;;;;AAMH,SAAgB,wBACd,YACgB;AAChB,QAAO,WAAW,KAAK,MAAM,4BAA4B,EAAE,CAAC;;AAG9D,SAAgB,kBACd,QACA,SAKsC;AACtC,KACE,OAAO,WAAW,YAClB,UAAU,QACV,mBAAmB,UACnB,MAAM,QAAQ,OAAO,cAAc,EACnC;EACA,MAAM,kBAAkB,OAAO;AAC/B,MAAI,gBAAgB,WAAW,EAAG,QAAO,EAAE,MAAM,cAAc;AAC/D,MAAI,gBAAgB,WAAW,EAC7B,QAAO,4BAA4B,gBAAgB,GAAG;AAOxD,SAHmB,gBAAgB,KAAK,MACtC,4BAA4B,EAAE,CAC/B;;AAKH,KAAI,SAAS,UAAW,QAAO,KAAA;CAE/B,MAAM,aAAa,SAAS,aAAa,OAAO,GAAG,GAAG,EAAE;AACxD,KAAI,cAAc,QAAQ,WAAW,WAAW,GAAG;AAGjD,MAAI,EADS,SAAS,aAAa,QAAQ,EAAE,EACnC,UAAU,SAAS,SAAS,KAAM,QAAO,KAAA;AACnD,SAAO,EAAE,MAAM,cAAc;;AAI/B,QAAO,4BACL,WAAW,GAAG,GAAG,CAClB"}
|
package/dist/ui/interrupts.d.cts
CHANGED
|
@@ -2,7 +2,8 @@ import { Interrupt, ThreadState } from "../schema.cjs";
|
|
|
2
2
|
|
|
3
3
|
//#region src/ui/interrupts.d.ts
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Normalizes HITL interrupt payloads to expose camelCase fields plus deprecated
|
|
6
|
+
* snake_case aliases for compatibility during migration.
|
|
6
7
|
*/
|
|
7
8
|
declare function normalizeInterruptForClient<T = unknown>(interrupt: Interrupt<T>): Interrupt<T>;
|
|
8
9
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interrupts.d.cts","names":[],"sources":["../../src/ui/interrupts.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"interrupts.d.cts","names":[],"sources":["../../src/ui/interrupts.ts"],"mappings":";;;;;AAOA;;iBAAgB,2BAAA,aAAA,CACd,SAAA,EAAW,SAAA,CAAU,CAAA,IACpB,SAAA,CAAU,CAAA;;;;iBAaG,uBAAA,aAAA,CACd,UAAA,EAAY,SAAA,CAAU,CAAA,MACrB,SAAA,CAAU,CAAA;AAAA,iBAIG,iBAAA,yBAAA,CACd,MAAA,WACA,OAAA;EACE,SAAA;EACA,WAAA,EAAa,WAAA;EACb,KAAA;AAAA,IAED,SAAA,CAAU,aAAA"}
|
package/dist/ui/interrupts.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { Interrupt, ThreadState } from "../schema.js";
|
|
|
2
2
|
|
|
3
3
|
//#region src/ui/interrupts.d.ts
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Normalizes HITL interrupt payloads to expose camelCase fields plus deprecated
|
|
6
|
+
* snake_case aliases for compatibility during migration.
|
|
6
7
|
*/
|
|
7
8
|
declare function normalizeInterruptForClient<T = unknown>(interrupt: Interrupt<T>): Interrupt<T>;
|
|
8
9
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interrupts.d.ts","names":[],"sources":["../../src/ui/interrupts.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"interrupts.d.ts","names":[],"sources":["../../src/ui/interrupts.ts"],"mappings":";;;;;AAOA;;iBAAgB,2BAAA,aAAA,CACd,SAAA,EAAW,SAAA,CAAU,CAAA,IACpB,SAAA,CAAU,CAAA;;;;iBAaG,uBAAA,aAAA,CACd,UAAA,EAAY,SAAA,CAAU,CAAA,MACrB,SAAA,CAAU,CAAA;AAAA,iBAIG,iBAAA,yBAAA,CACd,MAAA,WACA,OAAA;EACE,SAAA;EACA,WAAA,EAAa,WAAA;EACb,KAAA;AAAA,IAED,SAAA,CAAU,aAAA"}
|
package/dist/ui/interrupts.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { normalizeHitlInterruptPayload } from "./hitl-interrupt-payload.js";
|
|
2
2
|
//#region src/ui/interrupts.ts
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Normalizes HITL interrupt payloads to expose camelCase fields plus deprecated
|
|
5
|
+
* snake_case aliases for compatibility during migration.
|
|
5
6
|
*/
|
|
6
7
|
function normalizeInterruptForClient(interrupt) {
|
|
7
8
|
if (interrupt.value === void 0) return interrupt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interrupts.js","names":[],"sources":["../../src/ui/interrupts.ts"],"sourcesContent":["import { normalizeHitlInterruptPayload } from \"./hitl-interrupt-payload.js\";\nimport { Interrupt, ThreadState } from \"../schema.js\";\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"interrupts.js","names":[],"sources":["../../src/ui/interrupts.ts"],"sourcesContent":["import { normalizeHitlInterruptPayload } from \"./hitl-interrupt-payload.js\";\nimport { Interrupt, ThreadState } from \"../schema.js\";\n\n/**\n * Normalizes HITL interrupt payloads to expose camelCase fields plus deprecated\n * snake_case aliases for compatibility during migration.\n */\nexport function normalizeInterruptForClient<T = unknown>(\n interrupt: Interrupt<T>\n): Interrupt<T> {\n if (interrupt.value === undefined) {\n return interrupt;\n }\n return {\n ...interrupt,\n value: normalizeHitlInterruptPayload(interrupt.value) as T,\n };\n}\n\n/**\n * Applies {@link normalizeInterruptForClient} to each interrupt.\n */\nexport function normalizeInterruptsList<T = unknown>(\n interrupts: Interrupt<T>[]\n): Interrupt<T>[] {\n return interrupts.map((i) => normalizeInterruptForClient(i));\n}\n\nexport function extractInterrupts<InterruptType = unknown>(\n values: unknown,\n options?: {\n isLoading: boolean;\n threadState: ThreadState | undefined;\n error: unknown;\n }\n): Interrupt<InterruptType> | undefined {\n if (\n typeof values === \"object\" &&\n values != null &&\n \"__interrupt__\" in values &&\n Array.isArray(values.__interrupt__)\n ) {\n const valueInterrupts = values.__interrupt__ as Interrupt<InterruptType>[];\n if (valueInterrupts.length === 0) return { when: \"breakpoint\" };\n if (valueInterrupts.length === 1) {\n return normalizeInterruptForClient(valueInterrupts[0]);\n }\n\n // TODO: fix the typing of interrupts if multiple interrupts are returned\n const normalized = valueInterrupts.map((i) =>\n normalizeInterruptForClient(i)\n );\n return normalized as unknown as Interrupt<InterruptType> | undefined;\n }\n\n // If we're deferring to old interrupt detection logic, don't show the interrupt if the stream is loading\n if (options?.isLoading) return undefined;\n\n const interrupts = options?.threadState?.tasks?.at(-1)?.interrupts;\n if (interrupts == null || interrupts.length === 0) {\n // check if there's a next task present\n const next = options?.threadState?.next ?? [];\n if (!next.length || options?.error != null) return undefined;\n return { when: \"breakpoint\" };\n }\n\n // Return only the current interrupt\n return normalizeInterruptForClient(\n interrupts.at(-1) as Interrupt<InterruptType>\n );\n}\n"],"mappings":";;;;;;AAOA,SAAgB,4BACd,WACc;AACd,KAAI,UAAU,UAAU,KAAA,EACtB,QAAO;AAET,QAAO;EACL,GAAG;EACH,OAAO,8BAA8B,UAAU,MAAM;EACtD;;;;;AAMH,SAAgB,wBACd,YACgB;AAChB,QAAO,WAAW,KAAK,MAAM,4BAA4B,EAAE,CAAC;;AAG9D,SAAgB,kBACd,QACA,SAKsC;AACtC,KACE,OAAO,WAAW,YAClB,UAAU,QACV,mBAAmB,UACnB,MAAM,QAAQ,OAAO,cAAc,EACnC;EACA,MAAM,kBAAkB,OAAO;AAC/B,MAAI,gBAAgB,WAAW,EAAG,QAAO,EAAE,MAAM,cAAc;AAC/D,MAAI,gBAAgB,WAAW,EAC7B,QAAO,4BAA4B,gBAAgB,GAAG;AAOxD,SAHmB,gBAAgB,KAAK,MACtC,4BAA4B,EAAE,CAC/B;;AAKH,KAAI,SAAS,UAAW,QAAO,KAAA;CAE/B,MAAM,aAAa,SAAS,aAAa,OAAO,GAAG,GAAG,EAAE;AACxD,KAAI,cAAc,QAAQ,WAAW,WAAW,GAAG;AAGjD,MAAI,EADS,SAAS,aAAa,QAAQ,EAAE,EACnC,UAAU,SAAS,SAAS,KAAM,QAAO,KAAA;AACnD,SAAO,EAAE,MAAM,cAAc;;AAI/B,QAAO,4BACL,WAAW,GAAG,GAAG,CAClB"}
|