@yankeguo/dsh-devlead-protocol 0.2.6 → 0.3.0-rc.1
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/lib/client.js +19 -8
- package/lib/index.js +19 -8
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -21,7 +21,13 @@ var DEVLEAD_REPORT_SUMMARY_MAX = 200;
|
|
|
21
21
|
var DEVLEAD_REPORT_MAX_PER_TURN = 4;
|
|
22
22
|
var DEVLEAD_REPORT_RETENTION = 64;
|
|
23
23
|
var DEVLEAD_MAX_INSTANT = 864e13;
|
|
24
|
-
var DEVLEAD_REPORT_KINDS = [
|
|
24
|
+
var DEVLEAD_REPORT_KINDS = [
|
|
25
|
+
"progress",
|
|
26
|
+
"blocked",
|
|
27
|
+
"decision",
|
|
28
|
+
"question",
|
|
29
|
+
"fyi"
|
|
30
|
+
];
|
|
25
31
|
|
|
26
32
|
// packages/protocol/src/format.ts
|
|
27
33
|
var DEVLEAD_TRANSITIONS = [
|
|
@@ -62,12 +68,15 @@ function transitionLabel(transition) {
|
|
|
62
68
|
return TRANSITION_LABELS[transition];
|
|
63
69
|
}
|
|
64
70
|
function presentLine(value) {
|
|
65
|
-
if (value
|
|
71
|
+
if (typeof value !== "string") return void 0;
|
|
66
72
|
return excerptLine(value, DEVLEAD_ERROR_EXCERPT_MAX);
|
|
67
73
|
}
|
|
74
|
+
function sessionRefLabel(sessionId, title) {
|
|
75
|
+
const line = presentLine(title);
|
|
76
|
+
return line === void 0 ? sessionId : `${line} (${sessionId})`;
|
|
77
|
+
}
|
|
68
78
|
function notificationLine(notification) {
|
|
69
|
-
const
|
|
70
|
-
const who = title === void 0 ? notification.sessionId : `${title} (${notification.sessionId})`;
|
|
79
|
+
const who = sessionRefLabel(notification.sessionId, notification.sessionTitle);
|
|
71
80
|
const error = presentLine(notification.error);
|
|
72
81
|
const detail = error ?? presentLine(notification.summary);
|
|
73
82
|
const suffix = detail === void 0 ? "" : `: ${detail}`;
|
|
@@ -83,6 +92,7 @@ var REPORT_KIND_LABELS = {
|
|
|
83
92
|
progress: "progress",
|
|
84
93
|
blocked: "blocked",
|
|
85
94
|
decision: "decision needed",
|
|
95
|
+
question: "question",
|
|
86
96
|
fyi: "fyi"
|
|
87
97
|
};
|
|
88
98
|
function isDevLeadReportKind(value) {
|
|
@@ -97,11 +107,11 @@ function devLeadReportId(senderSessionId, turn, kind, message) {
|
|
|
97
107
|
return `${senderSessionId}:${turn}:report:${kind}:${(hash >>> 0).toString(36)}`;
|
|
98
108
|
}
|
|
99
109
|
function reportLine(report) {
|
|
100
|
-
const
|
|
101
|
-
const
|
|
102
|
-
const detail = presentLine(report.summary) ?? excerptLine(report.message, DEVLEAD_ERROR_EXCERPT_MAX);
|
|
110
|
+
const who = sessionRefLabel(report.senderSessionId, report.senderSessionTitle);
|
|
111
|
+
const detail = presentLine(report.summary) ?? presentLine(report.message);
|
|
103
112
|
const suffix = detail === void 0 ? "" : `: ${detail}`;
|
|
104
|
-
|
|
113
|
+
const kind = REPORT_KIND_LABELS[report.kind] ?? String(report.kind);
|
|
114
|
+
return `${who} \u2014 report ${kind}${suffix}`;
|
|
105
115
|
}
|
|
106
116
|
function reportDigest(reports) {
|
|
107
117
|
return reports.map(reportLine);
|
|
@@ -139,5 +149,6 @@ export {
|
|
|
139
149
|
notificationLine,
|
|
140
150
|
reportDigest,
|
|
141
151
|
reportLine,
|
|
152
|
+
sessionRefLabel,
|
|
142
153
|
transitionLabel
|
|
143
154
|
};
|
package/lib/index.js
CHANGED
|
@@ -21,7 +21,13 @@ var DEVLEAD_REPORT_SUMMARY_MAX = 200;
|
|
|
21
21
|
var DEVLEAD_REPORT_MAX_PER_TURN = 4;
|
|
22
22
|
var DEVLEAD_REPORT_RETENTION = 64;
|
|
23
23
|
var DEVLEAD_MAX_INSTANT = 864e13;
|
|
24
|
-
var DEVLEAD_REPORT_KINDS = [
|
|
24
|
+
var DEVLEAD_REPORT_KINDS = [
|
|
25
|
+
"progress",
|
|
26
|
+
"blocked",
|
|
27
|
+
"decision",
|
|
28
|
+
"question",
|
|
29
|
+
"fyi"
|
|
30
|
+
];
|
|
25
31
|
|
|
26
32
|
// packages/protocol/src/format.ts
|
|
27
33
|
var DEVLEAD_TRANSITIONS = [
|
|
@@ -62,12 +68,15 @@ function transitionLabel(transition) {
|
|
|
62
68
|
return TRANSITION_LABELS[transition];
|
|
63
69
|
}
|
|
64
70
|
function presentLine(value) {
|
|
65
|
-
if (value
|
|
71
|
+
if (typeof value !== "string") return void 0;
|
|
66
72
|
return excerptLine(value, DEVLEAD_ERROR_EXCERPT_MAX);
|
|
67
73
|
}
|
|
74
|
+
function sessionRefLabel(sessionId, title) {
|
|
75
|
+
const line = presentLine(title);
|
|
76
|
+
return line === void 0 ? sessionId : `${line} (${sessionId})`;
|
|
77
|
+
}
|
|
68
78
|
function notificationLine(notification) {
|
|
69
|
-
const
|
|
70
|
-
const who = title === void 0 ? notification.sessionId : `${title} (${notification.sessionId})`;
|
|
79
|
+
const who = sessionRefLabel(notification.sessionId, notification.sessionTitle);
|
|
71
80
|
const error = presentLine(notification.error);
|
|
72
81
|
const detail = error ?? presentLine(notification.summary);
|
|
73
82
|
const suffix = detail === void 0 ? "" : `: ${detail}`;
|
|
@@ -83,6 +92,7 @@ var REPORT_KIND_LABELS = {
|
|
|
83
92
|
progress: "progress",
|
|
84
93
|
blocked: "blocked",
|
|
85
94
|
decision: "decision needed",
|
|
95
|
+
question: "question",
|
|
86
96
|
fyi: "fyi"
|
|
87
97
|
};
|
|
88
98
|
function isDevLeadReportKind(value) {
|
|
@@ -97,11 +107,11 @@ function devLeadReportId(senderSessionId, turn, kind, message) {
|
|
|
97
107
|
return `${senderSessionId}:${turn}:report:${kind}:${(hash >>> 0).toString(36)}`;
|
|
98
108
|
}
|
|
99
109
|
function reportLine(report) {
|
|
100
|
-
const
|
|
101
|
-
const
|
|
102
|
-
const detail = presentLine(report.summary) ?? excerptLine(report.message, DEVLEAD_ERROR_EXCERPT_MAX);
|
|
110
|
+
const who = sessionRefLabel(report.senderSessionId, report.senderSessionTitle);
|
|
111
|
+
const detail = presentLine(report.summary) ?? presentLine(report.message);
|
|
103
112
|
const suffix = detail === void 0 ? "" : `: ${detail}`;
|
|
104
|
-
|
|
113
|
+
const kind = REPORT_KIND_LABELS[report.kind] ?? String(report.kind);
|
|
114
|
+
return `${who} \u2014 report ${kind}${suffix}`;
|
|
105
115
|
}
|
|
106
116
|
function reportDigest(reports) {
|
|
107
117
|
return reports.map(reportLine);
|
|
@@ -139,5 +149,6 @@ export {
|
|
|
139
149
|
notificationLine,
|
|
140
150
|
reportDigest,
|
|
141
151
|
reportLine,
|
|
152
|
+
sessionRefLabel,
|
|
142
153
|
transitionLabel
|
|
143
154
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yankeguo/dsh-devlead-protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-rc.1",
|
|
4
4
|
"description": "Pure shared protocol of the devlead plugin suite: durable mode, watched-session and notification types, plus the pure fold and formatting rules used by both Host and browser.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|