@workel/mcp 0.1.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.
Files changed (114) hide show
  1. package/README.md +152 -0
  2. package/dist/api/client.d.ts +126 -0
  3. package/dist/api/client.d.ts.map +1 -0
  4. package/dist/api/client.js +313 -0
  5. package/dist/api/client.js.map +1 -0
  6. package/dist/api/errors.d.ts +142 -0
  7. package/dist/api/errors.d.ts.map +1 -0
  8. package/dist/api/errors.js +262 -0
  9. package/dist/api/errors.js.map +1 -0
  10. package/dist/api/mapping.d.ts +147 -0
  11. package/dist/api/mapping.d.ts.map +1 -0
  12. package/dist/api/mapping.js +248 -0
  13. package/dist/api/mapping.js.map +1 -0
  14. package/dist/api/redact.d.ts +54 -0
  15. package/dist/api/redact.d.ts.map +1 -0
  16. package/dist/api/redact.js +193 -0
  17. package/dist/api/redact.js.map +1 -0
  18. package/dist/api/types.d.ts +155 -0
  19. package/dist/api/types.d.ts.map +1 -0
  20. package/dist/api/types.js +18 -0
  21. package/dist/api/types.js.map +1 -0
  22. package/dist/boot.d.ts +129 -0
  23. package/dist/boot.d.ts.map +1 -0
  24. package/dist/boot.js +245 -0
  25. package/dist/boot.js.map +1 -0
  26. package/dist/config.d.ts +24 -0
  27. package/dist/config.d.ts.map +1 -0
  28. package/dist/config.js +77 -0
  29. package/dist/config.js.map +1 -0
  30. package/dist/doctor.d.ts +42 -0
  31. package/dist/doctor.d.ts.map +1 -0
  32. package/dist/doctor.js +94 -0
  33. package/dist/doctor.js.map +1 -0
  34. package/dist/index.d.ts +36 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +66 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/output.d.ts +48 -0
  39. package/dist/output.d.ts.map +1 -0
  40. package/dist/output.js +73 -0
  41. package/dist/output.js.map +1 -0
  42. package/dist/remote.d.ts +164 -0
  43. package/dist/remote.d.ts.map +1 -0
  44. package/dist/remote.js +456 -0
  45. package/dist/remote.js.map +1 -0
  46. package/dist/server.d.ts +34 -0
  47. package/dist/server.d.ts.map +1 -0
  48. package/dist/server.js +59 -0
  49. package/dist/server.js.map +1 -0
  50. package/dist/tools/conventions.d.ts +54 -0
  51. package/dist/tools/conventions.d.ts.map +1 -0
  52. package/dist/tools/conventions.js +71 -0
  53. package/dist/tools/conventions.js.map +1 -0
  54. package/dist/tools/createComment.d.ts +52 -0
  55. package/dist/tools/createComment.d.ts.map +1 -0
  56. package/dist/tools/createComment.js +99 -0
  57. package/dist/tools/createComment.js.map +1 -0
  58. package/dist/tools/createEvent.d.ts +63 -0
  59. package/dist/tools/createEvent.d.ts.map +1 -0
  60. package/dist/tools/createEvent.js +160 -0
  61. package/dist/tools/createEvent.js.map +1 -0
  62. package/dist/tools/createTask.d.ts +53 -0
  63. package/dist/tools/createTask.d.ts.map +1 -0
  64. package/dist/tools/createTask.js +136 -0
  65. package/dist/tools/createTask.js.map +1 -0
  66. package/dist/tools/defineTool.d.ts +76 -0
  67. package/dist/tools/defineTool.d.ts.map +1 -0
  68. package/dist/tools/defineTool.js +31 -0
  69. package/dist/tools/defineTool.js.map +1 -0
  70. package/dist/tools/index.d.ts +16 -0
  71. package/dist/tools/index.d.ts.map +1 -0
  72. package/dist/tools/index.js +49 -0
  73. package/dist/tools/index.js.map +1 -0
  74. package/dist/tools/registration.d.ts +63 -0
  75. package/dist/tools/registration.d.ts.map +1 -0
  76. package/dist/tools/registration.js +95 -0
  77. package/dist/tools/registration.js.map +1 -0
  78. package/dist/tools/updateTask.d.ts +53 -0
  79. package/dist/tools/updateTask.d.ts.map +1 -0
  80. package/dist/tools/updateTask.js +119 -0
  81. package/dist/tools/updateTask.js.map +1 -0
  82. package/dist/tools/workel_events.d.ts +23 -0
  83. package/dist/tools/workel_events.d.ts.map +1 -0
  84. package/dist/tools/workel_events.js +60 -0
  85. package/dist/tools/workel_events.js.map +1 -0
  86. package/dist/tools/workel_members.d.ts +17 -0
  87. package/dist/tools/workel_members.d.ts.map +1 -0
  88. package/dist/tools/workel_members.js +46 -0
  89. package/dist/tools/workel_members.js.map +1 -0
  90. package/dist/tools/workel_project_columns.d.ts +13 -0
  91. package/dist/tools/workel_project_columns.d.ts.map +1 -0
  92. package/dist/tools/workel_project_columns.js +45 -0
  93. package/dist/tools/workel_project_columns.js.map +1 -0
  94. package/dist/tools/workel_projects.d.ts +20 -0
  95. package/dist/tools/workel_projects.d.ts.map +1 -0
  96. package/dist/tools/workel_projects.js +74 -0
  97. package/dist/tools/workel_projects.js.map +1 -0
  98. package/dist/tools/workel_task_comments.d.ts +21 -0
  99. package/dist/tools/workel_task_comments.d.ts.map +1 -0
  100. package/dist/tools/workel_task_comments.js +55 -0
  101. package/dist/tools/workel_task_comments.js.map +1 -0
  102. package/dist/tools/workel_tasks.d.ts +23 -0
  103. package/dist/tools/workel_tasks.d.ts.map +1 -0
  104. package/dist/tools/workel_tasks.js +104 -0
  105. package/dist/tools/workel_tasks.js.map +1 -0
  106. package/dist/tools/workel_whoami.d.ts +16 -0
  107. package/dist/tools/workel_whoami.d.ts.map +1 -0
  108. package/dist/tools/workel_whoami.js +36 -0
  109. package/dist/tools/workel_whoami.js.map +1 -0
  110. package/dist/version.d.ts +2 -0
  111. package/dist/version.d.ts.map +1 -0
  112. package/dist/version.js +28 -0
  113. package/dist/version.js.map +1 -0
  114. package/package.json +42 -0
@@ -0,0 +1,248 @@
1
+ "use strict";
2
+ /**
3
+ * The single place that translates between the MCP tool vocabulary and the
4
+ * Workel Public API v1 wire vocabulary. Everything downstream (the HTTP
5
+ * client, the tools themselves) speaks tool vocabulary only — if a field
6
+ * pair is missing here it is silently wrong everywhere it's used, not just
7
+ * here, so this module intentionally does the renaming explicitly per
8
+ * endpoint rather than through a generic `renameKeys(obj, map)` helper: an
9
+ * explicit mapper is what a reviewer can read directly against the spec.
10
+ *
11
+ * Write direction (tool input -> wire request body): the request-side
12
+ * "Wire*" types live here rather than in `types.ts`, since `types.ts` is
13
+ * scoped to wire *response* shapes. Authority for every field name and
14
+ * nullability below is `docs/openapi/public-api-v1.yaml` PLUS the actual
15
+ * FormRequest under `app/Http/Requests/PublicApi/V1/` (the FormRequest
16
+ * wins on any disagreement — it's what the server actually validates).
17
+ *
18
+ * Read direction (wire response -> tool object): uses the `Wire*` response
19
+ * types from `./types`.
20
+ *
21
+ * Deliberately NOT exposed in either direction: `reminder_date` on task
22
+ * update. The wire endpoint (`UpdatePublicTaskRequest`) accepts it, but it
23
+ * is write-only over this API (no read endpoint ever returns it) — exposing
24
+ * a field a caller can set but never read back breaks the read/write
25
+ * symmetry this seam exists to guarantee, so it is left out of the tool
26
+ * vocabulary entirely rather than passed through.
27
+ *
28
+ * Also deliberately NOT exposed: `mention_user_ids` on task comments. The
29
+ * FormRequest declares it `prohibited` (not silently ignored) — no
30
+ * @-mention syntax is parsed in v1 — so the tool-facing comment input has
31
+ * no such field to begin with, and `mapCreateCommentToWire` cannot forward
32
+ * one even if a caller forces it in via a type cast.
33
+ */
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.mapCreateTaskToWire = mapCreateTaskToWire;
36
+ exports.mapUpdateTaskToWire = mapUpdateTaskToWire;
37
+ exports.mapCreateEventToWire = mapCreateEventToWire;
38
+ exports.mapCreateCommentToWire = mapCreateCommentToWire;
39
+ exports.mapColumnFromWire = mapColumnFromWire;
40
+ exports.mapTaskFromWire = mapTaskFromWire;
41
+ exports.mapProjectFromWire = mapProjectFromWire;
42
+ exports.mapMemberFromWire = mapMemberFromWire;
43
+ exports.mapProjectColumnFromWire = mapProjectColumnFromWire;
44
+ exports.mapTaskCommentAuthorFromWire = mapTaskCommentAuthorFromWire;
45
+ exports.mapTaskCommentFromWire = mapTaskCommentFromWire;
46
+ exports.mapEventFromWire = mapEventFromWire;
47
+ /**
48
+ * True when `key` is an own, enumerable property of `obj` — used by every
49
+ * write mapper below to decide "was this field actually given" as opposed
50
+ * to "is its value falsy/undefined". An omitted key must be absent from the
51
+ * returned wire object entirely; an explicitly given `null` must survive to
52
+ * the wire as `null`. This is the one shared primitive that keeps that
53
+ * distinction identical across all four write mappers — if it drifts, it
54
+ * drifts everywhere at once and is easy to catch.
55
+ */
56
+ function hasOwn(obj, key) {
57
+ return Object.prototype.hasOwnProperty.call(obj, key);
58
+ }
59
+ function mapCreateTaskToWire(input) {
60
+ const wire = { title_text: input.title };
61
+ if (hasOwn(input, 'column_id'))
62
+ wire.card_id = input.column_id;
63
+ if (hasOwn(input, 'project_id'))
64
+ wire.project_id = input.project_id;
65
+ if (hasOwn(input, 'description'))
66
+ wire.description = input.description;
67
+ if (hasOwn(input, 'priority'))
68
+ wire.priority = input.priority;
69
+ if (hasOwn(input, 'progress'))
70
+ wire.progress = input.progress;
71
+ if (hasOwn(input, 'due_date'))
72
+ wire.end_date = input.due_date;
73
+ if (hasOwn(input, 'due_time'))
74
+ wire.end_time = input.due_time;
75
+ if (hasOwn(input, 'assignee_ids'))
76
+ wire.user_ids = input.assignee_ids;
77
+ return wire;
78
+ }
79
+ function mapUpdateTaskToWire(input) {
80
+ const wire = {};
81
+ if (hasOwn(input, 'title'))
82
+ wire.title_text = input.title;
83
+ if (hasOwn(input, 'description'))
84
+ wire.description = input.description;
85
+ if (hasOwn(input, 'priority'))
86
+ wire.priority = input.priority;
87
+ if (hasOwn(input, 'progress'))
88
+ wire.progress = input.progress;
89
+ if (hasOwn(input, 'due_date'))
90
+ wire.end_date = input.due_date;
91
+ if (hasOwn(input, 'due_time'))
92
+ wire.end_time = input.due_time;
93
+ return wire;
94
+ }
95
+ function mapCreateEventToWire(input) {
96
+ const wire = {
97
+ title: input.title,
98
+ date: input.date,
99
+ start_time: input.start_time,
100
+ end_time: input.end_time,
101
+ repeat: input.repeat,
102
+ };
103
+ if (hasOwn(input, 'description'))
104
+ wire.description = input.description;
105
+ if (hasOwn(input, 'reminder_at'))
106
+ wire.reminder_at = input.reminder_at;
107
+ if (hasOwn(input, 'timezone'))
108
+ wire.timezone = input.timezone;
109
+ if (hasOwn(input, 'reminder_minutes_before'))
110
+ wire.reminder_minutes_before = input.reminder_minutes_before;
111
+ if (hasOwn(input, 'repeat_interval'))
112
+ wire.repeat_interval = input.repeat_interval;
113
+ if (hasOwn(input, 'location'))
114
+ wire.location = input.location;
115
+ if (hasOwn(input, 'meet_link'))
116
+ wire.meet_link = input.meet_link;
117
+ if (hasOwn(input, 'color'))
118
+ wire.color = input.color;
119
+ if (hasOwn(input, 'order'))
120
+ wire.order = input.order;
121
+ if (hasOwn(input, 'project_id'))
122
+ wire.project_id = input.project_id;
123
+ if (hasOwn(input, 'invited_user_ids'))
124
+ wire.invited_users = input.invited_user_ids;
125
+ return wire;
126
+ }
127
+ function mapCreateCommentToWire(input) {
128
+ return { body: input.body };
129
+ }
130
+ // ---------------------------------------------------------------------------
131
+ // Read direction
132
+ // ---------------------------------------------------------------------------
133
+ /**
134
+ * Maps a task's embedded board-column ("card") to the tool vocabulary's
135
+ * `column`. Field-for-field, no rename among {id, name, is_done} — only the
136
+ * container's own name (`card` -> `column`) and the derived `column_id`
137
+ * (built by `mapTaskFromWire`, not here) change.
138
+ */
139
+ function mapColumnFromWire(card) {
140
+ return {
141
+ id: card.id,
142
+ name: card.name,
143
+ is_done: card.is_done,
144
+ };
145
+ }
146
+ /**
147
+ * Maps a wire Task response to the tool vocabulary. The nested `card`
148
+ * object becomes `column`, plus a derived `column_id` equal to the card's
149
+ * own id (both null when the task has no card). Every other field keeps
150
+ * its wire name — the OpenAPI Task schema already uses tool-natural names
151
+ * on read. Built field-by-field (never via object spread) so an unknown
152
+ * key on the wire response is silently dropped rather than leaking through,
153
+ * and so the literal key `card` can never appear anywhere in the output.
154
+ */
155
+ function mapTaskFromWire(task) {
156
+ const column = task.card ? mapColumnFromWire(task.card) : null;
157
+ return {
158
+ id: task.id,
159
+ title: task.title,
160
+ description: task.description,
161
+ project_id: task.project_id,
162
+ column,
163
+ column_id: task.card ? task.card.id : null,
164
+ priority: task.priority,
165
+ due_date: task.due_date,
166
+ due_time: task.due_time,
167
+ progress: task.progress,
168
+ completed: task.completed,
169
+ assignee_ids: task.assignee_ids,
170
+ created_at: task.created_at,
171
+ updated_at: task.updated_at,
172
+ };
173
+ }
174
+ // ---------------------------------------------------------------------------
175
+ // Read direction (continued, T7) — Project, Member, ProjectColumn,
176
+ // TaskComment, Event.
177
+ //
178
+ // Every field on each of these five wire response shapes already carries its
179
+ // tool-facing name (verified field-by-field against the resource classes
180
+ // cited in `./types`) — none of these five needs a rename the way
181
+ // `mapTaskFromWire` does for `card` -> `column`. Each mapper below still
182
+ // exists, rather than passing the wire object straight through, for the same
183
+ // reason `mapTaskFromWire`'s docblock gives: built field-by-field so an
184
+ // unrecognized key on the wire response can never leak into tool output.
185
+ // ---------------------------------------------------------------------------
186
+ function mapProjectFromWire(project) {
187
+ return {
188
+ id: project.id,
189
+ name: project.name,
190
+ description: project.description,
191
+ created_at: project.created_at,
192
+ updated_at: project.updated_at,
193
+ };
194
+ }
195
+ function mapMemberFromWire(member) {
196
+ return {
197
+ id: member.id,
198
+ name: member.name,
199
+ email: member.email,
200
+ role: member.role,
201
+ joined_at: member.joined_at,
202
+ };
203
+ }
204
+ /**
205
+ * The FULL board-column listing shape (`GET /projects/{id}/cards`) — see
206
+ * `ProjectColumn`'s own docblock in `./types` for why this is a distinct
207
+ * type/mapper from `mapColumnFromWire`'s narrower, Task-embedded `Column`.
208
+ */
209
+ function mapProjectColumnFromWire(card) {
210
+ return {
211
+ id: card.id,
212
+ name: card.name,
213
+ is_done: card.is_done,
214
+ order: card.order,
215
+ };
216
+ }
217
+ function mapTaskCommentAuthorFromWire(author) {
218
+ return {
219
+ id: author.id,
220
+ name: author.name,
221
+ };
222
+ }
223
+ function mapTaskCommentFromWire(comment) {
224
+ return {
225
+ id: comment.id,
226
+ body: comment.body,
227
+ author: comment.author ? mapTaskCommentAuthorFromWire(comment.author) : null,
228
+ created_at: comment.created_at,
229
+ };
230
+ }
231
+ function mapEventFromWire(event) {
232
+ return {
233
+ id: event.id,
234
+ title: event.title,
235
+ description: event.description,
236
+ date: event.date,
237
+ start_time: event.start_time,
238
+ end_time: event.end_time,
239
+ location: event.location,
240
+ project_id: event.project_id,
241
+ workspace_id: event.workspace_id,
242
+ color: event.color,
243
+ repeat: event.repeat,
244
+ created_at: event.created_at,
245
+ updated_at: event.updated_at,
246
+ };
247
+ }
248
+ //# sourceMappingURL=mapping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapping.js","sourceRoot":"","sources":["../../src/api/mapping.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;;AAgEH,kDAaC;AAkCD,kDAWC;AAuDD,oDAsBC;AAqBD,wDAEC;AAYD,8CAMC;AAWD,0CAmBC;AAeD,gDAQC;AAED,8CAQC;AAOD,4DAOC;AAED,oEAKC;AAED,wDAOC;AAED,4CAgBC;AA1UD;;;;;;;;GAQG;AACH,SAAS,MAAM,CAAC,GAAW,EAAE,GAAW;IACtC,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACxD,CAAC;AAgCD,SAAgB,mBAAmB,CAAC,KAAsB;IACxD,MAAM,IAAI,GAA0B,EAAE,UAAU,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IAEhE,IAAI,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC;QAAE,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC;IAC/D,IAAI,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC;QAAE,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;IACpE,IAAI,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC;QAAE,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;IACvE,IAAI,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC;QAAE,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;IAC9D,IAAI,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E,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,4BAA4B,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI;QAC5E,UAAU,EAAE,OAAO,CAAC,UAAU;KAC/B,CAAC;AACJ,CAAC;AAED,SAAgB,gBAAgB,CAAC,KAAgB;IAC/C,OAAO;QACL,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,UAAU,EAAE,KAAK,CAAC,UAAU;KAC7B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Secret redaction for the Workel MCP server.
3
+ *
4
+ * The workspace API key must never appear in logs, thrown errors, or tool
5
+ * results — including inside an upstream Laravel error body (e.g.
6
+ * `{"error":{"message":"invalid token wk_live_abc123"}}`) and including
7
+ * process-level crash output. This module is the single place that scrubs
8
+ * it, and is intentionally a leaf: it imports nothing else from this
9
+ * project, so any module (config, the API client, the entrypoint) can
10
+ * depend on it without creating a cycle.
11
+ */
12
+ export declare const PLACEHOLDER = "[REDACTED]";
13
+ /**
14
+ * Registers a secret so every subsequent `redact` / `redactDeep` /
15
+ * `formatCrash` call scrubs it, without needing to pass it in each time.
16
+ */
17
+ export declare function registerSecret(secret: string): void;
18
+ /** Clears the registry. Primarily for test isolation. */
19
+ export declare function clearSecrets(): void;
20
+ /**
21
+ * Replaces every occurrence of a known secret (registered, or passed via
22
+ * `extraSecrets`) and every `wk_`-shaped token with `PLACEHOLDER`.
23
+ */
24
+ export declare function redact(text: string, extraSecrets?: readonly string[]): string;
25
+ /**
26
+ * Recursively redacts string values inside plain objects and arrays.
27
+ * Non-plain objects (Date, Map, class instances, functions) and non-string
28
+ * primitives are returned unchanged. Object key order is preserved. Cycles
29
+ * (and repeat visits to a shared reference) are guarded via a WeakSet —
30
+ * a repeat visit returns the original reference rather than re-processing it.
31
+ */
32
+ export declare function redactDeep(value: unknown): unknown;
33
+ /**
34
+ * Formats a caught error/rejection reason for crash output, redacting the
35
+ * result as the final step so nothing — message, stack, or an arbitrary
36
+ * non-Error reason — can slip through unredacted.
37
+ */
38
+ export declare function formatCrash(kind: string, err: unknown): string;
39
+ /**
40
+ * Installs `uncaughtException` / `unhandledRejection` listeners that format
41
+ * (with redaction) and hand the text to `write`. Never calls `process.exit`
42
+ * — exit policy belongs to the caller. Returns a disposer that removes
43
+ * exactly the two listeners this call installed.
44
+ */
45
+ export declare function installCrashHandlers(write: (text: string) => void,
46
+ /**
47
+ * Called after the crash line is written. Registering an
48
+ * `uncaughtException` listener SUPPRESSES Node's default fatal behavior,
49
+ * so without an exit policy a crashed server keeps running in an unknown
50
+ * state with a live stdio transport — worse than dying. `index.ts` passes
51
+ * `process.exit`; tests pass a spy.
52
+ */
53
+ onFatal?: (code: number) => void): () => void;
54
+ //# sourceMappingURL=redact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../src/api/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,WAAW,eAAe,CAAC;AAcxC;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEnD;AAED,yDAAyD;AACzD,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAwBD;;;GAGG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,GAAE,SAAS,MAAM,EAAO,GAAG,MAAM,CASjF;AAkCD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAElD;AAqBD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,CAY9D;AAID;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI;AAC7B;;;;;;GAMG;AACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC/B,MAAM,IAAI,CAyBZ"}
@@ -0,0 +1,193 @@
1
+ "use strict";
2
+ /**
3
+ * Secret redaction for the Workel MCP server.
4
+ *
5
+ * The workspace API key must never appear in logs, thrown errors, or tool
6
+ * results — including inside an upstream Laravel error body (e.g.
7
+ * `{"error":{"message":"invalid token wk_live_abc123"}}`) and including
8
+ * process-level crash output. This module is the single place that scrubs
9
+ * it, and is intentionally a leaf: it imports nothing else from this
10
+ * project, so any module (config, the API client, the entrypoint) can
11
+ * depend on it without creating a cycle.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.PLACEHOLDER = void 0;
15
+ exports.registerSecret = registerSecret;
16
+ exports.clearSecrets = clearSecrets;
17
+ exports.redact = redact;
18
+ exports.redactDeep = redactDeep;
19
+ exports.formatCrash = formatCrash;
20
+ exports.installCrashHandlers = installCrashHandlers;
21
+ exports.PLACEHOLDER = '[REDACTED]';
22
+ /** Secrets shorter than this are never redacted — too likely to appear in ordinary text. */
23
+ const MIN_SECRET_LENGTH = 4;
24
+ /** Every `wk_`-prefixed token is redacted even if it was never explicitly registered. */
25
+ // A real key is `wk_` + Sanctum's `{tokenId}|{secret}` — the PIPE is part of
26
+ // the plaintext. The class must therefore include it, or this fallback
27
+ // redacts only the public token-id half and leaves the whole secret in the
28
+ // string (verified against a real minted key before this was widened).
29
+ const WK_TOKEN_PATTERN = /wk_[A-Za-z0-9_.|-]{4,}/g;
30
+ const secretRegistry = new Set();
31
+ /**
32
+ * Registers a secret so every subsequent `redact` / `redactDeep` /
33
+ * `formatCrash` call scrubs it, without needing to pass it in each time.
34
+ */
35
+ function registerSecret(secret) {
36
+ secretRegistry.add(secret);
37
+ }
38
+ /** Clears the registry. Primarily for test isolation. */
39
+ function clearSecrets() {
40
+ secretRegistry.clear();
41
+ }
42
+ function isEligibleSecret(secret) {
43
+ return secret.length >= MIN_SECRET_LENGTH;
44
+ }
45
+ function escapeRegExp(value) {
46
+ return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
47
+ }
48
+ /**
49
+ * Builds a single alternation over every eligible secret, longest first.
50
+ * Longest-first matters for overlapping secrets: regex alternation tries
51
+ * each branch in order at a given position, so a shorter secret that is a
52
+ * prefix/substring of a longer one must not be allowed to match first and
53
+ * leave a fragment of the longer secret exposed.
54
+ */
55
+ function buildSecretPattern(secrets) {
56
+ const unique = Array.from(new Set(secrets.filter(isEligibleSecret)));
57
+ if (unique.length === 0)
58
+ return null;
59
+ unique.sort((a, b) => b.length - a.length);
60
+ return new RegExp(unique.map(escapeRegExp).join('|'), 'g');
61
+ }
62
+ /**
63
+ * Replaces every occurrence of a known secret (registered, or passed via
64
+ * `extraSecrets`) and every `wk_`-shaped token with `PLACEHOLDER`.
65
+ */
66
+ function redact(text, extraSecrets = []) {
67
+ if (typeof text !== 'string' || text.length === 0)
68
+ return text;
69
+ let result = text;
70
+ const pattern = buildSecretPattern([...secretRegistry, ...extraSecrets]);
71
+ if (pattern) {
72
+ result = result.replace(pattern, exports.PLACEHOLDER);
73
+ }
74
+ return result.replace(WK_TOKEN_PATTERN, exports.PLACEHOLDER);
75
+ }
76
+ function isPlainObject(value) {
77
+ if (typeof value !== 'object' || value === null)
78
+ return false;
79
+ const proto = Object.getPrototypeOf(value);
80
+ return proto === Object.prototype || proto === null;
81
+ }
82
+ function redactDeepInternal(value, seen) {
83
+ if (typeof value === 'string') {
84
+ return redact(value);
85
+ }
86
+ if (Array.isArray(value)) {
87
+ if (seen.has(value))
88
+ return value;
89
+ seen.add(value);
90
+ return value.map((item) => redactDeepInternal(item, seen));
91
+ }
92
+ if (isPlainObject(value)) {
93
+ if (seen.has(value))
94
+ return value;
95
+ seen.add(value);
96
+ const result = {};
97
+ for (const key of Object.keys(value)) {
98
+ result[key] = redactDeepInternal(value[key], seen);
99
+ }
100
+ return result;
101
+ }
102
+ // Numbers, booleans, null, undefined, and any non-plain object (Date,
103
+ // Map, class instances, functions) pass through unchanged.
104
+ return value;
105
+ }
106
+ /**
107
+ * Recursively redacts string values inside plain objects and arrays.
108
+ * Non-plain objects (Date, Map, class instances, functions) and non-string
109
+ * primitives are returned unchanged. Object key order is preserved. Cycles
110
+ * (and repeat visits to a shared reference) are guarded via a WeakSet —
111
+ * a repeat visit returns the original reference rather than re-processing it.
112
+ */
113
+ function redactDeep(value) {
114
+ return redactDeepInternal(value, new WeakSet());
115
+ }
116
+ function safeStringifyReason(reason) {
117
+ if (typeof reason === 'string')
118
+ return reason;
119
+ if (typeof reason === 'object' && reason !== null) {
120
+ try {
121
+ const json = JSON.stringify(reason);
122
+ if (typeof json === 'string')
123
+ return json;
124
+ }
125
+ catch {
126
+ // Circular structures, BigInts, etc. — fall through to String().
127
+ }
128
+ }
129
+ try {
130
+ return String(reason);
131
+ }
132
+ catch {
133
+ return '[unstringifiable rejection reason]';
134
+ }
135
+ }
136
+ /**
137
+ * Formats a caught error/rejection reason for crash output, redacting the
138
+ * result as the final step so nothing — message, stack, or an arbitrary
139
+ * non-Error reason — can slip through unredacted.
140
+ */
141
+ function formatCrash(kind, err) {
142
+ let body;
143
+ if (err instanceof Error) {
144
+ const message = typeof err.message === 'string' ? err.message : String(err.message);
145
+ const stack = typeof err.stack === 'string' ? err.stack : '';
146
+ body = stack ? `${message}\n${stack}` : message;
147
+ }
148
+ else {
149
+ body = safeStringifyReason(err);
150
+ }
151
+ return redact(`[${kind}] ${body}`);
152
+ }
153
+ const CRASH_HANDLER_FALLBACK = '[crash handler failed to format the error]';
154
+ /**
155
+ * Installs `uncaughtException` / `unhandledRejection` listeners that format
156
+ * (with redaction) and hand the text to `write`. Never calls `process.exit`
157
+ * — exit policy belongs to the caller. Returns a disposer that removes
158
+ * exactly the two listeners this call installed.
159
+ */
160
+ function installCrashHandlers(write,
161
+ /**
162
+ * Called after the crash line is written. Registering an
163
+ * `uncaughtException` listener SUPPRESSES Node's default fatal behavior,
164
+ * so without an exit policy a crashed server keeps running in an unknown
165
+ * state with a live stdio transport — worse than dying. `index.ts` passes
166
+ * `process.exit`; tests pass a spy.
167
+ */
168
+ onFatal) {
169
+ const onUncaughtException = (err) => {
170
+ try {
171
+ write(formatCrash('uncaughtException', err));
172
+ }
173
+ catch {
174
+ write(CRASH_HANDLER_FALLBACK);
175
+ }
176
+ onFatal?.(1);
177
+ };
178
+ const onUnhandledRejection = (reason) => {
179
+ try {
180
+ write(formatCrash('unhandledRejection', reason));
181
+ }
182
+ catch {
183
+ write(CRASH_HANDLER_FALLBACK);
184
+ }
185
+ };
186
+ process.on('uncaughtException', onUncaughtException);
187
+ process.on('unhandledRejection', onUnhandledRejection);
188
+ return () => {
189
+ process.off('uncaughtException', onUncaughtException);
190
+ process.off('unhandledRejection', onUnhandledRejection);
191
+ };
192
+ }
193
+ //# sourceMappingURL=redact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact.js","sourceRoot":"","sources":["../../src/api/redact.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAoBH,wCAEC;AAGD,oCAEC;AA4BD,wBASC;AAyCD,gCAEC;AA0BD,kCAYC;AAUD,oDAmCC;AA5LY,QAAA,WAAW,GAAG,YAAY,CAAC;AAExC,4FAA4F;AAC5F,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B,yFAAyF;AACzF,6EAA6E;AAC7E,uEAAuE;AACvE,2EAA2E;AAC3E,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C,CAAC;IAC1D,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,155 @@
1
+ /**
2
+ * Wire response shapes for the Workel Public API v1, and the tool-facing
3
+ * shapes `mapping.ts` translates them into.
4
+ *
5
+ * `Wire*` types mirror `docs/openapi/public-api-v1.yaml` exactly — same
6
+ * field names, same required/nullable shape — because that file (plus the
7
+ * FormRequests under `app/Http/Requests/PublicApi/V1/` for the write side)
8
+ * is the authority for wire vocabulary, not this comment or any design doc.
9
+ * The tool-facing types (no `Wire` prefix) are what every MCP tool speaks;
10
+ * keeping the two families textually distinct means a `WireTask` leaking
11
+ * into code that expects a `Task` is a compile error, not a runtime bug.
12
+ *
13
+ * Types only — no runtime code, no functions. The translation itself lives
14
+ * in `mapping.ts`.
15
+ */
16
+ export interface WireProject {
17
+ id: string;
18
+ name: string;
19
+ description: string | null;
20
+ created_at: string | null;
21
+ updated_at: string | null;
22
+ }
23
+ export interface Project {
24
+ id: string;
25
+ name: string;
26
+ description: string | null;
27
+ created_at: string | null;
28
+ updated_at: string | null;
29
+ }
30
+ export interface WireCard {
31
+ id: string;
32
+ name: string;
33
+ is_done: boolean;
34
+ }
35
+ export interface Column {
36
+ id: string;
37
+ name: string;
38
+ is_done: boolean;
39
+ }
40
+ export interface WireProjectColumn {
41
+ id: string;
42
+ name: string;
43
+ is_done: boolean;
44
+ order: number;
45
+ }
46
+ export interface ProjectColumn {
47
+ id: string;
48
+ name: string;
49
+ is_done: boolean;
50
+ order: number;
51
+ }
52
+ export type MemberRole = 'owner' | 'admin' | 'member' | null;
53
+ export interface WireMember {
54
+ id: string;
55
+ name: string;
56
+ email: string;
57
+ role: MemberRole;
58
+ joined_at: string | null;
59
+ }
60
+ export interface Member {
61
+ id: string;
62
+ name: string;
63
+ email: string;
64
+ role: MemberRole;
65
+ joined_at: string | null;
66
+ }
67
+ export interface WireTask {
68
+ id: string;
69
+ title: string;
70
+ description: string | null;
71
+ project_id: string | null;
72
+ card: WireCard | null;
73
+ priority: string | null;
74
+ due_date: string | null;
75
+ due_time: string | null;
76
+ progress: number | null;
77
+ completed: boolean;
78
+ assignee_ids: string[];
79
+ created_at: string | null;
80
+ updated_at: string | null;
81
+ }
82
+ export interface Task {
83
+ id: string;
84
+ title: string;
85
+ description: string | null;
86
+ project_id: string | null;
87
+ column: Column | null;
88
+ column_id: string | null;
89
+ priority: string | null;
90
+ due_date: string | null;
91
+ due_time: string | null;
92
+ progress: number | null;
93
+ completed: boolean;
94
+ assignee_ids: string[];
95
+ created_at: string | null;
96
+ updated_at: string | null;
97
+ }
98
+ export interface WireTaskCommentAuthor {
99
+ id: string;
100
+ name: string;
101
+ }
102
+ export interface TaskCommentAuthor {
103
+ id: string;
104
+ name: string;
105
+ }
106
+ export interface WireTaskComment {
107
+ id: string;
108
+ body: string;
109
+ author: WireTaskCommentAuthor | null;
110
+ created_at: string | null;
111
+ }
112
+ export interface TaskComment {
113
+ id: string;
114
+ body: string;
115
+ author: TaskCommentAuthor | null;
116
+ created_at: string | null;
117
+ }
118
+ export type EventRepeat = 'none' | 'daily' | 'weekly' | 'monthly' | 'yearly' | null;
119
+ export interface WireEvent {
120
+ id: string;
121
+ title: string;
122
+ description: string | null;
123
+ date: string | null;
124
+ start_time: string | null;
125
+ end_time: string | null;
126
+ location: string | null;
127
+ project_id: string | null;
128
+ workspace_id: string | null;
129
+ color: string | null;
130
+ repeat: EventRepeat;
131
+ created_at: string | null;
132
+ updated_at: string | null;
133
+ }
134
+ export interface Event {
135
+ id: string;
136
+ title: string;
137
+ description: string | null;
138
+ date: string | null;
139
+ start_time: string | null;
140
+ end_time: string | null;
141
+ location: string | null;
142
+ project_id: string | null;
143
+ workspace_id: string | null;
144
+ color: string | null;
145
+ repeat: EventRepeat;
146
+ created_at: string | null;
147
+ updated_at: string | null;
148
+ }
149
+ export interface WireCursorPage<T> {
150
+ data: T[];
151
+ meta: {
152
+ next_cursor: string | null;
153
+ };
154
+ }
155
+ //# sourceMappingURL=types.d.ts.map