@getuserfeedback/protocol 3.1.6 → 3.1.7
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/host/host-event-contract.d.ts +10 -0
- package/dist/host/host-event-contract.d.ts.map +1 -1
- package/dist/host/host-event-contract.js +6 -1
- package/dist/host/host-event-schemas.d.ts +1 -0
- package/dist/host/host-event-schemas.d.ts.map +1 -1
- package/dist/host/host-event-schemas.js +1 -0
- package/dist/webview-transport.d.ts +2 -0
- package/dist/webview-transport.d.ts.map +1 -1
- package/dist/webview-transport.js +1 -0
- package/package.json +1 -1
- package/src/host/host-event-contract.ts +26 -1
- package/src/host/host-event-schemas.ts +1 -0
- package/src/protocol-root.test.ts +56 -0
- package/src/webview-transport.ts +1 -0
|
@@ -21,9 +21,19 @@ export interface FlowStateChangedDetail extends FlowState {
|
|
|
21
21
|
}
|
|
22
22
|
export interface InstanceFlowStateChangedDetail extends FlowState {
|
|
23
23
|
instanceId: string;
|
|
24
|
+
/**
|
|
25
|
+
* True when the host container should render for the aggregate instance state.
|
|
26
|
+
* Older emitters omit this field; consumers should use
|
|
27
|
+
* resolveInstanceFlowStateShouldRender to preserve the legacy isOpen/isLoading
|
|
28
|
+
* behavior at compatibility boundaries.
|
|
29
|
+
*/
|
|
30
|
+
shouldRender?: boolean;
|
|
24
31
|
/** Flow handle for the currently pinned aggregate flow, when known. */
|
|
25
32
|
flowHandleId?: string;
|
|
26
33
|
}
|
|
34
|
+
export declare function resolveInstanceFlowStateShouldRender(detail: Pick<InstanceFlowStateChangedDetail, "isOpen" | "isLoading"> & {
|
|
35
|
+
shouldRender?: boolean;
|
|
36
|
+
}): boolean;
|
|
27
37
|
export interface OpenRequestedDetail {
|
|
28
38
|
instanceId: string;
|
|
29
39
|
source: "command" | "targeting";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-event-contract.d.ts","sourceRoot":"","sources":["../../src/host/host-event-contract.ts"],"names":[],"m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;IACxC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,uBAAuB,CAAC;IAChC,EAAE,EAAE,MAAM,CAAC;CACX;AAwBD,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,OAAO,GACb,MAAM,IAAI,sBAAsB,CAWlC;AAED,wBAAgB,gCAAgC,CAC/C,MAAM,EAAE,OAAO,GACb,MAAM,IAAI,8BAA8B,
|
|
1
|
+
{"version":3,"file":"host-event-contract.d.ts","sourceRoot":"","sources":["../../src/host/host-event-contract.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,6FAA6F;AAC7F,MAAM,WAAW,SAAS;IACzB,qCAAqC;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAuB,SAAQ,SAAS;IACxD,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,8BAA+B,SAAQ,SAAS;IAChE,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,oCAAoC,CACnD,MAAM,EAAE,IAAI,CAAC,8BAA8B,EAAE,QAAQ,GAAG,WAAW,CAAC,GAAG;IACtE,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB,GACC,OAAO,CAET;AAED,MAAM,WAAW,mBAAmB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,SAAS,GAAG,WAAW,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;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,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,GAAG,kCAAkC,GAAG,IAAI,CAU5C"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Types and type guards for flow state and lifecycle events.
|
|
3
3
|
*/
|
|
4
|
+
export function resolveInstanceFlowStateShouldRender(detail) {
|
|
5
|
+
return detail.shouldRender ?? (detail.isOpen || detail.isLoading);
|
|
6
|
+
}
|
|
4
7
|
export const HANDLE_INVALIDATED_REASON_CODES = [
|
|
5
8
|
"RESET",
|
|
6
9
|
"CLOSED",
|
|
@@ -34,10 +37,12 @@ export function isFlowStateChangedDetail(detail) {
|
|
|
34
37
|
export function isInstanceFlowStateChangedDetail(detail) {
|
|
35
38
|
if (!isRecord(detail))
|
|
36
39
|
return false;
|
|
37
|
-
const { instanceId, isOpen, isLoading, width, height, flowHandleId } = detail;
|
|
40
|
+
const { instanceId, isOpen, isLoading, shouldRender, width, height, flowHandleId, } = detail;
|
|
38
41
|
return (isNonEmptyString(instanceId) &&
|
|
39
42
|
typeof isOpen === "boolean" &&
|
|
40
43
|
typeof isLoading === "boolean" &&
|
|
44
|
+
(typeof shouldRender === "undefined" ||
|
|
45
|
+
typeof shouldRender === "boolean") &&
|
|
41
46
|
(typeof width === "undefined" || typeof width === "number") &&
|
|
42
47
|
(typeof height === "undefined" || typeof height === "number") &&
|
|
43
48
|
(typeof flowHandleId === "undefined" || isNonEmptyString(flowHandleId)));
|
|
@@ -81,6 +81,7 @@ export declare const flowStateChangedDetailSchema: z.ZodMiniObject<{
|
|
|
81
81
|
}, z.core.$strict>;
|
|
82
82
|
export type { FlowStateChangedDetail } from "./host-event-contract.js";
|
|
83
83
|
export declare const instanceFlowStateChangedDetailSchema: z.ZodMiniObject<{
|
|
84
|
+
shouldRender: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
84
85
|
flowHandleId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
85
86
|
instanceId: z.ZodMiniString<string>;
|
|
86
87
|
isOpen: z.ZodMiniBoolean<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-event-schemas.d.ts","sourceRoot":"","sources":["../../src/host/host-event-schemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAoB9B;;;GAGG;AACH,eAAO,MAAM,gCAAgC;;;kBAG3C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAChD,OAAO,gCAAgC,CACvC,CAAC;AAcF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAGrC,CAAC;AAEH,YAAY,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAUrE,eAAO,MAAM,4BAA4B;;;;;;;kBAGvC,CAAC;AAEH,YAAY,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEvE,eAAO,MAAM,oCAAoC
|
|
1
|
+
{"version":3,"file":"host-event-schemas.d.ts","sourceRoot":"","sources":["../../src/host/host-event-schemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAoB9B;;;GAGG;AACH,eAAO,MAAM,gCAAgC;;;kBAG3C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAChD,OAAO,gCAAgC,CACvC,CAAC;AAcF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAGrC,CAAC;AAEH,YAAY,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAUrE,eAAO,MAAM,4BAA4B;;;;;;;kBAGvC,CAAC;AAEH,YAAY,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEvE,eAAO,MAAM,oCAAoC;;;;;;;;kBAI/C,CAAC;AAEH,YAAY,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAE/E,eAAO,MAAM,yBAAyB;;;;;;;;;kBAMpC,CAAC;AAEH,YAAY,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;kBASxC,CAAC;AAEH,YAAY,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE;;GAEG;AACH,wBAAgB,+BAA+B,CAC9C,MAAM,EAAE,OAAO,GACb,0BAA0B,GAAG,IAAI,CAGnC;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE;IACzD,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,0BAA0B,GAAG,IAAI,CAUpC;AAED,YAAY,EAAE,kCAAkC,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,qCAAqC,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -50,6 +50,7 @@ export const flowStateChangedDetailSchema = z.strictObject({
|
|
|
50
50
|
});
|
|
51
51
|
export const instanceFlowStateChangedDetailSchema = z.strictObject({
|
|
52
52
|
...flowStateChangedBase,
|
|
53
|
+
shouldRender: z.optional(z.boolean()),
|
|
53
54
|
flowHandleId: z.optional(nonEmptyStringSchema),
|
|
54
55
|
});
|
|
55
56
|
export const openRequestedDetailSchema = z.strictObject({
|
|
@@ -964,6 +964,7 @@ export declare const webViewTransportHostEventSchema: z.ZodMiniDiscriminatedUnio
|
|
|
964
964
|
}, z.core.$strict>, z.ZodMiniObject<{
|
|
965
965
|
name: z.ZodMiniLiteral<"instance:flow:state-changed:instance">;
|
|
966
966
|
detail: z.ZodMiniObject<{
|
|
967
|
+
shouldRender: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
967
968
|
flowHandleId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
968
969
|
instanceId: z.ZodMiniString<string>;
|
|
969
970
|
isOpen: z.ZodMiniBoolean<boolean>;
|
|
@@ -1549,6 +1550,7 @@ export declare const webViewTransportWebMessageSchema: z.ZodMiniDiscriminatedUni
|
|
|
1549
1550
|
}, z.core.$strict>, z.ZodMiniObject<{
|
|
1550
1551
|
name: z.ZodMiniLiteral<"instance:flow:state-changed:instance">;
|
|
1551
1552
|
detail: z.ZodMiniObject<{
|
|
1553
|
+
shouldRender: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
1552
1554
|
flowHandleId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1553
1555
|
instanceId: z.ZodMiniString<string>;
|
|
1554
1556
|
isOpen: z.ZodMiniBoolean<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webview-transport.d.ts","sourceRoot":"","sources":["../src/webview-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAgB9B,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAa3C,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAC5C,OAAO,4BAA4B,CACnC,CAAC;AACF,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CACnD,OAAO,mCAAmC,CAC1C,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAC/C,OAAO,+BAA+B,CACtC,CAAC;AACF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAChD,OAAO,gCAAgC,CACvC,CAAC;AAEF,wBAAgB,kCAAkC,CACjD,KAAK,EAAE,OAAO,GACZ,6BAA6B,CAE/B;AAED,wBAAgB,+BAA+B,CAC9C,KAAK,EAAE,OAAO,GACZ,0BAA0B,CAE5B"}
|
|
@@ -47,6 +47,7 @@ const flowStateChangedDetailSchema = z.strictObject({
|
|
|
47
47
|
});
|
|
48
48
|
const instanceFlowStateChangedDetailSchema = z.strictObject({
|
|
49
49
|
...flowStateBase,
|
|
50
|
+
shouldRender: z.optional(z.boolean()),
|
|
50
51
|
flowHandleId: z.optional(nonEmptyStringSchema),
|
|
51
52
|
});
|
|
52
53
|
const openRequestedDetailSchema = z.strictObject({
|
package/package.json
CHANGED
|
@@ -24,10 +24,25 @@ export interface FlowStateChangedDetail extends FlowState {
|
|
|
24
24
|
|
|
25
25
|
export interface InstanceFlowStateChangedDetail extends FlowState {
|
|
26
26
|
instanceId: string;
|
|
27
|
+
/**
|
|
28
|
+
* True when the host container should render for the aggregate instance state.
|
|
29
|
+
* Older emitters omit this field; consumers should use
|
|
30
|
+
* resolveInstanceFlowStateShouldRender to preserve the legacy isOpen/isLoading
|
|
31
|
+
* behavior at compatibility boundaries.
|
|
32
|
+
*/
|
|
33
|
+
shouldRender?: boolean;
|
|
27
34
|
/** Flow handle for the currently pinned aggregate flow, when known. */
|
|
28
35
|
flowHandleId?: string;
|
|
29
36
|
}
|
|
30
37
|
|
|
38
|
+
export function resolveInstanceFlowStateShouldRender(
|
|
39
|
+
detail: Pick<InstanceFlowStateChangedDetail, "isOpen" | "isLoading"> & {
|
|
40
|
+
shouldRender?: boolean;
|
|
41
|
+
},
|
|
42
|
+
): boolean {
|
|
43
|
+
return detail.shouldRender ?? (detail.isOpen || detail.isLoading);
|
|
44
|
+
}
|
|
45
|
+
|
|
31
46
|
export interface OpenRequestedDetail {
|
|
32
47
|
instanceId: string;
|
|
33
48
|
source: "command" | "targeting";
|
|
@@ -118,11 +133,21 @@ export function isInstanceFlowStateChangedDetail(
|
|
|
118
133
|
detail: unknown,
|
|
119
134
|
): detail is InstanceFlowStateChangedDetail {
|
|
120
135
|
if (!isRecord(detail)) return false;
|
|
121
|
-
const {
|
|
136
|
+
const {
|
|
137
|
+
instanceId,
|
|
138
|
+
isOpen,
|
|
139
|
+
isLoading,
|
|
140
|
+
shouldRender,
|
|
141
|
+
width,
|
|
142
|
+
height,
|
|
143
|
+
flowHandleId,
|
|
144
|
+
} = detail;
|
|
122
145
|
return (
|
|
123
146
|
isNonEmptyString(instanceId) &&
|
|
124
147
|
typeof isOpen === "boolean" &&
|
|
125
148
|
typeof isLoading === "boolean" &&
|
|
149
|
+
(typeof shouldRender === "undefined" ||
|
|
150
|
+
typeof shouldRender === "boolean") &&
|
|
126
151
|
(typeof width === "undefined" || typeof width === "number") &&
|
|
127
152
|
(typeof height === "undefined" || typeof height === "number") &&
|
|
128
153
|
(typeof flowHandleId === "undefined" || isNonEmptyString(flowHandleId))
|
|
@@ -71,6 +71,7 @@ export type { FlowStateChangedDetail } from "./host-event-contract.js";
|
|
|
71
71
|
|
|
72
72
|
export const instanceFlowStateChangedDetailSchema = z.strictObject({
|
|
73
73
|
...flowStateChangedBase,
|
|
74
|
+
shouldRender: z.optional(z.boolean()),
|
|
74
75
|
flowHandleId: z.optional(nonEmptyStringSchema),
|
|
75
76
|
});
|
|
76
77
|
|
|
@@ -486,6 +486,62 @@ describe("@getuserfeedback/protocol root contract", () => {
|
|
|
486
486
|
},
|
|
487
487
|
});
|
|
488
488
|
|
|
489
|
+
expect(
|
|
490
|
+
parseWebViewTransportWebMessage({
|
|
491
|
+
kind: "hostEvent",
|
|
492
|
+
event: {
|
|
493
|
+
name: "instance:flow:state-changed:instance",
|
|
494
|
+
detail: {
|
|
495
|
+
instanceId: "instance_123",
|
|
496
|
+
isOpen: false,
|
|
497
|
+
isLoading: true,
|
|
498
|
+
},
|
|
499
|
+
},
|
|
500
|
+
}),
|
|
501
|
+
).toEqual({
|
|
502
|
+
kind: "hostEvent",
|
|
503
|
+
event: {
|
|
504
|
+
name: "instance:flow:state-changed:instance",
|
|
505
|
+
detail: {
|
|
506
|
+
instanceId: "instance_123",
|
|
507
|
+
isOpen: false,
|
|
508
|
+
isLoading: true,
|
|
509
|
+
},
|
|
510
|
+
},
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
expect(
|
|
514
|
+
parseWebViewTransportWebMessage({
|
|
515
|
+
kind: "hostEvent",
|
|
516
|
+
event: {
|
|
517
|
+
name: "instance:flow:state-changed:instance",
|
|
518
|
+
detail: {
|
|
519
|
+
instanceId: "instance_123",
|
|
520
|
+
isOpen: false,
|
|
521
|
+
isLoading: true,
|
|
522
|
+
shouldRender: true,
|
|
523
|
+
width: 320,
|
|
524
|
+
height: 480,
|
|
525
|
+
flowHandleId: "handle_123",
|
|
526
|
+
},
|
|
527
|
+
},
|
|
528
|
+
}),
|
|
529
|
+
).toEqual({
|
|
530
|
+
kind: "hostEvent",
|
|
531
|
+
event: {
|
|
532
|
+
name: "instance:flow:state-changed:instance",
|
|
533
|
+
detail: {
|
|
534
|
+
instanceId: "instance_123",
|
|
535
|
+
isOpen: false,
|
|
536
|
+
isLoading: true,
|
|
537
|
+
shouldRender: true,
|
|
538
|
+
width: 320,
|
|
539
|
+
height: 480,
|
|
540
|
+
flowHandleId: "handle_123",
|
|
541
|
+
},
|
|
542
|
+
},
|
|
543
|
+
});
|
|
544
|
+
|
|
489
545
|
expect(
|
|
490
546
|
parseWebViewTransportWebMessage({
|
|
491
547
|
kind: "hostEvent",
|
package/src/webview-transport.ts
CHANGED