@haneinfo/collaboration 0.12.1 → 0.13.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/README.md +179 -160
- package/dist/collaboration.controller.d.ts +3 -2
- package/dist/collaboration.controller.d.ts.map +1 -1
- package/dist/collaboration.controller.js +10 -3
- package/dist/collaboration.controller.js.map +1 -1
- package/dist/collaboration.service.d.ts +9 -2
- package/dist/collaboration.service.d.ts.map +1 -1
- package/dist/collaboration.service.js +11 -4
- package/dist/collaboration.service.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-tools.d.ts.map +1 -1
- package/dist/mcp-tools.js +3 -16
- package/dist/mcp-tools.js.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/prisma-store.d.ts +3 -1
- package/dist/prisma-store.d.ts.map +1 -1
- package/dist/prisma-store.js +6 -5
- package/dist/prisma-store.js.map +1 -1
- package/dist/timeline.d.ts +92 -0
- package/dist/timeline.d.ts.map +1 -0
- package/dist/timeline.js +216 -0
- package/dist/timeline.js.map +1 -0
- package/dist/types.d.ts +7 -1
- package/dist/types.d.ts.map +1 -1
- package/haneinfo.plugin.json +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,160 +1,179 @@
|
|
|
1
|
-
# Instance collaboration
|
|
2
|
-
|
|
3
|
-
Immutable plain-text comments, a read-time activity timeline, and following for StateMachine instances.
|
|
4
|
-
Install the collaboration plugin with StateMachine, identity, notification inbox, Prisma and optional
|
|
5
|
-
RBAC capabilities. Include `prisma/collaboration.prisma` in the App schema and migrate it normally.
|
|
6
|
-
No separate timeline event table is created. The package starts at 0.0.0 for a first minor release.
|
|
7
|
-
|
|
8
|
-
Readers and writers must be the submitter, have `state-machine:instance:read`, or hold a reader grant. Comments cannot be
|
|
9
|
-
updated or deleted through this package. Text is stored and returned literally: clients render it as
|
|
10
|
-
text, without HTML or Markdown interpretation. Mentions use `@{userId}`; recipients must be active
|
|
11
|
-
and currently able to read the instance. Agent/MCP comments are always marked `isAiGenerated`.
|
|
12
|
-
|
|
13
|
-
HTTP routes under `/state-machine-instances/:id`: GET/POST `comments`, GET `timeline`, POST/DELETE
|
|
14
|
-
`follow`. Reads accept offset (default 0) and limit (default 50, maximum 200). Timeline events sort by
|
|
15
|
-
ascending timestamp then stable source-prefixed id, and expose `hasMore`. Sources are history,
|
|
16
|
-
CHOICE decisions, issued numbers, notification failures and comments. Concurrent additions may
|
|
17
|
-
change offset boundaries between separate requests; one request uses a database snapshot.
|
|
18
|
-
|
|
19
|
-
Register `CollaborationMcpTools.registerInto(registry, { scopeNamespace })` in the App's existing
|
|
20
|
-
internal MCP registry. Tools are `get_instance_comments`, `get_instance_timeline`,
|
|
21
|
-
`comment_on_instance`, `follow_instance`, `unfollow_instance`; all require `<namespace>:instance:read`
|
|
22
|
-
transport scope plus live instance-read authorization. User text and timeline details use
|
|
23
|
-
`$userContent` wrappers. The package creates no public endpoint or new business permission.
|
|
24
|
-
|
|
25
|
-
Following is unique per instance/user and covers every subsequent transition and new comment.
|
|
26
|
-
The approved `state-machine.transition.recorded` event is consumed through `StateMachineListener.onEvent`
|
|
27
|
-
inside the originating transaction, independent of stale state-entry suppression. Transition
|
|
28
|
-
notifications use the existing `state-machine-transition:<historyId>` key. Comment notifications use
|
|
29
|
-
`collaboration-comment:<commentId>`, union followers, mentions and submitter, exclude the author, and recheck each
|
|
30
|
-
recipient's active identity and instance-read permission immediately before delivery. The inbox's
|
|
31
|
-
recipient/key unique constraint handles replay and overlap with transition-action notifications.
|
|
32
|
-
Transition followers do not add an automatic submitter notification unless that person follows;
|
|
33
|
-
existing transition notify actions keep their recipient semantics.
|
|
34
|
-
|
|
35
|
-
Configuration: `collaboration: { appName?: string }`. App name defaults to `app`. No subscription
|
|
36
|
-
rules, event-type filtering, comment editing, or alternate objects are provided.
|
|
37
|
-
|
|
38
|
-
Mutating tools additionally declare `mutates: true`. Both the generated catalog and MCP wire
|
|
39
|
-
annotations then report `readOnlyHint: false`, even for writes authorized by existing read scopes.
|
|
40
|
-
This conservative declaration cannot turn a write scope into a read-only operation.
|
|
41
|
-
|
|
42
|
-
## Instance readers and stored query values
|
|
43
|
-
|
|
44
|
-
Instance readers have the same discussion and following access as the submitter or a holder of
|
|
45
|
-
`state-machine:instance:read`. Apply the state-machine reader-table migration and existing-task
|
|
46
|
-
backfill before upgrading. Reader checks use the caller transaction, including mention validation
|
|
47
|
-
and delivery; task status does not revoke readership.
|
|
48
|
-
|
|
49
|
-
Comment recipients are the deduplicated union of followers, mentions and submitter, excluding
|
|
50
|
-
the author even if they follow or mention themselves. Other recipients receive one notification.
|
|
51
|
-
Transition notifications keep their existing behavior, including notifications to an actor who
|
|
52
|
-
follows the instance. ADMIN has no new special case.
|
|
53
|
-
|
|
54
|
-
## Mechanism compatibility
|
|
55
|
-
|
|
56
|
-
Supports state-machine 0.7 as well as 0.6. Instance readership continues to use the existing
|
|
57
|
-
StateMachine contract; Collaboration does not implement condition comparison operators.
|
|
58
|
-
|
|
59
|
-
## Frontend contracts
|
|
60
|
-
|
|
61
|
-
GET /state-machine-instances/:id/mentionable?q= returns { items: [{ id, name }] }, at most 20 active readers other than the caller. Names may be null. Matching uses case-insensitive name containment; an empty q searches all names. q is at most 200 characters. A nonreader receives INSTANCE_NOT_FOUND (404), exactly like a missing instance.
|
|
62
|
-
|
|
63
|
-
IdentityStorePort.searchActiveByName owns database filtering and keyset pages of at most 20 candidates. Upgrade identity-core with collaboration. Missing optional identity search fails closed with IDENTITY_SEARCH_UNAVAILABLE (503). Collaboration evaluates each candidate through the existing effective RBAC authorization and reader grant check; it does not query role tables or reproduce role policy. Memory is bounded by one candidate page plus 20 results; a sparse query can require many bounded queries. Results are ordered by identity id. Comments revalidate mentions when posted.
|
|
64
|
-
|
|
65
|
-
GET comments and GET timeline now include following: boolean for the caller, queried in the same transaction as the page. MCP get_instance_comments and get_instance_timeline preserve following. New list_mentionable_users accepts { instanceId, q? }, uses <namespace>:instance:read, is read-only, and wraps each name in $userContent. The manifest declares all six tools; no confirmation or new mutation tool is added.
|
|
66
|
-
|
|
67
|
-
## Instance privacy alignment
|
|
68
|
-
|
|
69
|
-
Collaboration already returns identical INSTANCE_NOT_FOUND/404 for missing and unreadable instances before comments, timeline, mentions and follow operations. State-machine now applies the same hiding behavior before human writes; collaboration authorization is unchanged. No general-user people lookup is added.
|
|
70
|
-
|
|
71
|
-
## Delegated transition timeline
|
|
72
|
-
|
|
73
|
-
History timeline details optionally include actingUserId and onBehalfOfId from the existing history
|
|
74
|
-
decision JSON, allowing clients to display who acted for whom. actorId, triggerRef and every existing
|
|
75
|
-
field retain their meanings. No new table, timeline kind, frontend or historical name snapshot is
|
|
76
|
-
added. Permanent instance readers, including past delegates, retain read/comment access.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
## Instance access lists (draft implementation)
|
|
80
|
-
|
|
81
|
-
Implemented against draft decision 202610-c8e3; the decision remains draft.
|
|
82
|
-
|
|
83
|
-
Comments, mentions, mentionable discovery, follows and notification recipients use the submitter,
|
|
84
|
-
effective instance:read, or matching USER/ROLE access (READ or WRITE). Losing manual/role access
|
|
85
|
-
immediately blocks new reads, mentions and notifications; old inbox entries are retained.
|
|
86
|
-
The existing timeline SQL union classifies triggerType ACCESS as kind ACCESS and preserves the
|
|
87
|
-
existing details fields, adding decision.access with the action, principal and previous/new levels.
|
|
88
|
-
No state transition, revision bump or follower transition notification is generated for access changes.
|
|
89
|
-
MCP wraps decision as $userContent, including access activity. User/grantor names are plain text.
|
|
90
|
-
|
|
91
|
-
Upgrade the affected mechanisms together after applying the App migration. The maintained model,
|
|
92
|
-
HTTP routes, read-only list_instance_access MCP tool, errors and permission contract are documented
|
|
93
|
-
in @haneinfo/state-machine/agent-guide.md. Its prisma/instance-access.sql migrates the existing reader
|
|
94
|
-
table to USER/ROLE, READ/WRITE and ASSIGNED/DELEGATED/GRANTED rows while retaining timestamps.
|
|
95
|
-
The maintainer selected (instanceId, principalType, principalId, source) uniqueness. Manual grants are
|
|
96
|
-
limited to 100 by default; permanent READ entries survive manual removal. See the package repository
|
|
97
|
-
validation/equipment-loan/instance-access/report.md for SQL, tests and App restoration evidence.
|
|
98
|
-
|
|
99
|
-
## Optional attachments (draft decision 202610-5f3b)
|
|
100
|
-
|
|
101
|
-
Attachment activity uses existing history with triggerType ATTACHMENT and optional decision.attachment (action, id, plain-text fileName). No storage keys, state/revision changes or notifications are introduced. Collaboration classifies these history rows as ATTACHMENT in its existing SQL union; MCP retains decision $userContent wrapping. See @haneinfo/attachments/agent-guide.md for authorization, storage, scanning, migration and retention. Apps adopting the optional package add its reverse instance relation; the core fragment does not depend on attachments.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
## Document generation (draft 202610-d4f6)
|
|
105
|
-
|
|
106
|
-
The optional @haneinfo/document-templates package adds DOCUMENT activity using existing history
|
|
107
|
-
and decision.document (templateCode, templateVersion, format), attributed by triggerUserId.
|
|
108
|
-
No tables, state/revision changes or notifications are added. Collaboration classifies the row
|
|
109
|
-
as DOCUMENT in its existing authorized SQL timeline. Instance history and timeline fields remain
|
|
110
|
-
unchanged. Read the document-templates agent guide for fonts, configuration, HTTP and read-only MCP.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
## Instance lifecycle (draft 202610-f1a8)
|
|
114
|
-
|
|
115
|
-
Implemented from draft decision 202610-f1a8; the decision remains draft. Upgrade state-machine,
|
|
116
|
-
list-view, collaboration, attachments, import-export, assignment and timer together. No frontend,
|
|
117
|
-
automatic archive or bulk lifecycle operations are included. Permanently purged data cannot be
|
|
118
|
-
restored by this API: database and private file backups must cover the entire deletion retention
|
|
119
|
-
period and be restored consistently.
|
|
120
|
-
|
|
121
|
-
Apply prisma/instance-lifecycle.sql to add ON DELETE CASCADE foreign keys for comments/follows;
|
|
122
|
-
add comments CollaborationComment[] and follows CollaborationFollow[] to the App's instance model.
|
|
123
|
-
Check and reconcile pre-existing orphan rows before applying these constraints; migration does not
|
|
124
|
-
silently delete them. The core fragment does not depend on this optional package. LIFECYCLE history
|
|
125
|
-
joins the existing timeline UNION with the original event fields and optional decision.lifecycle.
|
|
126
|
-
Actions are ARCHIVED, RESTORED, DELETED, UNDELETED; actorId and at retain who/when. Existing MCP
|
|
127
|
-
decision wrapping applies. Deleted-instance comments, timeline, mentions and follows use the same
|
|
128
|
-
missing-id 404. Archive does not block them. Lifecycle events produce no collaboration notifications.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
## Instance tags (draft 202610-2c5d)
|
|
132
|
-
|
|
133
|
-
Implemented from draft 202610-2c5d; the decision remains draft. See @haneinfo/tags/agent-guide.md
|
|
134
|
-
for data, migration and authorization. The existing timeline SQL classifies TAG activities and retains all original fields/pagination.
|
|
135
|
-
decision.tag contains action ADDED/REMOVED, normalizedKey and label; the existing MCP decision
|
|
136
|
-
wrapper covers this user text. Each actual tag change has one activity and sends no notification.
|
|
137
|
-
|
|
138
|
-
## Unified search (draft 202610-a3d8)
|
|
139
|
-
|
|
140
|
-
Draft implementation; the decision remains draft. Each comment emits
|
|
141
|
-
`collaboration.comment.added` (instanceId, commentId, authorId, isAiGenerated, at; never the body)
|
|
142
|
-
in the comment transaction. When the optional `SEARCH_PROVIDERS` registry is present (manifest
|
|
143
|
-
optionalRequires `haneinfo.search`), CollaborationService registers `CommentsSearchProvider`: the
|
|
144
|
-
newest `commentLimit` (default 200) comments, newest first, AI-generated included, composed with the
|
|
145
|
-
shared plugin-api helpers and the configured row limit. Without @haneinfo/search nothing is
|
|
146
|
-
registered and comments behave as before. The manifest requires plugin API 1.19.0.
|
|
147
|
-
|
|
148
|
-
## Object references (draft 202610-f7a2)
|
|
149
|
-
|
|
150
|
-
The timeline SQL classifies `REFERENCE` history entries (written by the optional
|
|
151
|
-
@haneinfo/references through state-machine) as the `REFERENCE` kind, with `decision.reference`
|
|
152
|
-
(action LINKED or UNLINKED, linkId, kind, direction, other `{ type, id, number }`) in `details`;
|
|
153
|
-
original fields, ordering and pagination are unchanged. No notification is sent.
|
|
154
|
-
|
|
155
|
-
## Spaces (draft 202610-b1d6)
|
|
156
|
-
|
|
157
|
-
The timeline SQL classifies `SPACE` history entries (written by the optional @haneinfo/spaces
|
|
158
|
-
through state-machine when an instance is placed, moved or taken out) as the `SPACE` kind, with
|
|
159
|
-
`decision.space` (action PLACED, MOVED or REMOVED, nodeId, previousNodeId) in `details`; original
|
|
160
|
-
fields, ordering and pagination are unchanged. No notification is sent.
|
|
1
|
+
# Instance collaboration
|
|
2
|
+
|
|
3
|
+
Immutable plain-text comments, a read-time activity timeline, and following for StateMachine instances.
|
|
4
|
+
Install the collaboration plugin with StateMachine, identity, notification inbox, Prisma and optional
|
|
5
|
+
RBAC capabilities. Include `prisma/collaboration.prisma` in the App schema and migrate it normally.
|
|
6
|
+
No separate timeline event table is created. The package starts at 0.0.0 for a first minor release.
|
|
7
|
+
|
|
8
|
+
Readers and writers must be the submitter, have `state-machine:instance:read`, or hold a reader grant. Comments cannot be
|
|
9
|
+
updated or deleted through this package. Text is stored and returned literally: clients render it as
|
|
10
|
+
text, without HTML or Markdown interpretation. Mentions use `@{userId}`; recipients must be active
|
|
11
|
+
and currently able to read the instance. Agent/MCP comments are always marked `isAiGenerated`.
|
|
12
|
+
|
|
13
|
+
HTTP routes under `/state-machine-instances/:id`: GET/POST `comments`, GET `timeline`, POST/DELETE
|
|
14
|
+
`follow`. Reads accept offset (default 0) and limit (default 50, maximum 200). Timeline events sort by
|
|
15
|
+
ascending timestamp then stable source-prefixed id, and expose `hasMore`. Sources are history,
|
|
16
|
+
CHOICE decisions, issued numbers, notification failures and comments. Concurrent additions may
|
|
17
|
+
change offset boundaries between separate requests; one request uses a database snapshot.
|
|
18
|
+
|
|
19
|
+
Register `CollaborationMcpTools.registerInto(registry, { scopeNamespace })` in the App's existing
|
|
20
|
+
internal MCP registry. Tools are `get_instance_comments`, `get_instance_timeline`,
|
|
21
|
+
`comment_on_instance`, `follow_instance`, `unfollow_instance`; all require `<namespace>:instance:read`
|
|
22
|
+
transport scope plus live instance-read authorization. User text and timeline details use
|
|
23
|
+
`$userContent` wrappers. The package creates no public endpoint or new business permission.
|
|
24
|
+
|
|
25
|
+
Following is unique per instance/user and covers every subsequent transition and new comment.
|
|
26
|
+
The approved `state-machine.transition.recorded` event is consumed through `StateMachineListener.onEvent`
|
|
27
|
+
inside the originating transaction, independent of stale state-entry suppression. Transition
|
|
28
|
+
notifications use the existing `state-machine-transition:<historyId>` key. Comment notifications use
|
|
29
|
+
`collaboration-comment:<commentId>`, union followers, mentions and submitter, exclude the author, and recheck each
|
|
30
|
+
recipient's active identity and instance-read permission immediately before delivery. The inbox's
|
|
31
|
+
recipient/key unique constraint handles replay and overlap with transition-action notifications.
|
|
32
|
+
Transition followers do not add an automatic submitter notification unless that person follows;
|
|
33
|
+
existing transition notify actions keep their recipient semantics.
|
|
34
|
+
|
|
35
|
+
Configuration: `collaboration: { appName?: string }`. App name defaults to `app`. No subscription
|
|
36
|
+
rules, event-type filtering, comment editing, or alternate objects are provided.
|
|
37
|
+
|
|
38
|
+
Mutating tools additionally declare `mutates: true`. Both the generated catalog and MCP wire
|
|
39
|
+
annotations then report `readOnlyHint: false`, even for writes authorized by existing read scopes.
|
|
40
|
+
This conservative declaration cannot turn a write scope into a read-only operation.
|
|
41
|
+
|
|
42
|
+
## Instance readers and stored query values
|
|
43
|
+
|
|
44
|
+
Instance readers have the same discussion and following access as the submitter or a holder of
|
|
45
|
+
`state-machine:instance:read`. Apply the state-machine reader-table migration and existing-task
|
|
46
|
+
backfill before upgrading. Reader checks use the caller transaction, including mention validation
|
|
47
|
+
and delivery; task status does not revoke readership.
|
|
48
|
+
|
|
49
|
+
Comment recipients are the deduplicated union of followers, mentions and submitter, excluding
|
|
50
|
+
the author even if they follow or mention themselves. Other recipients receive one notification.
|
|
51
|
+
Transition notifications keep their existing behavior, including notifications to an actor who
|
|
52
|
+
follows the instance. ADMIN has no new special case.
|
|
53
|
+
|
|
54
|
+
## Mechanism compatibility
|
|
55
|
+
|
|
56
|
+
Supports state-machine 0.7 as well as 0.6. Instance readership continues to use the existing
|
|
57
|
+
StateMachine contract; Collaboration does not implement condition comparison operators.
|
|
58
|
+
|
|
59
|
+
## Frontend contracts
|
|
60
|
+
|
|
61
|
+
GET /state-machine-instances/:id/mentionable?q= returns { items: [{ id, name }] }, at most 20 active readers other than the caller. Names may be null. Matching uses case-insensitive name containment; an empty q searches all names. q is at most 200 characters. A nonreader receives INSTANCE_NOT_FOUND (404), exactly like a missing instance.
|
|
62
|
+
|
|
63
|
+
IdentityStorePort.searchActiveByName owns database filtering and keyset pages of at most 20 candidates. Upgrade identity-core with collaboration. Missing optional identity search fails closed with IDENTITY_SEARCH_UNAVAILABLE (503). Collaboration evaluates each candidate through the existing effective RBAC authorization and reader grant check; it does not query role tables or reproduce role policy. Memory is bounded by one candidate page plus 20 results; a sparse query can require many bounded queries. Results are ordered by identity id. Comments revalidate mentions when posted.
|
|
64
|
+
|
|
65
|
+
GET comments and GET timeline now include following: boolean for the caller, queried in the same transaction as the page. MCP get_instance_comments and get_instance_timeline preserve following. New list_mentionable_users accepts { instanceId, q? }, uses <namespace>:instance:read, is read-only, and wraps each name in $userContent. The manifest declares all six tools; no confirmation or new mutation tool is added.
|
|
66
|
+
|
|
67
|
+
## Instance privacy alignment
|
|
68
|
+
|
|
69
|
+
Collaboration already returns identical INSTANCE_NOT_FOUND/404 for missing and unreadable instances before comments, timeline, mentions and follow operations. State-machine now applies the same hiding behavior before human writes; collaboration authorization is unchanged. No general-user people lookup is added.
|
|
70
|
+
|
|
71
|
+
## Delegated transition timeline
|
|
72
|
+
|
|
73
|
+
History timeline details optionally include actingUserId and onBehalfOfId from the existing history
|
|
74
|
+
decision JSON, allowing clients to display who acted for whom. actorId, triggerRef and every existing
|
|
75
|
+
field retain their meanings. No new table, timeline kind, frontend or historical name snapshot is
|
|
76
|
+
added. Permanent instance readers, including past delegates, retain read/comment access.
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
## Instance access lists (draft implementation)
|
|
80
|
+
|
|
81
|
+
Implemented against draft decision 202610-c8e3; the decision remains draft.
|
|
82
|
+
|
|
83
|
+
Comments, mentions, mentionable discovery, follows and notification recipients use the submitter,
|
|
84
|
+
effective instance:read, or matching USER/ROLE access (READ or WRITE). Losing manual/role access
|
|
85
|
+
immediately blocks new reads, mentions and notifications; old inbox entries are retained.
|
|
86
|
+
The existing timeline SQL union classifies triggerType ACCESS as kind ACCESS and preserves the
|
|
87
|
+
existing details fields, adding decision.access with the action, principal and previous/new levels.
|
|
88
|
+
No state transition, revision bump or follower transition notification is generated for access changes.
|
|
89
|
+
MCP wraps decision as $userContent, including access activity. User/grantor names are plain text.
|
|
90
|
+
|
|
91
|
+
Upgrade the affected mechanisms together after applying the App migration. The maintained model,
|
|
92
|
+
HTTP routes, read-only list_instance_access MCP tool, errors and permission contract are documented
|
|
93
|
+
in @haneinfo/state-machine/agent-guide.md. Its prisma/instance-access.sql migrates the existing reader
|
|
94
|
+
table to USER/ROLE, READ/WRITE and ASSIGNED/DELEGATED/GRANTED rows while retaining timestamps.
|
|
95
|
+
The maintainer selected (instanceId, principalType, principalId, source) uniqueness. Manual grants are
|
|
96
|
+
limited to 100 by default; permanent READ entries survive manual removal. See the package repository
|
|
97
|
+
validation/equipment-loan/instance-access/report.md for SQL, tests and App restoration evidence.
|
|
98
|
+
|
|
99
|
+
## Optional attachments (draft decision 202610-5f3b)
|
|
100
|
+
|
|
101
|
+
Attachment activity uses existing history with triggerType ATTACHMENT and optional decision.attachment (action, id, plain-text fileName). No storage keys, state/revision changes or notifications are introduced. Collaboration classifies these history rows as ATTACHMENT in its existing SQL union; MCP retains decision $userContent wrapping. See @haneinfo/attachments/agent-guide.md for authorization, storage, scanning, migration and retention. Apps adopting the optional package add its reverse instance relation; the core fragment does not depend on attachments.
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
## Document generation (draft 202610-d4f6)
|
|
105
|
+
|
|
106
|
+
The optional @haneinfo/document-templates package adds DOCUMENT activity using existing history
|
|
107
|
+
and decision.document (templateCode, templateVersion, format), attributed by triggerUserId.
|
|
108
|
+
No tables, state/revision changes or notifications are added. Collaboration classifies the row
|
|
109
|
+
as DOCUMENT in its existing authorized SQL timeline. Instance history and timeline fields remain
|
|
110
|
+
unchanged. Read the document-templates agent guide for fonts, configuration, HTTP and read-only MCP.
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
## Instance lifecycle (draft 202610-f1a8)
|
|
114
|
+
|
|
115
|
+
Implemented from draft decision 202610-f1a8; the decision remains draft. Upgrade state-machine,
|
|
116
|
+
list-view, collaboration, attachments, import-export, assignment and timer together. No frontend,
|
|
117
|
+
automatic archive or bulk lifecycle operations are included. Permanently purged data cannot be
|
|
118
|
+
restored by this API: database and private file backups must cover the entire deletion retention
|
|
119
|
+
period and be restored consistently.
|
|
120
|
+
|
|
121
|
+
Apply prisma/instance-lifecycle.sql to add ON DELETE CASCADE foreign keys for comments/follows;
|
|
122
|
+
add comments CollaborationComment[] and follows CollaborationFollow[] to the App's instance model.
|
|
123
|
+
Check and reconcile pre-existing orphan rows before applying these constraints; migration does not
|
|
124
|
+
silently delete them. The core fragment does not depend on this optional package. LIFECYCLE history
|
|
125
|
+
joins the existing timeline UNION with the original event fields and optional decision.lifecycle.
|
|
126
|
+
Actions are ARCHIVED, RESTORED, DELETED, UNDELETED; actorId and at retain who/when. Existing MCP
|
|
127
|
+
decision wrapping applies. Deleted-instance comments, timeline, mentions and follows use the same
|
|
128
|
+
missing-id 404. Archive does not block them. Lifecycle events produce no collaboration notifications.
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
## Instance tags (draft 202610-2c5d)
|
|
132
|
+
|
|
133
|
+
Implemented from draft 202610-2c5d; the decision remains draft. See @haneinfo/tags/agent-guide.md
|
|
134
|
+
for data, migration and authorization. The existing timeline SQL classifies TAG activities and retains all original fields/pagination.
|
|
135
|
+
decision.tag contains action ADDED/REMOVED, normalizedKey and label; the existing MCP decision
|
|
136
|
+
wrapper covers this user text. Each actual tag change has one activity and sends no notification.
|
|
137
|
+
|
|
138
|
+
## Unified search (draft 202610-a3d8)
|
|
139
|
+
|
|
140
|
+
Draft implementation; the decision remains draft. Each comment emits
|
|
141
|
+
`collaboration.comment.added` (instanceId, commentId, authorId, isAiGenerated, at; never the body)
|
|
142
|
+
in the comment transaction. When the optional `SEARCH_PROVIDERS` registry is present (manifest
|
|
143
|
+
optionalRequires `haneinfo.search`), CollaborationService registers `CommentsSearchProvider`: the
|
|
144
|
+
newest `commentLimit` (default 200) comments, newest first, AI-generated included, composed with the
|
|
145
|
+
shared plugin-api helpers and the configured row limit. Without @haneinfo/search nothing is
|
|
146
|
+
registered and comments behave as before. The manifest requires plugin API 1.19.0.
|
|
147
|
+
|
|
148
|
+
## Object references (draft 202610-f7a2)
|
|
149
|
+
|
|
150
|
+
The timeline SQL classifies `REFERENCE` history entries (written by the optional
|
|
151
|
+
@haneinfo/references through state-machine) as the `REFERENCE` kind, with `decision.reference`
|
|
152
|
+
(action LINKED or UNLINKED, linkId, kind, direction, other `{ type, id, number }`) in `details`;
|
|
153
|
+
original fields, ordering and pagination are unchanged. No notification is sent.
|
|
154
|
+
|
|
155
|
+
## Spaces (draft 202610-b1d6)
|
|
156
|
+
|
|
157
|
+
The timeline SQL classifies `SPACE` history entries (written by the optional @haneinfo/spaces
|
|
158
|
+
through state-machine when an instance is placed, moved or taken out) as the `SPACE` kind, with
|
|
159
|
+
`decision.space` (action PLACED, MOVED or REMOVED, nodeId, previousNodeId) in `details`; original
|
|
160
|
+
fields, ordering and pagination are unchanged. No notification is sent.
|
|
161
|
+
|
|
162
|
+
## Structured timeline (draft 202610-a8d3)
|
|
163
|
+
|
|
164
|
+
Draft implementation; the decision remains draft. Every timeline entry adds fields a client can turn
|
|
165
|
+
into a sentence: `actor: { id, name } | null` (null for the system; names come from one batched
|
|
166
|
+
`findActiveNamesByIds` per page and are null when unknown or inactive), `transition`, `fromState`,
|
|
167
|
+
`toState` as `{ key, label }` from the instance's pinned machine in the request locale (`?locale=` or
|
|
168
|
+
Accept-Language; zh-TW by default), and per kind: START `toState`; TRANSITION `trigger` (USER,
|
|
169
|
+
ASSIGNMENT, TIMER, CHOICE) and `onBehalfOf`; CHOICE `outcome` (SELECTED, FAILED) and the selected
|
|
170
|
+
target; NUMBER `text` (the number); NOTIFICATION_FAILURE `transition` and `reason`; COMMENT `text`,
|
|
171
|
+
`mentions: [{ id, name }]`, `aiGenerated`; ACCESS `action` and `access: { principal: { type, id, name },
|
|
172
|
+
level, previousLevel }`; ATTACHMENT and TAG `action` and `text`; REFERENCE `action` and
|
|
173
|
+
`reference: { kind, direction, other: { type, id, number } }`; SPACE `action` and `space: { nodeId,
|
|
174
|
+
previousNodeId }` (no node names); DOCUMENT `document: { templateCode, templateVersion, format }`;
|
|
175
|
+
LIFECYCLE `action`. Link ids, attachment ids, CHOICE evidence and notification error details are not
|
|
176
|
+
projected. `id`, `instanceId`, `actorId` and `details` are unchanged and deprecated: the instance
|
|
177
|
+
frontend still reads them and they will be removed after it switches. MCP `get_instance_timeline`
|
|
178
|
+
uses zh-TW and wraps names, labels and text as `$userContent` (details keep their previous wrapping).
|
|
179
|
+
Readership is unchanged. Requires plugin API 1.26.0.
|
|
@@ -17,8 +17,9 @@ export declare class CollaborationController {
|
|
|
17
17
|
hasMore: boolean;
|
|
18
18
|
following: boolean;
|
|
19
19
|
}>;
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
/** Labels follow `?locale=` (zh-TW, en) or Accept-Language; zh-TW by default. */
|
|
21
|
+
timeline(user: InteractivePrincipal, id: string, query: unknown, acceptLanguage?: string): Promise<{
|
|
22
|
+
items: import("./timeline").TimelineEntry[];
|
|
22
23
|
offset: number;
|
|
23
24
|
limit: number;
|
|
24
25
|
hasMore: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collaboration.controller.d.ts","sourceRoot":"","sources":["../src/collaboration.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"collaboration.controller.d.ts","sourceRoot":"","sources":["../src/collaboration.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAgBjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAQ/D,qBAEa,uBAAuB;IACQ,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,oBAAoB;IAE9F,WAAW,CACM,IAAI,EAAE,oBAAoB,EAC5B,EAAE,EAAE,MAAM,EACd,KAAK,EAAE,OAAO;;;;;;IAczB,OAAO,CACU,IAAI,EAAE,oBAAoB,EAC5B,EAAE,EAAE,MAAM,EACf,IAAI,EAAE,OAAO;IAWvB,QAAQ,CACS,IAAI,EAAE,oBAAoB,EAC5B,EAAE,EAAE,MAAM,EACd,KAAK,EAAE,OAAO;;;;;;;IAIzB,iFAAiF;IAEjF,QAAQ,CACS,IAAI,EAAE,oBAAoB,EAC5B,EAAE,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,EACK,cAAc,CAAC,EAAE,MAAM;;;;;;;IAUrD,MAAM,CAAgB,IAAI,EAAE,oBAAoB,EAAe,EAAE,EAAE,MAAM;;;;IAIzE,QAAQ,CAAgB,IAAI,EAAE,oBAAoB,EAAe,EAAE,EAAE,MAAM;;;;CAG5E"}
|
|
@@ -40,8 +40,14 @@ let CollaborationController = class CollaborationController {
|
|
|
40
40
|
comments(user, id, query) {
|
|
41
41
|
return (0, state_machine_1.runHttp)(() => this.collaboration.commentsFor(user.sub, id, page.parse(query ?? {})));
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
/** Labels follow `?locale=` (zh-TW, en) or Accept-Language; zh-TW by default. */
|
|
44
|
+
timeline(user, id, query, acceptLanguage) {
|
|
45
|
+
return (0, state_machine_1.runHttp)(() => {
|
|
46
|
+
const locale = (0, state_machine_1.requestLocale)(query, acceptLanguage);
|
|
47
|
+
return this.collaboration.timelineFor(user.sub, id, page.parse((0, state_machine_1.withoutLocale)(query ?? {})), {
|
|
48
|
+
locale,
|
|
49
|
+
});
|
|
50
|
+
});
|
|
45
51
|
}
|
|
46
52
|
follow(user, id) {
|
|
47
53
|
return (0, state_machine_1.runHttp)(() => this.collaboration.followFor(user.sub, id, true));
|
|
@@ -83,8 +89,9 @@ __decorate([
|
|
|
83
89
|
__param(0, (0, plugin_host_nest_1.CurrentUser)()),
|
|
84
90
|
__param(1, (0, common_1.Param)('id')),
|
|
85
91
|
__param(2, (0, common_1.Query)()),
|
|
92
|
+
__param(3, (0, common_1.Headers)('accept-language')),
|
|
86
93
|
__metadata("design:type", Function),
|
|
87
|
-
__metadata("design:paramtypes", [Object, String, Object]),
|
|
94
|
+
__metadata("design:paramtypes", [Object, String, Object, String]),
|
|
88
95
|
__metadata("design:returntype", void 0)
|
|
89
96
|
], CollaborationController.prototype, "timeline", null);
|
|
90
97
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collaboration.controller.js","sourceRoot":"","sources":["../src/collaboration.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,iEAA+E;AAC/E,
|
|
1
|
+
{"version":3,"file":"collaboration.controller.js","sourceRoot":"","sources":["../src/collaboration.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,iEAA+E;AAC/E,2DAAgF;AAChF,2CAWwB;AACxB,6BAAwB;AACxB,mEAA+D;AAE/D,MAAM,IAAI,GAAG,OAAC;KACX,MAAM,CAAC;IACN,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACjD,KAAK,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,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AAI,CAAC,CAAA;IACX,WAAA,IAAA,cAAK,GAAE,CAAA;;;;uDAGT;AAGD;IADC,IAAA,YAAG,EAAC,UAAU,CAAC;IAEb,WAAA,IAAA,8BAAW,GAAE,CAAA;IACb,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;IACX,WAAA,IAAA,cAAK,GAAE,CAAA;IACP,WAAA,IAAA,gBAAO,EAAC,iBAAiB,CAAC,CAAA;;;;uDAQ5B;AAED;IADC,IAAA,aAAI,EAAC,QAAQ,CAAC;IACP,WAAA,IAAA,8BAAW,GAAE,CAAA;IAA8B,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;qDAE7D;AAED;IADC,IAAA,eAAM,EAAC,QAAQ,CAAC;IACP,WAAA,IAAA,8BAAW,GAAE,CAAA;IAA8B,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;uDAE/D;kCA/DU,uBAAuB;IAFnC,IAAA,mBAAU,EAAC,6BAA6B,CAAC;IACzC,IAAA,kBAAS,EAAC,uCAAoB,CAAC;IAEjB,WAAA,IAAA,eAAM,EAAC,4CAAoB,CAAC,CAAA;qCAAiC,4CAAoB;GADnF,uBAAuB,CAgEnC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type IdentityStorePort, type NotificationInboxPort, type RbacPolicyPort, type SearchProviderRegistry, type StateMachineListener, type StateMachineRuntimePort } from '@haneinfo/plugin-api';
|
|
1
|
+
import { type IdentityStorePort, type NotificationInboxPort, type RbacPolicyPort, type SearchProviderRegistry, type StateMachineListener, type StateMachineRuntimePort, type SupportedLocale } from '@haneinfo/plugin-api';
|
|
2
2
|
import { type OnModuleInit } from '@nestjs/common';
|
|
3
3
|
import { type CollaborationConfig, type CollaborationStore } from './types';
|
|
4
4
|
/** Unambiguous plain-text mentions use @{userId}; ordinary email addresses are just text. */
|
|
@@ -28,11 +28,18 @@ export declare class CollaborationService implements OnModuleInit {
|
|
|
28
28
|
hasMore: boolean;
|
|
29
29
|
following: boolean;
|
|
30
30
|
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Entries carry structured fields (actor with name, labelled transition and states in
|
|
33
|
+
* `options.locale`, text and per-kind fields; draft 202610-a8d3) next to the deprecated raw
|
|
34
|
+
* actorId and details. Readership is unchanged.
|
|
35
|
+
*/
|
|
31
36
|
timelineFor(userId: string, instanceId: string, input?: {
|
|
32
37
|
offset?: number;
|
|
33
38
|
limit?: number;
|
|
39
|
+
}, options?: {
|
|
40
|
+
locale?: SupportedLocale;
|
|
34
41
|
}): Promise<{
|
|
35
|
-
items: import("./
|
|
42
|
+
items: import("./timeline").TimelineEntry[];
|
|
36
43
|
offset: number;
|
|
37
44
|
limit: number;
|
|
38
45
|
hasMore: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collaboration.service.d.ts","sourceRoot":"","sources":["../src/collaboration.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,iBAAiB,EAGtB,KAAK,qBAAqB,EAE1B,KAAK,cAAc,EAEnB,KAAK,sBAAsB,EAI3B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,
|
|
1
|
+
{"version":3,"file":"collaboration.service.d.ts","sourceRoot":"","sources":["../src/collaboration.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,iBAAiB,EAGtB,KAAK,qBAAqB,EAE1B,KAAK,cAAc,EAEnB,KAAK,sBAAsB,EAI3B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAE5B,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAsB,KAAK,YAAY,EAAY,MAAM,gBAAgB,CAAC;AAGjF,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,SAAS,CAAC;AAEjB,6FAA6F;AAC7F,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAKrD;AAED,qBACa,oBAAqB,YAAW,YAAY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IAkB5C,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;;;;YAOtD,OAAO;CAmCtB"}
|
|
@@ -17,6 +17,7 @@ exports.mentionedUsers = mentionedUsers;
|
|
|
17
17
|
const plugin_api_1 = require("@haneinfo/plugin-api");
|
|
18
18
|
const common_1 = require("@nestjs/common");
|
|
19
19
|
const search_1 = require("./search");
|
|
20
|
+
const timeline_1 = require("./timeline");
|
|
20
21
|
const types_1 = require("./types");
|
|
21
22
|
/** Unambiguous plain-text mentions use @{userId}; ordinary email addresses are just text. */
|
|
22
23
|
function mentionedUsers(body) {
|
|
@@ -124,16 +125,22 @@ let CollaborationService = class CollaborationService {
|
|
|
124
125
|
};
|
|
125
126
|
});
|
|
126
127
|
}
|
|
127
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Entries carry structured fields (actor with name, labelled transition and states in
|
|
130
|
+
* `options.locale`, text and per-kind fields; draft 202610-a8d3) next to the deprecated raw
|
|
131
|
+
* actorId and details. Readership is unchanged.
|
|
132
|
+
*/
|
|
133
|
+
async timelineFor(userId, instanceId, input = {}, options = {}) {
|
|
128
134
|
const { offset, limit } = this.page(input);
|
|
129
135
|
return this.store.transaction(async (tx) => {
|
|
130
136
|
const instance = await this.readable(tx, userId, instanceId);
|
|
131
|
-
const
|
|
137
|
+
const rows = await this.store.timeline(tx, instance, offset, limit + 1);
|
|
138
|
+
const items = await new timeline_1.TimelinePresenter(this.identity).present(rows.slice(0, limit), instance.bundle?.root?.definition.spec, options.locale, tx);
|
|
132
139
|
return {
|
|
133
|
-
items
|
|
140
|
+
items,
|
|
134
141
|
offset,
|
|
135
142
|
limit,
|
|
136
|
-
hasMore:
|
|
143
|
+
hasMore: rows.length > limit,
|
|
137
144
|
following: await this.store.isFollowing(tx, instanceId, userId),
|
|
138
145
|
};
|
|
139
146
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collaboration.service.js","sourceRoot":"","sources":["../src/collaboration.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"collaboration.service.js","sourceRoot":"","sources":["../src/collaboration.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AA+BA,wCAKC;AApCD,qDAmB8B;AAC9B,2CAAiF;AACjF,qCAA+E;AAC/E,yCAA+C;AAC/C,mCAKiB;AAEjB,6FAA6F;AAC7F,SAAgB,cAAc,CAAC,IAAY;IACzC,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChF,IAAI,IAAI,CAAC,OAAO,CAAC,8BAA8B,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG;QACrF,MAAM,IAAI,2BAAc,CAAC,iBAAiB,EAAE,qCAAqC,CAAC,CAAC;IACrF,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3B,CAAC;AAGM,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAmB/B,YAC+B,KAA0C,EACxC,OAAiD,EACpD,KAA6C,EACjD,QAA4C,EACnC,IAAsC,EAC7B,SAA+C,EAAE,EACrD,MAAgD;QANxC,UAAK,GAAL,KAAK,CAAoB;QACvB,YAAO,GAAP,OAAO,CAAyB;QACnC,UAAK,GAAL,KAAK,CAAuB;QAChC,aAAQ,GAAR,QAAQ,CAAmB;QAClB,SAAI,GAAJ,IAAI,CAAiB;QACZ,WAAM,GAAN,MAAM,CAA0B;QACpC,WAAM,GAAN,MAAM,CAAyB;QAzB/E,aAAQ,GAAyB;YACxC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;gBACvB,IAAI,KAAK,CAAC,IAAI,KAAK,8CAAiC;oBAA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CAAA;IACtB,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,wBAAW,CAAC,CAAA;IAC/B,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,4BAAoB,CAAC,CAAA;IACxC,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,6BAAgB,CAAC,CAAA;;GA1B5B,oBAAoB,CAwOhC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -20,5 +20,6 @@ __exportStar(require("./collaboration.service"), exports);
|
|
|
20
20
|
__exportStar(require("./mcp-tools"), exports);
|
|
21
21
|
__exportStar(require("./prisma-store"), exports);
|
|
22
22
|
__exportStar(require("./search"), exports);
|
|
23
|
+
__exportStar(require("./timeline"), exports);
|
|
23
24
|
__exportStar(require("./types"), exports);
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,yDAAuC;AACvC,0DAAwC;AACxC,8CAA4B;AAC5B,iDAA+B;AAC/B,2CAAyB;AACzB,0CAAwB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,yDAAuC;AACvC,0DAAwC;AACxC,8CAA4B;AAC5B,iDAA+B;AAC/B,2CAAyB;AACzB,6CAA2B;AAC3B,0CAAwB"}
|
package/dist/mcp-tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-tools.d.ts","sourceRoot":"","sources":["../src/mcp-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAkB,MAAM,sBAAsB,CAAC;AAGzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp-tools.d.ts","sourceRoot":"","sources":["../src/mcp-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAkB,MAAM,sBAAsB,CAAC;AAGzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAU/D,qBACa,qBAAqB;IACU,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,oBAAoB;IAC9F,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE;CA6FvE"}
|
package/dist/mcp-tools.js
CHANGED
|
@@ -17,6 +17,7 @@ const plugin_api_1 = require("@haneinfo/plugin-api");
|
|
|
17
17
|
const common_1 = require("@nestjs/common");
|
|
18
18
|
const zod_1 = require("zod");
|
|
19
19
|
const collaboration_service_1 = require("./collaboration.service");
|
|
20
|
+
const timeline_1 = require("./timeline");
|
|
20
21
|
const id = zod_1.z.object({ instanceId: zod_1.z.string().min(1).max(128) }).strict();
|
|
21
22
|
const page = id.extend({
|
|
22
23
|
offset: zod_1.z.number().int().min(0).optional(),
|
|
@@ -51,22 +52,8 @@ let CollaborationMcpTools = class CollaborationMcpTools {
|
|
|
51
52
|
schema: page,
|
|
52
53
|
run: async (user, input) => {
|
|
53
54
|
const args = page.parse(input), result = await this.collaboration.timelineFor(user, args.instanceId, args);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
items: result.items.map(({ details, ...rest }) => ({
|
|
57
|
-
...rest,
|
|
58
|
-
details: {
|
|
59
|
-
...details,
|
|
60
|
-
...(Object.getOwnPropertyDescriptor(details, 'body')
|
|
61
|
-
? { body: { $userContent: details.body } }
|
|
62
|
-
: {}),
|
|
63
|
-
...(details.decision == null
|
|
64
|
-
? {}
|
|
65
|
-
: { decision: { $userContent: details.decision } }),
|
|
66
|
-
...(details.error == null ? {} : { error: { $userContent: details.error } }),
|
|
67
|
-
},
|
|
68
|
-
})),
|
|
69
|
-
};
|
|
55
|
+
// Default locale (zh-TW); names, labels and free text are $userContent.
|
|
56
|
+
return { ...result, items: result.items.map(timeline_1.wrapTimelineEntry) };
|
|
70
57
|
},
|
|
71
58
|
},
|
|
72
59
|
{
|
package/dist/mcp-tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-tools.js","sourceRoot":"","sources":["../src/mcp-tools.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qDAAyE;AACzE,2CAAoD;AACpD,6BAAwB;AACxB,mEAA+D;
|
|
1
|
+
{"version":3,"file":"mcp-tools.js","sourceRoot":"","sources":["../src/mcp-tools.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qDAAyE;AACzE,2CAAoD;AACpD,6BAAwB;AACxB,mEAA+D;AAC/D,yCAA+C;AAE/C,MAAM,EAAE,GAAG,OAAC,CAAC,MAAM,CAAC,EAAE,UAA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AAA,eAAM,EAAC,4CAAoB,CAAC,CAAA;qCAAiC,4CAAoB;GADnF,qBAAqB,CA+FjC"}
|
package/dist/plugin.js
CHANGED
package/dist/prisma-store.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export declare class PrismaCollaborationStore implements CollaborationStore {
|
|
|
10
10
|
comments(tx: unknown, instanceId: string, offset: number, limit: number): Promise<CommentRecord[]>;
|
|
11
11
|
follow(tx: unknown, instanceId: string, userId: string, enabled: boolean): Promise<void>;
|
|
12
12
|
followers(tx: unknown, instanceId: string): Promise<string[]>;
|
|
13
|
-
timeline(tx: unknown, instance: StateMachineInstanceView, offset: number, limit: number): Promise<TimelineEvent
|
|
13
|
+
timeline(tx: unknown, instance: StateMachineInstanceView, offset: number, limit: number): Promise<(TimelineEvent & {
|
|
14
|
+
sourceTransition: string | null;
|
|
15
|
+
})[]>;
|
|
14
16
|
}
|
|
15
17
|
//# sourceMappingURL=prisma-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prisma-store.d.ts","sourceRoot":"","sources":["../src/prisma-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAqBhF,qBAAa,wBAAyB,YAAW,kBAAkB;IACjE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAW;gBAClB,MAAM,EAAE,OAAO;IAGrB,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAO3D,QAAQ,CACZ,EAAE,EAAE,OAAO,EACX,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,SAAS,MAAM,EAAO;IAcnC,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,OAAO,CAAC,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AAG,WAAW,CAAC;IAGzE,QAAQ,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAQjE,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAUxE,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM;IAQ/C,QAAQ,CAAC,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;0BAEV,MAAM,GAAG,IAAI;;CAqC3F"}
|
package/dist/prisma-store.js
CHANGED
|
@@ -55,7 +55,7 @@ class PrismaCollaborationStore {
|
|
|
55
55
|
timeline(tx, instance, offset, limit) {
|
|
56
56
|
// Each source is independently indexable. UNION and pagination happen in PostgreSQL, not JS.
|
|
57
57
|
return tx.$queryRawUnsafe(`
|
|
58
|
-
SELECT id, $1::text AS "instanceId", kind, at, "actorId", details FROM (
|
|
58
|
+
SELECT id, $1::text AS "instanceId", kind, at, "actorId", details, "sourceTransition" FROM (
|
|
59
59
|
SELECT 'history:' || id AS id, CASE WHEN trigger_type = 'START' THEN 'START'
|
|
60
60
|
WHEN trigger_type = 'CHOICE_DECISION' THEN 'CHOICE' WHEN trigger_type = 'ACCESS' THEN 'ACCESS'
|
|
61
61
|
WHEN trigger_type = 'ATTACHMENT' THEN 'ATTACHMENT'
|
|
@@ -69,19 +69,20 @@ class PrismaCollaborationStore {
|
|
|
69
69
|
'triggerRef', trigger_ref, 'decision', decision) ||
|
|
70
70
|
CASE WHEN decision->>'onBehalfOfId' IS NOT NULL THEN
|
|
71
71
|
jsonb_build_object('actingUserId', trigger_user_id, 'onBehalfOfId', decision->>'onBehalfOfId')
|
|
72
|
-
ELSE '{}'::jsonb END AS details
|
|
72
|
+
ELSE '{}'::jsonb END AS details, transition AS "sourceTransition"
|
|
73
73
|
FROM state_machine_transitions WHERE instance_id = $1
|
|
74
74
|
UNION ALL
|
|
75
75
|
SELECT 'notification:' || id, 'NOTIFICATION_FAILURE', at, trigger_user_id,
|
|
76
|
-
decision->'notification' FROM state_machine_transitions
|
|
76
|
+
decision->'notification', transition FROM state_machine_transitions
|
|
77
77
|
WHERE instance_id = $1 AND decision->'notification'->>'reason' IS NOT NULL
|
|
78
78
|
UNION ALL
|
|
79
79
|
SELECT 'number:' || number, 'NUMBER', issued_at, NULL,
|
|
80
|
-
jsonb_build_object('number', number, 'scope', scope, 'fieldKey', field_key)
|
|
80
|
+
jsonb_build_object('number', number, 'scope', scope, 'fieldKey', field_key), NULL::text
|
|
81
81
|
FROM state_machine_numbers WHERE instance_id = $1
|
|
82
82
|
UNION ALL
|
|
83
83
|
SELECT 'comment:' || id, 'COMMENT', created_at, author_id,
|
|
84
|
-
jsonb_build_object('body', body, 'mentions', mentions, 'isAiGenerated', is_ai_generated)
|
|
84
|
+
jsonb_build_object('body', body, 'mentions', mentions, 'isAiGenerated', is_ai_generated),
|
|
85
|
+
NULL::text
|
|
85
86
|
FROM collaboration_comments WHERE instance_id = $1
|
|
86
87
|
) events ORDER BY at ASC, id COLLATE "C" ASC LIMIT $2 OFFSET $3`, instance.id, limit, offset);
|
|
87
88
|
}
|
package/dist/prisma-store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prisma-store.js","sourceRoot":"","sources":["../src/prisma-store.ts"],"names":[],"mappings":";;;AAsBA,MAAa,wBAAwB;IAEnC,YAAY,MAAe;QACzB,IAAI,CAAC,EAAE,GAAG,MAAkB,CAAC;IAC/B,CAAC;IACD,KAAK,CAAC,WAAW,CAAC,EAAW,EAAE,UAAkB,EAAE,MAAc;QAC/D,OAAO,OAAO,CACZ,MAAO,EAAa,CAAC,mBAAmB,CAAC,UAAU,CAAC;YAClD,KAAK,EAAE,EAAE,iBAAiB,EAAE,EAAE,UAA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,EAAE;gBAC9B,MAAM,EAAE,EAAE;aACX,CAAC,CAAC;;YACA,MAAM,QAAQ,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;IACD,KAAK,CAAC,SAAS,CAAC,EAAW,EAAE,UAAkB;QAC7C,OAAO,CACL,MAAO,EAAa,CAAC,mBAAmB,CAAC,QAAQ,CAAC;YAChD,KAAK,EAAE,EAAE,UAAU,EAAE;YACrB,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;SAC3B,CAAC,CACH,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC;IACD,QAAQ,CAAC,EAAW,EAAE,QAAkC,EAAE,MAAc,EAAE,KAAa;QACrF,6FAA6F;QAC7F,OAAQ,EAAa,CAAC,eAAe,CACnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sEA8BgE,EAChE,QAAQ,CAAC,EAAE,EACX,KAAK,EACL,MAAM,CACP,CAAC;IACJ,CAAC;CACF;AArGD,4DAqGC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured timeline entries (draft 202610-a8d3 point 5): fields a client can turn into a sentence
|
|
3
|
+
* ("王小明 核准,狀態變更為 已核准") without reading raw decisions. Labels come from the instance's
|
|
4
|
+
* pinned machine in the request locale; people are resolved to display names in one batch.
|
|
5
|
+
*
|
|
6
|
+
* Only what a reader may already see is projected, and less of it: no link ids, no attachment ids,
|
|
7
|
+
* no CHOICE evidence (data snapshot, conditions), no notification error details, space node ids
|
|
8
|
+
* without names. The raw `actorId` and `details` stay on each entry, deprecated, until the instance
|
|
9
|
+
* frontend has switched (phase two of the decision).
|
|
10
|
+
*/
|
|
11
|
+
import { type IdentityStorePort, type SupportedLocale } from '@haneinfo/plugin-api';
|
|
12
|
+
import type { TimelineEvent, TimelineKind } from './types';
|
|
13
|
+
export interface TimelinePerson {
|
|
14
|
+
id: string;
|
|
15
|
+
/** Active display name; null when unknown or inactive. */
|
|
16
|
+
name: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface TimelineLabelled {
|
|
19
|
+
key: string;
|
|
20
|
+
/** In the request locale; the key when the pinned machine does not declare it. */
|
|
21
|
+
label: string;
|
|
22
|
+
}
|
|
23
|
+
export type TimelineTrigger = 'USER' | 'ASSIGNMENT' | 'TIMER' | 'CHOICE';
|
|
24
|
+
/** The structured part of one entry. Absent fields do not apply to the kind. */
|
|
25
|
+
export interface TimelineEntryFields {
|
|
26
|
+
at: Date;
|
|
27
|
+
kind: TimelineKind;
|
|
28
|
+
/** Who did it; null for the system (CHOICE routing, timers, numbering, unknown). */
|
|
29
|
+
actor: TimelinePerson | null;
|
|
30
|
+
transition?: TimelineLabelled;
|
|
31
|
+
fromState?: TimelineLabelled;
|
|
32
|
+
toState?: TimelineLabelled;
|
|
33
|
+
/** Comment body, issued number, tag text or attachment file name. */
|
|
34
|
+
text?: string;
|
|
35
|
+
/** TRANSITION: how it was taken. */
|
|
36
|
+
trigger?: TimelineTrigger;
|
|
37
|
+
/** TRANSITION by a delegate: the person the actor acted for. */
|
|
38
|
+
onBehalfOf?: TimelinePerson;
|
|
39
|
+
/** CHOICE: whether routing selected a transition or failed (the instance stays). */
|
|
40
|
+
outcome?: 'SELECTED' | 'FAILED';
|
|
41
|
+
/** NOTIFICATION_FAILURE: stable reason code. */
|
|
42
|
+
reason?: string;
|
|
43
|
+
/** ACCESS, ATTACHMENT, TAG, REFERENCE, SPACE, LIFECYCLE: the recorded action code. */
|
|
44
|
+
action?: string;
|
|
45
|
+
/** COMMENT. */
|
|
46
|
+
mentions?: TimelinePerson[];
|
|
47
|
+
aiGenerated?: boolean;
|
|
48
|
+
access?: {
|
|
49
|
+
principal: {
|
|
50
|
+
type: 'USER' | 'ROLE';
|
|
51
|
+
id: string;
|
|
52
|
+
name: string | null;
|
|
53
|
+
};
|
|
54
|
+
level: string | null;
|
|
55
|
+
previousLevel: string | null;
|
|
56
|
+
};
|
|
57
|
+
reference?: {
|
|
58
|
+
kind: string | null;
|
|
59
|
+
direction: string | null;
|
|
60
|
+
other: {
|
|
61
|
+
type: string;
|
|
62
|
+
id: string;
|
|
63
|
+
number: string | null;
|
|
64
|
+
} | null;
|
|
65
|
+
};
|
|
66
|
+
space?: {
|
|
67
|
+
nodeId: string | null;
|
|
68
|
+
previousNodeId: string | null;
|
|
69
|
+
};
|
|
70
|
+
document?: {
|
|
71
|
+
templateCode: string;
|
|
72
|
+
templateVersion: number | null;
|
|
73
|
+
format: string | null;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** One timeline entry: the structured fields plus the deprecated raw ones. */
|
|
77
|
+
export type TimelineEntry = TimelineEvent & TimelineEntryFields;
|
|
78
|
+
/** Builds structured entries for rows of one instance. Names: one identity query for the page. */
|
|
79
|
+
export declare class TimelinePresenter {
|
|
80
|
+
private readonly identity?;
|
|
81
|
+
constructor(identity?: IdentityStorePort | undefined);
|
|
82
|
+
present(rows: (TimelineEvent & {
|
|
83
|
+
sourceTransition?: string | null;
|
|
84
|
+
})[], spec: unknown, locale?: SupportedLocale, tx?: unknown): Promise<TimelineEntry[]>;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* MCP projection: every person name, definition label and free text of the structured fields is
|
|
88
|
+
* `$userContent`; codes, keys, ids and times stay plain. The deprecated `details` keep their
|
|
89
|
+
* previous wrapping (body, decision, error).
|
|
90
|
+
*/
|
|
91
|
+
export declare function wrapTimelineEntry(entry: TimelineEntry): Record<string, unknown>;
|
|
92
|
+
//# sourceMappingURL=timeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../src/timeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAEL,KAAK,iBAAiB,EAEtB,KAAK,eAAe,EACrB,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 +1,216 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Structured timeline entries (draft 202610-a8d3 point 5): fields a client can turn into a sentence
|
|
4
|
+
* ("王小明 核准,狀態變更為 已核准") without reading raw decisions. Labels come from the instance's
|
|
5
|
+
* pinned machine in the request locale; people are resolved to display names in one batch.
|
|
6
|
+
*
|
|
7
|
+
* Only what a reader may already see is projected, and less of it: no link ids, no attachment ids,
|
|
8
|
+
* no CHOICE evidence (data snapshot, conditions), no notification error details, space node ids
|
|
9
|
+
* without names. The raw `actorId` and `details` stay on each entry, deprecated, until the instance
|
|
10
|
+
* frontend has switched (phase two of the decision).
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.TimelinePresenter = void 0;
|
|
14
|
+
exports.wrapTimelineEntry = wrapTimelineEntry;
|
|
15
|
+
const plugin_api_1 = require("@haneinfo/plugin-api");
|
|
16
|
+
const record = (value) => value && typeof value === 'object' && !Array.isArray(value)
|
|
17
|
+
? value
|
|
18
|
+
: {};
|
|
19
|
+
const text = (value) => typeof value === 'string' ? value : undefined;
|
|
20
|
+
const TRIGGERS = ['USER', 'ASSIGNMENT', 'TIMER', 'CHOICE'];
|
|
21
|
+
/** Builds structured entries for rows of one instance. Names: one identity query for the page. */
|
|
22
|
+
class TimelinePresenter {
|
|
23
|
+
constructor(identity) {
|
|
24
|
+
this.identity = identity;
|
|
25
|
+
}
|
|
26
|
+
async present(rows, spec, locale = plugin_api_1.DEFAULT_LOCALE, tx) {
|
|
27
|
+
const machine = record(spec);
|
|
28
|
+
const states = Array.isArray(machine.states) ? machine.states : [];
|
|
29
|
+
const transitions = Array.isArray(machine.transitions) ? machine.transitions : [];
|
|
30
|
+
const state = (key) => {
|
|
31
|
+
if (typeof key !== 'string' || !key)
|
|
32
|
+
return undefined;
|
|
33
|
+
const found = states.find((candidate) => candidate?.key === key);
|
|
34
|
+
return { key, label: (found && (0, plugin_api_1.localizeText)(found.label, locale)) || key };
|
|
35
|
+
};
|
|
36
|
+
const transition = (key) => {
|
|
37
|
+
if (typeof key !== 'string' || !key)
|
|
38
|
+
return undefined;
|
|
39
|
+
const found = transitions.find((candidate) => candidate?.key === key);
|
|
40
|
+
return { key, label: (found && (0, plugin_api_1.localizeText)(found.label, locale)) || key };
|
|
41
|
+
};
|
|
42
|
+
const ids = new Set();
|
|
43
|
+
for (const row of rows) {
|
|
44
|
+
const details = record(row.details);
|
|
45
|
+
const decision = record(details.decision);
|
|
46
|
+
if (row.actorId)
|
|
47
|
+
ids.add(row.actorId);
|
|
48
|
+
if (typeof details.onBehalfOfId === 'string')
|
|
49
|
+
ids.add(details.onBehalfOfId);
|
|
50
|
+
if (row.kind === 'COMMENT' && Array.isArray(details.mentions))
|
|
51
|
+
for (const id of details.mentions)
|
|
52
|
+
if (typeof id === 'string')
|
|
53
|
+
ids.add(id);
|
|
54
|
+
const access = record(decision.access);
|
|
55
|
+
if (row.kind === 'ACCESS' &&
|
|
56
|
+
access.principalType === 'USER' &&
|
|
57
|
+
typeof access.principalId === 'string')
|
|
58
|
+
ids.add(access.principalId);
|
|
59
|
+
}
|
|
60
|
+
const names = new Map(ids.size && this.identity?.findActiveNamesByIds
|
|
61
|
+
? (await this.identity.findActiveNamesByIds([...ids], tx)).map(({ id, name }) => [id, name])
|
|
62
|
+
: []);
|
|
63
|
+
const person = (id) => ({ id, name: names.get(id) ?? null });
|
|
64
|
+
return rows.map(({ sourceTransition, ...row }) => {
|
|
65
|
+
const details = record(row.details);
|
|
66
|
+
const decision = record(details.decision);
|
|
67
|
+
const entry = {
|
|
68
|
+
...row,
|
|
69
|
+
at: row.at,
|
|
70
|
+
kind: row.kind,
|
|
71
|
+
actor: row.actorId ? person(row.actorId) : null,
|
|
72
|
+
};
|
|
73
|
+
switch (row.kind) {
|
|
74
|
+
case 'START':
|
|
75
|
+
entry.toState = state(details.toState);
|
|
76
|
+
break;
|
|
77
|
+
case 'TRANSITION': {
|
|
78
|
+
entry.transition = transition(details.transition);
|
|
79
|
+
entry.fromState = state(details.fromState);
|
|
80
|
+
entry.toState = state(details.toState);
|
|
81
|
+
const trigger = text(details.triggerType);
|
|
82
|
+
if (trigger && TRIGGERS.includes(trigger))
|
|
83
|
+
entry.trigger = trigger;
|
|
84
|
+
if (typeof details.onBehalfOfId === 'string')
|
|
85
|
+
entry.onBehalfOf = person(details.onBehalfOfId);
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
case 'CHOICE': {
|
|
89
|
+
entry.fromState = state(details.fromState);
|
|
90
|
+
if (decision.outcome === 'SELECTED' || decision.outcome === 'FAILED')
|
|
91
|
+
entry.outcome = decision.outcome;
|
|
92
|
+
entry.transition = transition(details.transition);
|
|
93
|
+
const selected = transitions.find((candidate) => candidate?.key === details.transition);
|
|
94
|
+
if (entry.outcome === 'SELECTED' && selected?.to)
|
|
95
|
+
entry.toState = state(selected.to);
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
case 'NUMBER':
|
|
99
|
+
entry.text = text(details.number);
|
|
100
|
+
break;
|
|
101
|
+
case 'NOTIFICATION_FAILURE':
|
|
102
|
+
entry.transition = transition(sourceTransition);
|
|
103
|
+
entry.reason = text(details.reason);
|
|
104
|
+
break;
|
|
105
|
+
case 'COMMENT':
|
|
106
|
+
entry.text = text(details.body);
|
|
107
|
+
entry.mentions = (Array.isArray(details.mentions) ? details.mentions : [])
|
|
108
|
+
.filter((id) => typeof id === 'string')
|
|
109
|
+
.map(person);
|
|
110
|
+
entry.aiGenerated = details.isAiGenerated === true;
|
|
111
|
+
break;
|
|
112
|
+
case 'ACCESS': {
|
|
113
|
+
const access = record(decision.access);
|
|
114
|
+
entry.action = text(access.action);
|
|
115
|
+
const type = access.principalType === 'ROLE' ? 'ROLE' : 'USER';
|
|
116
|
+
const id = text(access.principalId) ?? '';
|
|
117
|
+
entry.access = {
|
|
118
|
+
principal: { type, id, name: type === 'USER' && id ? person(id).name : null },
|
|
119
|
+
level: text(access.level) ?? null,
|
|
120
|
+
previousLevel: text(access.previousLevel) ?? null,
|
|
121
|
+
};
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
case 'ATTACHMENT': {
|
|
125
|
+
const attachment = record(decision.attachment);
|
|
126
|
+
entry.action = text(attachment.action);
|
|
127
|
+
entry.text = text(attachment.fileName);
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
case 'TAG': {
|
|
131
|
+
const tag = record(decision.tag);
|
|
132
|
+
entry.action = text(tag.action);
|
|
133
|
+
entry.text = text(tag.label);
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
case 'REFERENCE': {
|
|
137
|
+
const reference = record(decision.reference);
|
|
138
|
+
const other = record(reference.other);
|
|
139
|
+
entry.action = text(reference.action);
|
|
140
|
+
entry.reference = {
|
|
141
|
+
kind: text(reference.kind) ?? null,
|
|
142
|
+
direction: text(reference.direction) ?? null,
|
|
143
|
+
other: typeof other.type === 'string' && typeof other.id === 'string'
|
|
144
|
+
? { type: other.type, id: other.id, number: text(other.number) ?? null }
|
|
145
|
+
: null,
|
|
146
|
+
};
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
case 'SPACE': {
|
|
150
|
+
const space = record(decision.space);
|
|
151
|
+
entry.action = text(space.action);
|
|
152
|
+
entry.space = {
|
|
153
|
+
nodeId: text(space.nodeId) ?? null,
|
|
154
|
+
previousNodeId: text(space.previousNodeId) ?? null,
|
|
155
|
+
};
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
case 'DOCUMENT': {
|
|
159
|
+
const document = record(decision.document);
|
|
160
|
+
entry.document = {
|
|
161
|
+
templateCode: text(document.templateCode) ?? '',
|
|
162
|
+
templateVersion: typeof document.templateVersion === 'number' ? document.templateVersion : null,
|
|
163
|
+
format: text(document.format) ?? null,
|
|
164
|
+
};
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
case 'LIFECYCLE':
|
|
168
|
+
entry.action = text(record(decision.lifecycle).action);
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
for (const key of Object.keys(entry))
|
|
172
|
+
if (entry[key] === undefined)
|
|
173
|
+
delete entry[key];
|
|
174
|
+
return entry;
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
exports.TimelinePresenter = TimelinePresenter;
|
|
179
|
+
/**
|
|
180
|
+
* MCP projection: every person name, definition label and free text of the structured fields is
|
|
181
|
+
* `$userContent`; codes, keys, ids and times stay plain. The deprecated `details` keep their
|
|
182
|
+
* previous wrapping (body, decision, error).
|
|
183
|
+
*/
|
|
184
|
+
function wrapTimelineEntry(entry) {
|
|
185
|
+
const wrap = (value) => ({ $userContent: value });
|
|
186
|
+
const person = (value) => ({ id: value.id, name: wrap(value.name) });
|
|
187
|
+
const labelled = (value) => ({ key: value.key, label: wrap(value.label) });
|
|
188
|
+
const { details, actor, transition, fromState, toState, text, onBehalfOf, mentions, access, ...rest } = entry;
|
|
189
|
+
return {
|
|
190
|
+
...rest,
|
|
191
|
+
actor: actor ? person(actor) : null,
|
|
192
|
+
...(transition ? { transition: labelled(transition) } : {}),
|
|
193
|
+
...(fromState ? { fromState: labelled(fromState) } : {}),
|
|
194
|
+
...(toState ? { toState: labelled(toState) } : {}),
|
|
195
|
+
...(text === undefined ? {} : { text: wrap(text) }),
|
|
196
|
+
...(onBehalfOf ? { onBehalfOf: person(onBehalfOf) } : {}),
|
|
197
|
+
...(mentions ? { mentions: mentions.map(person) } : {}),
|
|
198
|
+
...(access
|
|
199
|
+
? {
|
|
200
|
+
access: {
|
|
201
|
+
...access,
|
|
202
|
+
principal: { ...access.principal, name: wrap(access.principal.name) },
|
|
203
|
+
},
|
|
204
|
+
}
|
|
205
|
+
: {}),
|
|
206
|
+
details: {
|
|
207
|
+
...details,
|
|
208
|
+
...(Object.getOwnPropertyDescriptor(details, 'body')
|
|
209
|
+
? { body: wrap(details.body) }
|
|
210
|
+
: {}),
|
|
211
|
+
...(details.decision == null ? {} : { decision: { $userContent: details.decision } }),
|
|
212
|
+
...(details.error == null ? {} : { error: { $userContent: details.error } }),
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=timeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline.js","sourceRoot":"","sources":["../src/timeline.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAuPH,8CA0CC;AA/RD,qDAK8B;AAkE9B,MAAM,MAAM,GAAG,CAAC,KAAc,EAA2B,EAAE,CACzD,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;IACzD,CAAC,CAAE,KAAiC;IACpC,CAAC,CAAC,EAAE,CAAC;AACT,MAAM,IAAI,GAAG,CAAC,KAAc,EAAsB,EAAE,CAClD,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAChD,MAAM,QAAQ,GAA+B,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAEvF,kGAAkG;AAClG,MAAa,iBAAiB;IAC5B,YAA6B,QAA4B;QAA5B,aAAQ,GAAR,QAAQ,CAAoB;IAAG,CAAC;IAE7D,KAAK,CAAC,OAAO,CACX,IAA8D,EAC9D,IAAa,EACb,SAA0B,2BAAc,EACxC,EAAY;QAEZ,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAc,CAAC;QAC1C,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QACnE,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CA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OAAO,EAAE;YACP,GAAG,OAAO;YACV,GAAG,CAAC,MAAM,CAAC,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC;gBAClD,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAa,CAAC,EAAE;gBACvC,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,YAAY,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;YACrF,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;SAC7E;KACF,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -33,6 +33,12 @@ export interface CollaborationStore {
|
|
|
33
33
|
comments(tx: unknown, instanceId: string, offset: number, limit: number): Promise<CommentRecord[]>;
|
|
34
34
|
follow(tx: unknown, instanceId: string, userId: string, enabled: boolean): Promise<void>;
|
|
35
35
|
followers(tx: unknown, instanceId: string): Promise<string[]>;
|
|
36
|
-
|
|
36
|
+
/**
|
|
37
|
+
* `sourceTransition` (the history row's transition, also for NOTIFICATION_FAILURE) is read by the
|
|
38
|
+
* structured projection and never returned.
|
|
39
|
+
*/
|
|
40
|
+
timeline(tx: unknown, instance: StateMachineInstanceView, offset: number, limit: number): Promise<(TimelineEvent & {
|
|
41
|
+
sourceTransition?: string | null;
|
|
42
|
+
})[]>;
|
|
37
43
|
}
|
|
38
44
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE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AO,CAAC,aAAa,CAAC,CAAC;IAC1B,QAAQ,CACN,EAAE,EAAE,OAAO,EACX,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAC5B,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzF,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9D;;;OAGG;IACH,QAAQ,CACN,EAAE,EAAE,OAAO,EACX,QAAQ,EAAE,wBAAwB,EAClC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,CAAC,aAAa,GAAG;QAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,EAAE,CAAC,CAAC;CACtE"}
|
package/haneinfo.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haneinfo/collaboration",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Immutable instance comments, merged timelines and following.",
|
|
6
6
|
"files": [
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"./prisma/collaboration.prisma": "./prisma/collaboration.prisma"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@haneinfo/plugin-api": "1.
|
|
32
|
+
"@haneinfo/plugin-api": "1.26.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@haneinfo/common": "^0.3.4 || ^0.4.0 || ^0.5.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@nestjs/core": "^11.0.0",
|
|
39
39
|
"@prisma/client": "^6.19.0",
|
|
40
40
|
"zod": "^4.4.0",
|
|
41
|
-
"@haneinfo/state-machine": "^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^0.14.0 || ^0.15.0 || ^0.16.0 || ^0.17.0 || ^0.18.0 || ^0.19.0 || ^0.20.0 || ^0.21.0 || ^0.22.0 || ^0.23.0"
|
|
41
|
+
"@haneinfo/state-machine": "^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^0.14.0 || ^0.15.0 || ^0.16.0 || ^0.17.0 || ^0.18.0 || ^0.19.0 || ^0.20.0 || ^0.21.0 || ^0.22.0 || ^0.23.0 || ^0.24.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@nestjs/common": "^11.0.0",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"vitest": "^4.1.11",
|
|
50
50
|
"zod": "^4.4.0",
|
|
51
51
|
"@haneinfo/common": "0.5.0",
|
|
52
|
-
"@haneinfo/
|
|
53
|
-
"@haneinfo/
|
|
54
|
-
"@haneinfo/form": "0.
|
|
52
|
+
"@haneinfo/definition-registry": "0.2.5",
|
|
53
|
+
"@haneinfo/state-machine": "0.24.0",
|
|
54
|
+
"@haneinfo/form": "0.5.0",
|
|
55
55
|
"@haneinfo/plugin-host-nest": "2.1.0",
|
|
56
56
|
"@haneinfo/plugin-testkit": "2.3.0"
|
|
57
57
|
},
|