@markus-global/cli 0.12.0-rc.3 → 0.12.1-rc.0
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/commands/approval-card.d.ts +22 -1
- package/dist/commands/approval-card.d.ts.map +1 -1
- package/dist/commands/approval-card.js +25 -1
- package/dist/commands/approval-card.js.map +1 -1
- package/dist/commands/outbound.d.ts +8 -1
- package/dist/commands/outbound.d.ts.map +1 -1
- package/dist/commands/outbound.js +1 -0
- package/dist/commands/outbound.js.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +93 -7
- package/dist/commands/start.js.map +1 -1
- package/dist/markus.mjs +1906 -964
- package/dist/web-ui/assets/{AsyncState-Bn4fEZi_.js → AsyncState-BE4ycfHk.js} +1 -1
- package/dist/web-ui/assets/{CommentInput-K5GGyiKb.js → CommentInput-DQIh2AYB.js} +1 -1
- package/dist/web-ui/assets/{ContentRenderer-BfUE28DF.js → ContentRenderer-C0L1YkNl.js} +2 -2
- package/dist/web-ui/assets/{DeliverableShareModal-BA31hw63.js → DeliverableShareModal-KlLlP9Fe.js} +1 -1
- package/dist/web-ui/assets/{Deliverables-DTE21gMR.js → Deliverables-CiqT2Ipg.js} +1 -1
- package/dist/web-ui/assets/{Notifications-DrhzF29n.js → Notifications-82rU7lAf.js} +1 -1
- package/dist/web-ui/assets/{Search-B_FQwfHn.js → Search-CNNN3duL.js} +1 -1
- package/dist/web-ui/assets/SendToChat-EsNVdiYI.js +1 -0
- package/dist/web-ui/assets/Settings-COmJTMaX.js +8 -0
- package/dist/web-ui/assets/{Store-CvRIK-5v.js → Store-Cb-RBY68.js} +1 -1
- package/dist/web-ui/assets/{Switch-DBd7W9Pv.js → Switch-SqNs6-fd.js} +1 -1
- package/dist/web-ui/assets/{Team-Cre9JXT2.js → Team-DA5MQ-20.js} +31 -31
- package/dist/web-ui/assets/Work-D4noaLBo.js +142 -0
- package/dist/web-ui/assets/{arc-B8WSMmgB.js → arc-BOFJ1EJN.js} +1 -1
- package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-DE0fnpkU.js → architectureDiagram-3BPJPVTR-BQ0qr0Vl.js} +1 -1
- package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-BnEt7L8I.js → blockDiagram-GPEHLZMM-kSXlCE5q.js} +1 -1
- package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-0jt--EpH.js → c4Diagram-AAUBKEIU-kCxqEGe5.js} +1 -1
- package/dist/web-ui/assets/channel-MEPTI8rz.js +1 -0
- package/dist/web-ui/assets/{chunk-2J33WTMH-CLyqQEQo.js → chunk-2J33WTMH-BgMluOvE.js} +1 -1
- package/dist/web-ui/assets/{chunk-4BX2VUAB-mylnMthq.js → chunk-4BX2VUAB-tu9bzY5y.js} +1 -1
- package/dist/web-ui/assets/{chunk-55IACEB6-DtElV09S.js → chunk-55IACEB6-DK9D0I2N.js} +1 -1
- package/dist/web-ui/assets/{chunk-727SXJPM-BpRwLol3.js → chunk-727SXJPM-D_5Cdc0d.js} +1 -1
- package/dist/web-ui/assets/{chunk-AQP2D5EJ-5yxNM2TB.js → chunk-AQP2D5EJ-BUmO_w99.js} +1 -1
- package/dist/web-ui/assets/{chunk-FMBD7UC4-no_NwFEB.js → chunk-FMBD7UC4-Ck9FWl7n.js} +1 -1
- package/dist/web-ui/assets/{chunk-ND2GUHAM-JvDwwYzS.js → chunk-ND2GUHAM-Mvxy6fm4.js} +1 -1
- package/dist/web-ui/assets/{chunk-QZHKN3VN-C-NPps0e.js → chunk-QZHKN3VN-C9xMd3WM.js} +1 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-C-iFEC5t.js +1 -0
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-C-iFEC5t.js +1 -0
- package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-OUCdAUoH.js → cose-bilkent-S5V4N54A-CUTkidkC.js} +1 -1
- package/dist/web-ui/assets/{dagre-BM42HDAG-BJNrdNyh.js → dagre-BM42HDAG-CGLda2Em.js} +1 -1
- package/dist/web-ui/assets/{diagram-2AECGRRQ-CXqfw0Vf.js → diagram-2AECGRRQ-DRl88ns2.js} +1 -1
- package/dist/web-ui/assets/{diagram-5GNKFQAL-Dhik8K7x.js → diagram-5GNKFQAL-rf4YhM9A.js} +1 -1
- package/dist/web-ui/assets/{diagram-KO2AKTUF-DzTqoIpG.js → diagram-KO2AKTUF-BD8mjYi6.js} +1 -1
- package/dist/web-ui/assets/{diagram-LMA3HP47-CzPaYK-1.js → diagram-LMA3HP47-DiZICe4t.js} +1 -1
- package/dist/web-ui/assets/{diagram-OG6HWLK6-D3i9cNLV.js → diagram-OG6HWLK6-Dj0Mw95G.js} +1 -1
- package/dist/web-ui/assets/{docx-preview-BE8zQneZ.js → docx-preview-DQSKxlsK.js} +1 -1
- package/dist/web-ui/assets/{erDiagram-TEJ5UH35-DZ6wi5nS.js → erDiagram-TEJ5UH35-BQq31SZZ.js} +1 -1
- package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-CEbBUrOM.js → flowDiagram-I6XJVG4X-Cc82cW20.js} +1 -1
- package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-lo_doOaC.js → ganttDiagram-6RSMTGT7-D1MzI2Uw.js} +1 -1
- package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-C3mdtDuF.js → gitGraphDiagram-PVQCEYII-D1v-40GN.js} +1 -1
- package/dist/web-ui/assets/index-B0GCqbye.css +1 -0
- package/dist/web-ui/assets/{index-DyYU0JDE.js → index-BXWHxoXp.js} +61 -61
- package/dist/web-ui/assets/{infoDiagram-5YYISTIA-6I0hh52X.js → infoDiagram-5YYISTIA-COPRgK1x.js} +1 -1
- package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-BOk8zKdQ.js → ishikawaDiagram-YF4QCWOH-BmrWPE_9.js} +1 -1
- package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-C3KEoO7x.js → journeyDiagram-JHISSGLW-C7WKxQjK.js} +1 -1
- package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-DCT0_9gO.js → kanban-definition-UN3LZRKU-yNU5HtNI.js} +1 -1
- package/dist/web-ui/assets/{linear-D1g5s_fh.js → linear-BITZw-sC.js} +1 -1
- package/dist/web-ui/assets/{mermaid.core-BOX2l4yL.js → mermaid.core-B-JixiD0.js} +5 -5
- package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-KkRXcsxC.js → mindmap-definition-RKZ34NQL-CIC2Ov1E.js} +1 -1
- package/dist/web-ui/assets/{pieDiagram-4H26LBE5-Crj5MjvX.js → pieDiagram-4H26LBE5-CJn4Ut9d.js} +1 -1
- package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-CKhlan97.js → quadrantDiagram-W4KKPZXB-DcRyVlzO.js} +1 -1
- package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-B7OrOTSq.js → requirementDiagram-4Y6WPE33-DiNbCJGt.js} +1 -1
- package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-CzvhKY35.js → sankeyDiagram-5OEKKPKP-RHicfbUP.js} +1 -1
- package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-CiNjJsfF.js → sequenceDiagram-3UESZ5HK-P1XTa1MM.js} +1 -1
- package/dist/web-ui/assets/{stateDiagram-AJRCARHV-DBsBa5mY.js → stateDiagram-AJRCARHV-Dbu2PX-0.js} +1 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-BVoD4Uz4.js +1 -0
- package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-CL-8e5v_.js → timeline-definition-PNZ67QCA-DGJ5VfHk.js} +1 -1
- package/dist/web-ui/assets/{transform-CpIVI4vC.js → transform-BqqRT-Iy.js} +1 -1
- package/dist/web-ui/assets/{value-DIujSiJ7.js → value-wA6veExk.js} +1 -1
- package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-CWgqoJu8.js → vennDiagram-CIIHVFJN-B9fLD2oz.js} +1 -1
- package/dist/web-ui/assets/{wardley-L42UT6IY-ZgIWnerm.js → wardley-L42UT6IY-CH2NYUlK.js} +1 -1
- package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-CBWa7zOH.js → wardleyDiagram-YWT4CUSO-efQZMvBj.js} +1 -1
- package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-Du9MvrT6.js → xychartDiagram-2RQKCTM6-BNcrfIXF.js} +1 -1
- package/dist/web-ui/index.html +2 -2
- package/docs/analysis/2026-10-29-a2a-cache-hit-rate.md +347 -0
- package/docs/architecture/concurrent-processing.md +9 -1
- package/docs/architecture/notify-user-context-truth.md +91 -0
- package/package.json +1 -1
- package/dist/web-ui/assets/SendToChat-DjBI_C0Z.js +0 -1
- package/dist/web-ui/assets/Settings-BG3HtYuY.js +0 -8
- package/dist/web-ui/assets/Work-C77VUxw5.js +0 -12
- package/dist/web-ui/assets/channel-MmWww9CF.js +0 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-lROpDb6P.js +0 -1
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-lROpDb6P.js +0 -1
- package/dist/web-ui/assets/index-D4zDaGe4.css +0 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-DsfVE1eK.js +0 -1
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* logged upstream, never fatal, and never rolls the approval back.
|
|
21
21
|
*/
|
|
22
22
|
import type { CardResolution } from '@markus/comms';
|
|
23
|
-
/** Renderable
|
|
23
|
+
/** Renderable states of a resolved approval card. */
|
|
24
24
|
export type TerminalApprovalStatus = NonNullable<CardResolution['status']>;
|
|
25
25
|
/** Post-ack delay before the card PATCH. Long enough for the ack round-trip to
|
|
26
26
|
* win the race it is supposed to win; short enough to feel instant. */
|
|
@@ -43,6 +43,27 @@ export declare function buildApprovalCardResolution(approval: {
|
|
|
43
43
|
actorName?: string;
|
|
44
44
|
tappedOption?: string;
|
|
45
45
|
}): CardResolution;
|
|
46
|
+
/**
|
|
47
|
+
* Which actor fields may be handed to a platform card.
|
|
48
|
+
*
|
|
49
|
+
* An approval record's `respondedBy` is **provenance, not a platform handle**: a
|
|
50
|
+
* decision made in the Markus UI carries a Markus user id, and Feishu rejects the
|
|
51
|
+
* entire card when that id is used as an `<at id=…>` mention (ErrCode 100290,
|
|
52
|
+
* measured 2026-10-29: the card update failed and the chat card stayed clickable).
|
|
53
|
+
*
|
|
54
|
+
* So the id travels only when the platform itself resolved a display name for it
|
|
55
|
+
* (that is proof it is that platform's handle). Otherwise only the human's name
|
|
56
|
+
* travels — and if we do not even know the name, nothing does. A missing actor
|
|
57
|
+
* line is correct; an invalid one takes the whole card down with it.
|
|
58
|
+
*/
|
|
59
|
+
export declare function cardActorFields(opts: {
|
|
60
|
+
platformName?: string | null;
|
|
61
|
+
respondedBy?: string;
|
|
62
|
+
humanName?: string;
|
|
63
|
+
}): {
|
|
64
|
+
actorId?: string;
|
|
65
|
+
actorName?: string;
|
|
66
|
+
};
|
|
46
67
|
/**
|
|
47
68
|
* Run a card rewrite after the callback ack, best-effort. Never rejects (a
|
|
48
69
|
* rejection must not become an unhandled one on a timer); failures are handed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval-card.d.ts","sourceRoot":"","sources":["../../src/commands/approval-card.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,
|
|
1
|
+
{"version":3,"file":"approval-card.d.ts","sourceRoot":"","sources":["../../src/commands/approval-card.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,qDAAqD;AACrD,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE3E;wEACwE;AACxE,eAAO,MAAM,qBAAqB,OAAQ,CAAC;AAI3C;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE;IACR,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,EACD,GAAG,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,GACnE,cAAc,CAgBhB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE;IACpC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAO3C;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,EAC/B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GACjC,OAAO,CAAC,IAAI,CAAC,CAWf"}
|
|
@@ -12,7 +12,10 @@ export function buildApprovalCardResolution(approval, tap) {
|
|
|
12
12
|
return {
|
|
13
13
|
status: (TERMINAL_STATUSES.has(approval.status)
|
|
14
14
|
? approval.status
|
|
15
|
-
|
|
15
|
+
// A request that is still pending (e.g. the tap was refused because the form
|
|
16
|
+
// needs an answer in the app) must NOT be rendered as `expired` — that says
|
|
17
|
+
// the request died, which is false and invites a duplicate.
|
|
18
|
+
: 'pending'),
|
|
16
19
|
title: approval.title,
|
|
17
20
|
body: approval.description,
|
|
18
21
|
actorId: approval.respondedBy ?? tap.actorId,
|
|
@@ -22,6 +25,27 @@ export function buildApprovalCardResolution(approval, tap) {
|
|
|
22
25
|
at: approval.respondedAt,
|
|
23
26
|
};
|
|
24
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Which actor fields may be handed to a platform card.
|
|
30
|
+
*
|
|
31
|
+
* An approval record's `respondedBy` is **provenance, not a platform handle**: a
|
|
32
|
+
* decision made in the Markus UI carries a Markus user id, and Feishu rejects the
|
|
33
|
+
* entire card when that id is used as an `<at id=…>` mention (ErrCode 100290,
|
|
34
|
+
* measured 2026-10-29: the card update failed and the chat card stayed clickable).
|
|
35
|
+
*
|
|
36
|
+
* So the id travels only when the platform itself resolved a display name for it
|
|
37
|
+
* (that is proof it is that platform's handle). Otherwise only the human's name
|
|
38
|
+
* travels — and if we do not even know the name, nothing does. A missing actor
|
|
39
|
+
* line is correct; an invalid one takes the whole card down with it.
|
|
40
|
+
*/
|
|
41
|
+
export function cardActorFields(opts) {
|
|
42
|
+
if (opts.platformName && opts.respondedBy) {
|
|
43
|
+
return { actorId: opts.respondedBy, actorName: opts.platformName };
|
|
44
|
+
}
|
|
45
|
+
const name = opts.humanName?.trim();
|
|
46
|
+
// Card text is `lark_md`; a name carrying markup is not a name.
|
|
47
|
+
return name && !/[<>]/.test(name) ? { actorName: name } : {};
|
|
48
|
+
}
|
|
25
49
|
/**
|
|
26
50
|
* Run a card rewrite after the callback ack, best-effort. Never rejects (a
|
|
27
51
|
* rejection must not become an unhandled one on a timer); failures are handed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval-card.js","sourceRoot":"","sources":["../../src/commands/approval-card.ts"],"names":[],"mappings":"AA0BA;wEACwE;AACxE,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAE3C,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;AAEpF;;;;;GA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AAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,OAAO,CAAC,OAAO,EAAE;iBACd,IAAI,CAAC,OAAO,CAAC;iBACb,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;iBAC3C,OAAO,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC,EAAE,qBAAqB,CAAC,CAAC;QAC1B,wDAAwD;QACxD,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* notifier, which is why no other platform could carry one. Nothing here is
|
|
10
10
|
* platform-specific: a new platform becomes reachable by having an instance row.
|
|
11
11
|
*/
|
|
12
|
-
import { OutboundDispatcher, type BindingRowLike, type InstanceSource, type NotificationSource, type SendOptions, type PlatformField } from '@markus/comms';
|
|
12
|
+
import { OutboundDispatcher, type BindingRowLike, type InstanceSource, type NotificationSource, type SendOptions, type PlatformField, type NotificationLike, type DispatchOutcome } from '@markus/comms';
|
|
13
13
|
export interface OutboundWiringOptions {
|
|
14
14
|
router: {
|
|
15
15
|
sendToChannel(platform: string, channelId: string, content: string, instanceId?: string, options?: SendOptions): Promise<string | undefined>;
|
|
@@ -61,6 +61,13 @@ export interface OutboundWiringOptions {
|
|
|
61
61
|
* stays usable in a context that knows nothing about users.
|
|
62
62
|
*/
|
|
63
63
|
locale?: () => string | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Delivered-message hook. The only place a caller ever learns the platform
|
|
66
|
+
* message id — and that id is what a later state change needs in order to
|
|
67
|
+
* converge the message the human is holding (e.g. an approval card decided in
|
|
68
|
+
* the Markus UI must stop looking clickable in the chat app).
|
|
69
|
+
*/
|
|
70
|
+
onDelivered?: (notification: NotificationLike, outcome: DispatchOutcome) => void;
|
|
64
71
|
}
|
|
65
72
|
export interface OutboundWiring {
|
|
66
73
|
dispatcher: OutboundDispatcher;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outbound.d.ts","sourceRoot":"","sources":["../../src/commands/outbound.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,kBAAkB,EAMlB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"outbound.d.ts","sourceRoot":"","sources":["../../src/commands/outbound.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,kBAAkB,EAMlB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AAKvB,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE;QACN,aAAa,CACX,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;KAChC,CAAC;IACF,iEAAiE;IACjE,WAAW,CAAC,EAAE;QAAE,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,EAAE,CAAA;KAAE,CAAC;IAC7D;;;;OAIG;IACH,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAC1C;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,aAAa,EAAE,CAAC;IAClD,gDAAgD;IAChD,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,yDAAyD;IACzD,QAAQ,CAAC,EAAE;QAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI,CAAA;KAAE,CAAC;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACpD;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACxD;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAClC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,CAAC,YAAY,EAAE,gBAAgB,EAAE,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;CAClF;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,kBAAkB,CAAC;IAC/B,qDAAqD;IACrD,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,qBAAqB,GAAG,cAAc,GAAG,SAAS,CAiE7F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outbound.js","sourceRoot":"","sources":["../../src/commands/outbound.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,
|
|
1
|
+
{"version":3,"file":"outbound.js","sourceRoot":"","sources":["../../src/commands/outbound.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,GAQZ,MAAM,eA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AAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAqDhH;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,aAAa,CAAC;IACtB,kFAAkF;IAClF,IAAI,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3D;AAED;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,oBAAoB,GAAG,MAAM,CAejF;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAsBpD;AAED,wBAAsB,cAAc,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC;;;;;;;;;;;;;GAmazE;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,EACrC,MAAM,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GACjG,OAAO,CAAC,eAAe,CAAC,CAG1B"}
|
package/dist/commands/start.js
CHANGED
|
@@ -5,10 +5,10 @@ import { createRequire } from 'node:module';
|
|
|
5
5
|
import { allTemplateDirs, resolveTemplatesDir, resolveWebUiDir } from '../paths.js';
|
|
6
6
|
import { loadConfig, saveConfig, getDefaultConfigPath, createLogger, closeRuntimeLogger, checkForUpdate, installCrashGuard, markRunStarted, markCleanShutdown, memoryWatermarkWatchdog, detectUncleanShutdown, APP_VERSION, userId, PROVIDERS, resolveJwtSecret, resolveGatewaySecret, pickOrgSecretary, setEnvValue, resolveActionSecret, resolveHostLocale, } from '@markus/shared';
|
|
7
7
|
import { AgentManager, LLMRouter, LLMLogger, ModelCatalogService, RoleLoader, createDefaultSkillRegistry, ExternalAgentGateway, proxyFetch, } from '@markus/core';
|
|
8
|
-
import { OrganizationService, TaskService, APIServer, HITLService, ApprovalApplier, routeRecordedDecision, BillingService, LicenseService, TelemetryService, AuditService, ProjectService, RequirementService, KnowledgeService, FileKnowledgeStore, DeliverableService, KnowledgeSyncService, ReportService, TrustService, ArchiveService, StaleDetector, ScheduledTaskRunner, initStorage, searchRegistries, installSkill, importSkillFromDirectory, WorkflowService, WorkflowRunner, WorkflowScheduler, loadPlatformBindings, readStoredPlatformConfig, recordInstanceVerification, } from '@markus/org-manager';
|
|
8
|
+
import { OrganizationService, TaskService, APIServer, HITLService, ApprovalApplier, routeRecordedDecision, BillingService, LicenseService, TelemetryService, AuditService, ProjectService, RequirementService, KnowledgeService, FileKnowledgeStore, DeliverableService, KnowledgeSyncService, ReportService, TrustService, ArchiveService, StaleDetector, ScheduledTaskRunner, initStorage, searchRegistries, installSkill, importSkillFromDirectory, WorkflowService, WorkflowRunner, WorkflowScheduler, loadPlatformBindings, readStoredPlatformConfig, isAnswerableByTap, recordInstanceVerification, } from '@markus/org-manager';
|
|
9
9
|
import { MessageRouter, PLATFORM_MANIFESTS, setHttpFetch, getManifest, RepoBindingLookup, MAIN_CONVERSATION_KEY, resolveCardActionValue, ConnectionTestRegistry } from '@markus/comms';
|
|
10
10
|
import { setupOutboundDispatch } from './outbound.js';
|
|
11
|
-
import { buildApprovalCardResolution, scheduleCardRewrite } from './approval-card.js';
|
|
11
|
+
import { buildApprovalCardResolution, cardActorFields, scheduleCardRewrite } from './approval-card.js';
|
|
12
12
|
import { initStartupLogger, startupLog, startupBlank, startupSection, closeStartupLogger, getStartupLogFile } from '../utils/logger.js';
|
|
13
13
|
import { openBrowserAfterHealthCheck } from '../utils/browser.js';
|
|
14
14
|
import { scheduleBackgroundMaintenance } from '../background-maintenance.js';
|
|
@@ -1181,6 +1181,24 @@ async function startServerCore(config, values, opts) {
|
|
|
1181
1181
|
// Wire user approval requester through HITL service
|
|
1182
1182
|
agentManager.setUserApprovalRequester(async (opts) => {
|
|
1183
1183
|
const taskTitle = opts.relatedTaskId ? taskService.getTask(opts.relatedTaskId)?.title : undefined;
|
|
1184
|
+
// What a card can render is the approval's `options`. When the agent asked with
|
|
1185
|
+
// `questions[]`, that list used to be empty — so every channel fell back to a
|
|
1186
|
+
// bare 同意/拒绝 pair and the agent's real choices never reached the human
|
|
1187
|
+
// (2026-10-28: the option said 「直接给你数字」, the Feishu card showed 同意).
|
|
1188
|
+
// Promote them only when the ask is **fully answerable in one tap** — the same
|
|
1189
|
+
// predicate the HITL service uses to decide `formOnly`, so a card can never
|
|
1190
|
+
// offer an action the server would refuse. Multi-question / multi-select /
|
|
1191
|
+
// typed-input requests stay a form inside the app.
|
|
1192
|
+
const channelOptions = opts.options && opts.options.length > 0
|
|
1193
|
+
? opts.options
|
|
1194
|
+
: isAnswerableByTap(opts.questions, opts.options)
|
|
1195
|
+
? (opts.questions?.[0]?.options ?? []).map((o) => ({
|
|
1196
|
+
id: o.id,
|
|
1197
|
+
label: o.label,
|
|
1198
|
+
description: o.description,
|
|
1199
|
+
...(o.requiresFreeform ? { requiresFreeform: true } : {}),
|
|
1200
|
+
}))
|
|
1201
|
+
: undefined;
|
|
1184
1202
|
return hitlService.requestApprovalAndWait({
|
|
1185
1203
|
agentId: opts.agentId,
|
|
1186
1204
|
agentName: opts.agentName,
|
|
@@ -1188,7 +1206,7 @@ async function startServerCore(config, values, opts) {
|
|
|
1188
1206
|
title: opts.title,
|
|
1189
1207
|
description: opts.description,
|
|
1190
1208
|
targetUserId: ownerUserId,
|
|
1191
|
-
options:
|
|
1209
|
+
options: channelOptions,
|
|
1192
1210
|
allowFreeform: opts.allowFreeform,
|
|
1193
1211
|
questions: opts.questions,
|
|
1194
1212
|
details: { priority: opts.priority, taskId: opts.relatedTaskId, taskTitle },
|
|
@@ -2261,11 +2279,16 @@ async function startServerCore(config, values, opts) {
|
|
|
2261
2279
|
// renderer withholds it and points at Markus); this refuses the taps a card sent
|
|
2262
2280
|
// *before* that change can still deliver — fail closed, never a silent mis-apply.
|
|
2263
2281
|
const tapped = hitlService.getApproval(approvalId)?.options?.find((o) => o.id === command);
|
|
2264
|
-
if (tapped?.requiresComment) {
|
|
2265
|
-
|
|
2282
|
+
if (tapped?.requiresComment || tapped?.requiresFreeform) {
|
|
2283
|
+
// Same contract for both: this surface cannot carry the text the choice
|
|
2284
|
+
// needs, so the tap is not an answer. Cards no longer offer such choices
|
|
2285
|
+
// (the renderer withholds them); this refuses the taps an older card can
|
|
2286
|
+
// still deliver — fail closed, never a silent mis-apply.
|
|
2287
|
+
log.warn('Refused a platform approval action that needs input this surface cannot collect', {
|
|
2266
2288
|
approvalId,
|
|
2267
2289
|
command,
|
|
2268
2290
|
platform: action.platform,
|
|
2291
|
+
needs: tapped?.requiresFreeform ? 'freeform' : 'comment',
|
|
2269
2292
|
});
|
|
2270
2293
|
return;
|
|
2271
2294
|
}
|
|
@@ -2273,7 +2296,19 @@ async function startServerCore(config, values, opts) {
|
|
|
2273
2296
|
// the tapped option id is recorded as `selectedOption` (was silently dropped).
|
|
2274
2297
|
const approved = command !== 'reject' && command !== 'request_changes';
|
|
2275
2298
|
const resolved = hitlService.respondToApproval(approvalId, approved, action.actorId || 'platform-action', undefined, command);
|
|
2276
|
-
|
|
2299
|
+
// 只有真的记下了才说 resolved。被拒(例如表单需要到应用内回答、点了也对不上题)
|
|
2300
|
+
// 时必须如实说"没记录" —— 2026-10-28 实测日志里,拒收和成功都打印 resolved,
|
|
2301
|
+
// 排障的人会把「拒收」读成「已完成」。
|
|
2302
|
+
if (resolved) {
|
|
2303
|
+
log.info('Platform action resolved', { approvalId, command, platform: action.platform });
|
|
2304
|
+
}
|
|
2305
|
+
else {
|
|
2306
|
+
log.warn('Platform action was NOT recorded — the request is still waiting for a full answer', {
|
|
2307
|
+
approvalId,
|
|
2308
|
+
command,
|
|
2309
|
+
platform: action.platform,
|
|
2310
|
+
});
|
|
2311
|
+
}
|
|
2277
2312
|
// Feedback: rewrite the card the tap came from. One invariant, two paths —
|
|
2278
2313
|
// *the card must converge to the approval's authoritative state*:
|
|
2279
2314
|
// · `resolved` — this tap recorded the decision;
|
|
@@ -2287,9 +2322,13 @@ async function startServerCore(config, values, opts) {
|
|
|
2287
2322
|
// rewrite (not awaiting it inside this handler) makes it the last write the
|
|
2288
2323
|
// client applies. Best-effort: failures are logged, never fatal, never roll
|
|
2289
2324
|
// the decision back.
|
|
2325
|
+
// 卡片收敛的**唯一写者**是 fan-out(approval:changed → 按投递记录改写)。
|
|
2326
|
+
// 只有这张审批没有任何投递记录时(卡片是本次进程启动前发的、或投递钩子没拿到 ref),
|
|
2327
|
+
// 才用本次点击携带的 messageId 兜底 —— 否则这张卡片永远不会收敛到已决态。
|
|
2290
2328
|
const approval = resolved?.approval ?? hitlService.getApproval(approvalId);
|
|
2291
2329
|
const messageId = action.messageId;
|
|
2292
|
-
|
|
2330
|
+
const hasRecordedCards = (deliveredCards.get(approvalId)?.length ?? 0) > 0;
|
|
2331
|
+
if (approval && messageId && (!resolved || !hasRecordedCards)) {
|
|
2293
2332
|
void scheduleCardRewrite(async () => {
|
|
2294
2333
|
// Resolve the display name inside the post-ack rewrite: it is a network
|
|
2295
2334
|
// round-trip to the contact API, so it must never delay the callback
|
|
@@ -2458,6 +2497,40 @@ async function startServerCore(config, values, opts) {
|
|
|
2458
2497
|
// `markus.json` `integrations.feishu.notifyChatId` read is gone (R2, design §3
|
|
2459
2498
|
// "Single source of truth"), so the configured fact and the consumed fact are
|
|
2460
2499
|
// the same fact.
|
|
2500
|
+
// ── 审批变化 → 渠道卡片收敛(唯一写者)───────────────────────────────
|
|
2501
|
+
// 审批记录是唯一事实,任何一面(飞书点击 / Markus 界面 / 超时)都只能通过
|
|
2502
|
+
// `respondToApproval` 改写它。改写后需要两件事同时发生:
|
|
2503
|
+
// · 前端刷新/关弹窗 —— **已经由 api-server 的 onApprovalChanged 广播**
|
|
2504
|
+
// `approval:resolved`(同一个 `emitApprovalChanged`,这里不再重复广播,
|
|
2505
|
+
// 否则同一事实两个写者);
|
|
2506
|
+
// · 渠道卡片收敛到记录状态 —— 那正是这里缺的一半:以前只有"飞书点击"
|
|
2507
|
+
// 这一条路径会改写卡片,从 Markus 界面做决定会让飞书卡片一直停在可点状态。
|
|
2508
|
+
const deliveredCards = new Map();
|
|
2509
|
+
hitlService.onApprovalChanged((changed) => {
|
|
2510
|
+
for (const ref of deliveredCards.get(changed.id) ?? []) {
|
|
2511
|
+
void scheduleCardRewrite(async () => {
|
|
2512
|
+
// A platform-resolved name is proof that `respondedBy` is that platform's
|
|
2513
|
+
// handle (true for a card tap). If it does not resolve, the value is a Markus
|
|
2514
|
+
// user id — using it as a mention makes Feishu reject the whole card
|
|
2515
|
+
// (ErrCode 100290, 2026-10-29: the card kept looking clickable after a
|
|
2516
|
+
// decision taken in the Markus UI). Then only the human's name travels.
|
|
2517
|
+
const platformName = changed.respondedBy
|
|
2518
|
+
? await messageRouter.resolveActorName(ref.platform, ref.instanceId, changed.respondedBy)
|
|
2519
|
+
: null;
|
|
2520
|
+
const humanName = changed.respondedBy
|
|
2521
|
+
? orgService.resolveHumanIdentity(changed.respondedBy)?.name
|
|
2522
|
+
: undefined;
|
|
2523
|
+
const actorFields = cardActorFields({ platformName, respondedBy: changed.respondedBy, humanName });
|
|
2524
|
+
const updated = await messageRouter.updateResolvedCard(ref.platform, ref.instanceId, ref.messageId, buildApprovalCardResolution(changed, actorFields));
|
|
2525
|
+
if (!updated) {
|
|
2526
|
+
log.info('Approval card left as-is — platform cannot edit a sent message', {
|
|
2527
|
+
approvalId: changed.id,
|
|
2528
|
+
platform: ref.platform,
|
|
2529
|
+
});
|
|
2530
|
+
}
|
|
2531
|
+
}, (err) => log.warn('Approval card rewrite failed', { approvalId: changed.id, error: String(err) }));
|
|
2532
|
+
}
|
|
2533
|
+
});
|
|
2461
2534
|
const outbound = setupOutboundDispatch({
|
|
2462
2535
|
router: messageRouter,
|
|
2463
2536
|
bindingRepo: storage?.channelBindingRepo,
|
|
@@ -2468,6 +2541,19 @@ async function startServerCore(config, values, opts) {
|
|
|
2468
2541
|
orgId: 'default',
|
|
2469
2542
|
digestInfo: false,
|
|
2470
2543
|
actionSecret: resolveActionSecret(),
|
|
2544
|
+
// 记住“哪张卡片对应哪个审批”:后续任何一面做出决定,都靠这个 ref 把卡片收敛。
|
|
2545
|
+
onDelivered: (notification, outcome) => {
|
|
2546
|
+
const approvalId = notification.metadata?.['approvalId'];
|
|
2547
|
+
const { messageId } = outcome;
|
|
2548
|
+
const platform = outcome.target?.platform;
|
|
2549
|
+
if (typeof approvalId !== 'string' || !messageId || !platform)
|
|
2550
|
+
return;
|
|
2551
|
+
const list = deliveredCards.get(approvalId) ?? [];
|
|
2552
|
+
if (!list.some((r) => r.platform === platform && r.messageId === messageId)) {
|
|
2553
|
+
list.push({ platform, instanceId: outcome.target?.instanceId, messageId });
|
|
2554
|
+
deliveredCards.set(approvalId, list);
|
|
2555
|
+
}
|
|
2556
|
+
},
|
|
2471
2557
|
// Resolve the origin agent's display name so a notification landing in a
|
|
2472
2558
|
// shared group says which agent sent it. A lookup failure must never hold
|
|
2473
2559
|
// back a delivery — an unknown agent simply goes out unattributed.
|