ework-web 0.10.113 → 0.10.115

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-web",
3
- "version": "0.10.113",
3
+ "version": "0.10.115",
4
4
  "type": "module",
5
5
  "description": "ework-web — standalone multi-project issue tracker. Local SQLite-backed, no external API dependency. Bun + TypeScript + SSR HTML.",
6
6
  "license": "MIT",
package/src/giteaApi.ts CHANGED
@@ -349,6 +349,11 @@ export async function handleGiteaApi(
349
349
  const body = (await readJson(req).catch(() => ({}))) as { model?: unknown };
350
350
  const model = typeof body.model === "string" ? body.model.trim() : "";
351
351
  await updateCommentModel(cid, model);
352
+ const tagged = await getComment(cid);
353
+ if (tagged && model) {
354
+ const taggedIssue = await getIssueById(tagged.issue_id);
355
+ if (taggedIssue) void emitCommentEvent(project.id, taggedIssue.id, cid, origin, "edited");
356
+ }
352
357
  return { status: 200, body: { ok: true, model } };
353
358
  } catch (e) {
354
359
  return giteaError(500, e instanceof Error ? e.message : String(e));
package/src/webhooks.ts CHANGED
@@ -307,6 +307,9 @@ interface PayloadComment {
307
307
  updated_at: string;
308
308
  user: PayloadUser;
309
309
  author_kind?: string;
310
+ /** Model that produced this comment (daemon writes it per-reply); mirrors
311
+ * surface it in the agent badge so upstream readers see which model ran. */
312
+ model?: string | null;
310
313
  /** Set when this comment was imported from an upstream tracker — receivers
311
314
  * must skip echoing it back (defense beyond the body marker). */
312
315
  upstream_comment_id?: number | null;
@@ -326,7 +329,7 @@ interface IssueEventPayload {
326
329
 
327
330
  interface CommentEventPayload {
328
331
  event_id?: string;
329
- action: "created";
332
+ action: "created" | "edited";
330
333
  issue: PayloadIssue;
331
334
  comment: PayloadComment;
332
335
  repository: PayloadRepository;
@@ -471,6 +474,7 @@ function buildComment(
471
474
  created_at: comment.created_at,
472
475
  updated_at: comment.updated_at,
473
476
  upstream_comment_id: comment.upstream_comment_id ?? null,
477
+ model: comment.model ?? null,
474
478
  user: buildUser(comment.author, origin),
475
479
  };
476
480
  }
@@ -483,9 +487,10 @@ function buildCommentPayload(
483
487
  origin: string,
484
488
  model?: string,
485
489
  labels: PayloadLabel[] = [],
490
+ action: "created" | "edited" = "created",
486
491
  ): CommentEventPayload {
487
492
  return {
488
- action: "created",
493
+ action,
489
494
  issue: buildIssue(issue, project, commentCount, origin, model, labels),
490
495
  comment: buildComment(issue, comment, project, origin),
491
496
  repository: buildRepository(project, origin, model, issue.runtime || undefined),
@@ -706,7 +711,8 @@ export async function emitCommentEvent(
706
711
  projectId: number,
707
712
  issueId: number,
708
713
  commentId: number,
709
- origin: string
714
+ origin: string,
715
+ action: "created" | "edited" = "created"
710
716
  ): Promise<void> {
711
717
  try {
712
718
  const project = await getProjectById(projectId);
@@ -722,7 +728,7 @@ export async function emitCommentEvent(
722
728
  const globalDefault = (await loadConfig()).defaultModel;
723
729
  const model = resolveModel(project.model, globalDefault, issue.model);
724
730
  const labels = await toPayloadLabels(issueId);
725
- const payload = buildCommentPayload(issue, comment, project, commentCount, origin, model, labels);
731
+ const payload = buildCommentPayload(issue, comment, project, commentCount, origin, model, labels, action);
726
732
  (payload as CommentEventPayload).event_id = randomUUID();
727
733
  if (authorUser) {
728
734
  payload.sender = buildUserFromRow(authorUser, origin);