@markus-global/cli 0.12.1-rc.0 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/markus.mjs +160 -46
- package/dist/web-ui/assets/{AsyncState-BE4ycfHk.js → AsyncState-C4a4KQ04.js} +1 -1
- package/dist/web-ui/assets/{CommentInput-DQIh2AYB.js → CommentInput-jN8Pjpy4.js} +1 -1
- package/dist/web-ui/assets/{ContentRenderer-C0L1YkNl.js → ContentRenderer-CkTLvnEu.js} +2 -2
- package/dist/web-ui/assets/{DeliverableShareModal-KlLlP9Fe.js → DeliverableShareModal-BjrQLmcX.js} +1 -1
- package/dist/web-ui/assets/{Deliverables-CiqT2Ipg.js → Deliverables-Cipn4z3F.js} +1 -1
- package/dist/web-ui/assets/{Notifications-82rU7lAf.js → Notifications-DBYrWqIL.js} +1 -1
- package/dist/web-ui/assets/{Search-CNNN3duL.js → Search-poQncU26.js} +1 -1
- package/dist/web-ui/assets/{SendToChat-EsNVdiYI.js → SendToChat-Xk5zlNy3.js} +1 -1
- package/dist/web-ui/assets/{Settings-COmJTMaX.js → Settings-DlhRiM77.js} +1 -1
- package/dist/web-ui/assets/{Store-Cb-RBY68.js → Store-Dp0MGa-t.js} +1 -1
- package/dist/web-ui/assets/{Switch-SqNs6-fd.js → Switch-CZAYoGju.js} +1 -1
- package/dist/web-ui/assets/{Team-DA5MQ-20.js → Team-D5wmT4Mj.js} +10 -10
- package/dist/web-ui/assets/{Work-D4noaLBo.js → Work-B8VUHTW7.js} +1 -1
- package/dist/web-ui/assets/{arc-BOFJ1EJN.js → arc-C7xiSR_L.js} +1 -1
- package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-BQ0qr0Vl.js → architectureDiagram-3BPJPVTR-BCM1UC9H.js} +1 -1
- package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-kSXlCE5q.js → blockDiagram-GPEHLZMM-Bl9V85eo.js} +1 -1
- package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-kCxqEGe5.js → c4Diagram-AAUBKEIU-BgyqGUI_.js} +1 -1
- package/dist/web-ui/assets/channel-xHjc9vd-.js +1 -0
- package/dist/web-ui/assets/{chunk-2J33WTMH-BgMluOvE.js → chunk-2J33WTMH-2znVHbo8.js} +1 -1
- package/dist/web-ui/assets/{chunk-4BX2VUAB-tu9bzY5y.js → chunk-4BX2VUAB-BGXPYXO3.js} +1 -1
- package/dist/web-ui/assets/{chunk-55IACEB6-DK9D0I2N.js → chunk-55IACEB6-B4GQDwv-.js} +1 -1
- package/dist/web-ui/assets/{chunk-727SXJPM-D_5Cdc0d.js → chunk-727SXJPM-D9WRILj0.js} +1 -1
- package/dist/web-ui/assets/{chunk-AQP2D5EJ-BUmO_w99.js → chunk-AQP2D5EJ-DQb0__Jh.js} +1 -1
- package/dist/web-ui/assets/{chunk-FMBD7UC4-Ck9FWl7n.js → chunk-FMBD7UC4-lEuLc0aj.js} +1 -1
- package/dist/web-ui/assets/{chunk-ND2GUHAM-Mvxy6fm4.js → chunk-ND2GUHAM-Dd5SDfdJ.js} +1 -1
- package/dist/web-ui/assets/{chunk-QZHKN3VN-C9xMd3WM.js → chunk-QZHKN3VN-Ds8u_1wB.js} +1 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-XGbYdlgY.js +1 -0
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-XGbYdlgY.js +1 -0
- package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-CUTkidkC.js → cose-bilkent-S5V4N54A-DZTfdLi_.js} +1 -1
- package/dist/web-ui/assets/{dagre-BM42HDAG-CGLda2Em.js → dagre-BM42HDAG-D1B-Tulw.js} +1 -1
- package/dist/web-ui/assets/{diagram-2AECGRRQ-DRl88ns2.js → diagram-2AECGRRQ-DITdhssl.js} +1 -1
- package/dist/web-ui/assets/{diagram-5GNKFQAL-rf4YhM9A.js → diagram-5GNKFQAL-CEQxFHzH.js} +1 -1
- package/dist/web-ui/assets/{diagram-KO2AKTUF-BD8mjYi6.js → diagram-KO2AKTUF-DxCnKGbb.js} +1 -1
- package/dist/web-ui/assets/{diagram-LMA3HP47-DiZICe4t.js → diagram-LMA3HP47-BOYuGZIr.js} +1 -1
- package/dist/web-ui/assets/{diagram-OG6HWLK6-Dj0Mw95G.js → diagram-OG6HWLK6-BNJgh7s8.js} +1 -1
- package/dist/web-ui/assets/{docx-preview-DQSKxlsK.js → docx-preview-CrUr10-f.js} +1 -1
- package/dist/web-ui/assets/{erDiagram-TEJ5UH35-BQq31SZZ.js → erDiagram-TEJ5UH35-BuCa252h.js} +1 -1
- package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-Cc82cW20.js → flowDiagram-I6XJVG4X-CVvFCkDE.js} +1 -1
- package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-D1MzI2Uw.js → ganttDiagram-6RSMTGT7-DmTrMDic.js} +1 -1
- package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-D1v-40GN.js → gitGraphDiagram-PVQCEYII-DkQpA-Z8.js} +1 -1
- package/dist/web-ui/assets/index-BEhLix2_.css +1 -0
- package/dist/web-ui/assets/{index-BXWHxoXp.js → index-CIrsLoqm.js} +79 -79
- package/dist/web-ui/assets/{infoDiagram-5YYISTIA-COPRgK1x.js → infoDiagram-5YYISTIA-C_rWcDW7.js} +1 -1
- package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-BmrWPE_9.js → ishikawaDiagram-YF4QCWOH-C0KnGaRN.js} +1 -1
- package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-C7WKxQjK.js → journeyDiagram-JHISSGLW-CuC-5aLM.js} +1 -1
- package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-yNU5HtNI.js → kanban-definition-UN3LZRKU-DU1_VSXa.js} +1 -1
- package/dist/web-ui/assets/{mermaid.core-B-JixiD0.js → mermaid.core-Bc0iYQ8k.js} +5 -5
- package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-CIC2Ov1E.js → mindmap-definition-RKZ34NQL-BVU3rzyG.js} +1 -1
- package/dist/web-ui/assets/{pieDiagram-4H26LBE5-CJn4Ut9d.js → pieDiagram-4H26LBE5-B7Lis7Cn.js} +1 -1
- package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-DcRyVlzO.js → quadrantDiagram-W4KKPZXB-DFFsDwCW.js} +1 -1
- package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-DiNbCJGt.js → requirementDiagram-4Y6WPE33-DFMxzahh.js} +1 -1
- package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-RHicfbUP.js → sankeyDiagram-5OEKKPKP-CQFj5LUY.js} +1 -1
- package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-P1XTa1MM.js → sequenceDiagram-3UESZ5HK-DN_1Aiqe.js} +1 -1
- package/dist/web-ui/assets/{stateDiagram-AJRCARHV-Dbu2PX-0.js → stateDiagram-AJRCARHV-DmePUv3C.js} +1 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-CFaxbhDx.js +1 -0
- package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-DGJ5VfHk.js → timeline-definition-PNZ67QCA-Cm8EYLTZ.js} +1 -1
- package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-B9fLD2oz.js → vennDiagram-CIIHVFJN-BhoN_mu0.js} +1 -1
- package/dist/web-ui/assets/{wardley-L42UT6IY-CH2NYUlK.js → wardley-L42UT6IY-DiYqNtfo.js} +1 -1
- package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-efQZMvBj.js → wardleyDiagram-YWT4CUSO-Bd8vpNb4.js} +1 -1
- package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-BNcrfIXF.js → xychartDiagram-2RQKCTM6-CHboDSbi.js} +1 -1
- package/dist/web-ui/index.html +2 -2
- package/package.json +1 -1
- package/dist/web-ui/assets/channel-MEPTI8rz.js +0 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-C-iFEC5t.js +0 -1
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-C-iFEC5t.js +0 -1
- package/dist/web-ui/assets/index-B0GCqbye.css +0 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-BVoD4Uz4.js +0 -1
package/dist/markus.mjs
CHANGED
|
@@ -5919,6 +5919,78 @@ var init_text = __esm({
|
|
|
5919
5919
|
}
|
|
5920
5920
|
});
|
|
5921
5921
|
|
|
5922
|
+
// ../shared/dist/utils/tags.js
|
|
5923
|
+
function checkTagsInput(value, field = "tags") {
|
|
5924
|
+
if (value === void 0 || value === null)
|
|
5925
|
+
return { ok: true, tags: void 0 };
|
|
5926
|
+
if (Array.isArray(value)) {
|
|
5927
|
+
const bad = value.findIndex((item) => typeof item !== "string");
|
|
5928
|
+
if (bad === -1) {
|
|
5929
|
+
const tags = value.map((tag) => tag.trim()).filter(Boolean);
|
|
5930
|
+
return { ok: true, tags };
|
|
5931
|
+
}
|
|
5932
|
+
return {
|
|
5933
|
+
ok: false,
|
|
5934
|
+
error: `Invalid \`${field}\`: every item must be a string, but item #${bad} is ${describe(value[bad])}. Nothing was written. Re-send as an array of strings, e.g. ${JSON.stringify(["tag-a", "tag-b"])}.`
|
|
5935
|
+
};
|
|
5936
|
+
}
|
|
5937
|
+
const hint = typeof value === "string" ? ` You sent the string ${JSON.stringify(value)} \u2014 split it into separate items.` : "";
|
|
5938
|
+
return {
|
|
5939
|
+
ok: false,
|
|
5940
|
+
error: `Invalid \`${field}\`: expected an array of strings, got ${describe(value)}.${hint} Nothing was written. Re-send as an array, e.g. ${JSON.stringify(["tag-a", "tag-b"])}.`
|
|
5941
|
+
};
|
|
5942
|
+
}
|
|
5943
|
+
function describe(value) {
|
|
5944
|
+
if (value === null)
|
|
5945
|
+
return "null";
|
|
5946
|
+
if (Array.isArray(value))
|
|
5947
|
+
return `an array (length ${value.length})`;
|
|
5948
|
+
if (typeof value === "object")
|
|
5949
|
+
return `an object ${JSON.stringify(value).slice(0, 60)}`;
|
|
5950
|
+
if (typeof value === "string")
|
|
5951
|
+
return `a string ${JSON.stringify(value.slice(0, 60))}`;
|
|
5952
|
+
return `a ${typeof value} (${String(value)})`;
|
|
5953
|
+
}
|
|
5954
|
+
function toStringArray(value) {
|
|
5955
|
+
if (value === null || value === void 0)
|
|
5956
|
+
return [];
|
|
5957
|
+
if (Array.isArray(value)) {
|
|
5958
|
+
const out = [];
|
|
5959
|
+
for (const item of value) {
|
|
5960
|
+
if (typeof item === "string") {
|
|
5961
|
+
const trimmed2 = item.trim();
|
|
5962
|
+
if (trimmed2)
|
|
5963
|
+
out.push(trimmed2);
|
|
5964
|
+
} else if (typeof item === "number" || typeof item === "boolean") {
|
|
5965
|
+
out.push(String(item));
|
|
5966
|
+
}
|
|
5967
|
+
}
|
|
5968
|
+
return out;
|
|
5969
|
+
}
|
|
5970
|
+
if (typeof value === "string") {
|
|
5971
|
+
const raw = value.trim();
|
|
5972
|
+
if (!raw)
|
|
5973
|
+
return [];
|
|
5974
|
+
if (raw.startsWith("[") || raw.startsWith("{") || raw.startsWith('"')) {
|
|
5975
|
+
try {
|
|
5976
|
+
return toStringArray(JSON.parse(raw));
|
|
5977
|
+
} catch {
|
|
5978
|
+
}
|
|
5979
|
+
}
|
|
5980
|
+
return raw.split(",").map((tag) => tag.trim()).filter(Boolean);
|
|
5981
|
+
}
|
|
5982
|
+
if (typeof value === "object") {
|
|
5983
|
+
const arrays = Object.values(value).filter(Array.isArray);
|
|
5984
|
+
return arrays.length === 1 ? toStringArray(arrays[0]) : [];
|
|
5985
|
+
}
|
|
5986
|
+
return [];
|
|
5987
|
+
}
|
|
5988
|
+
var init_tags = __esm({
|
|
5989
|
+
"../shared/dist/utils/tags.js"() {
|
|
5990
|
+
"use strict";
|
|
5991
|
+
}
|
|
5992
|
+
});
|
|
5993
|
+
|
|
5922
5994
|
// ../shared/dist/utils/platform.js
|
|
5923
5995
|
import { platform } from "node:os";
|
|
5924
5996
|
import { execFileSync, execSync } from "node:child_process";
|
|
@@ -6708,6 +6780,7 @@ __export(dist_exports, {
|
|
|
6708
6780
|
buildManifest: () => buildManifest,
|
|
6709
6781
|
cancelExecutionToken: () => cancelExecutionToken,
|
|
6710
6782
|
checkForUpdate: () => checkForUpdate,
|
|
6783
|
+
checkTagsInput: () => checkTagsInput,
|
|
6711
6784
|
clampHeartbeatIntervalMs: () => clampHeartbeatIntervalMs,
|
|
6712
6785
|
clearInitialAdminPassword: () => clearInitialAdminPassword,
|
|
6713
6786
|
clearNamedSecret: () => clearNamedSecret,
|
|
@@ -6820,6 +6893,7 @@ __export(dist_exports, {
|
|
|
6820
6893
|
summarizeEnv: () => summarizeEnv,
|
|
6821
6894
|
taskId: () => taskId,
|
|
6822
6895
|
toPackageSlug: () => toPackageSlug,
|
|
6896
|
+
toStringArray: () => toStringArray,
|
|
6823
6897
|
tokenizeSearchQuery: () => tokenizeSearchQuery,
|
|
6824
6898
|
topologicalSort: () => topologicalSort,
|
|
6825
6899
|
touchRunHeartbeat: () => touchRunHeartbeat,
|
|
@@ -6867,6 +6941,7 @@ var init_dist = __esm({
|
|
|
6867
6941
|
init_crash();
|
|
6868
6942
|
init_id();
|
|
6869
6943
|
init_text();
|
|
6944
|
+
init_tags();
|
|
6870
6945
|
init_literal_replace();
|
|
6871
6946
|
init_platform();
|
|
6872
6947
|
init_keyword_search();
|
|
@@ -67620,12 +67695,15 @@ function createAgentTaskTools(ctx) {
|
|
|
67620
67695
|
},
|
|
67621
67696
|
async execute(args) {
|
|
67622
67697
|
try {
|
|
67698
|
+
const tagsCheck = checkTagsInput(args["tags"]);
|
|
67699
|
+
if (!tagsCheck.ok)
|
|
67700
|
+
return JSON.stringify({ status: "error", error: tagsCheck.error });
|
|
67623
67701
|
const req = await ctx.proposeRequirement({
|
|
67624
67702
|
title: args["title"],
|
|
67625
67703
|
description: args["description"],
|
|
67626
67704
|
priority: args["priority"],
|
|
67627
67705
|
projectId: args["project_id"],
|
|
67628
|
-
tags:
|
|
67706
|
+
tags: tagsCheck.tags
|
|
67629
67707
|
});
|
|
67630
67708
|
log26.info(`Requirement proposed by agent ${ctx.agentId}`, {
|
|
67631
67709
|
requirementId: req.id,
|
|
@@ -67888,8 +67966,11 @@ function createAgentTaskTools(ctx) {
|
|
|
67888
67966
|
data.description = args["description"];
|
|
67889
67967
|
if (args["priority"])
|
|
67890
67968
|
data.priority = args["priority"];
|
|
67891
|
-
|
|
67892
|
-
|
|
67969
|
+
const tagsCheck = checkTagsInput(args["tags"]);
|
|
67970
|
+
if (!tagsCheck.ok)
|
|
67971
|
+
return JSON.stringify({ status: "error", error: tagsCheck.error });
|
|
67972
|
+
if (tagsCheck.tags)
|
|
67973
|
+
data.tags = tagsCheck.tags;
|
|
67893
67974
|
if (args["project_id"] !== void 0)
|
|
67894
67975
|
data.projectId = args["project_id"] || null;
|
|
67895
67976
|
const req = await ctx.updateRequirement(args["requirement_id"], data);
|
|
@@ -67951,8 +68032,11 @@ function createAgentTaskTools(ctx) {
|
|
|
67951
68032
|
updates.description = args["description"];
|
|
67952
68033
|
if (args["priority"])
|
|
67953
68034
|
updates.priority = args["priority"];
|
|
67954
|
-
|
|
67955
|
-
|
|
68035
|
+
const tagsCheck = checkTagsInput(args["tags"]);
|
|
68036
|
+
if (!tagsCheck.ok)
|
|
68037
|
+
return JSON.stringify({ status: "error", error: tagsCheck.error });
|
|
68038
|
+
if (tagsCheck.tags)
|
|
68039
|
+
updates.tags = tagsCheck.tags;
|
|
67956
68040
|
const hasUpdates = Object.keys(updates).length > 0;
|
|
67957
68041
|
const req = await ctx.resubmitRequirement(args["requirement_id"], hasUpdates ? updates : void 0);
|
|
67958
68042
|
return JSON.stringify({
|
|
@@ -68547,8 +68631,9 @@ function createProjectTools(ctx) {
|
|
|
68547
68631
|
description: "Content format of the deliverable file: markdown, html, text, json, csv, etc. Auto-detected from file extension if omitted."
|
|
68548
68632
|
},
|
|
68549
68633
|
tags: {
|
|
68550
|
-
type: "
|
|
68551
|
-
|
|
68634
|
+
type: "array",
|
|
68635
|
+
items: { type: "string" },
|
|
68636
|
+
description: "Tags for discoverability (optional)"
|
|
68552
68637
|
},
|
|
68553
68638
|
source: {
|
|
68554
68639
|
type: "string",
|
|
@@ -68589,8 +68674,10 @@ function createProjectTools(ctx) {
|
|
|
68589
68674
|
});
|
|
68590
68675
|
}
|
|
68591
68676
|
const projectId = (typeof args["project_id"] === "string" && args["project_id"] || typeof args["projectId"] === "string" && args["projectId"] || "").trim() || void 0;
|
|
68592
|
-
const
|
|
68593
|
-
|
|
68677
|
+
const tagsCheck = checkTagsInput(args["tags"]);
|
|
68678
|
+
if (!tagsCheck.ok)
|
|
68679
|
+
return JSON.stringify({ status: "error", error: tagsCheck.error });
|
|
68680
|
+
const tags = tagsCheck.tags;
|
|
68594
68681
|
const result = await ctx.deliverableCreate({
|
|
68595
68682
|
type,
|
|
68596
68683
|
title,
|
|
@@ -68747,18 +68834,21 @@ function createProjectTools(ctx) {
|
|
|
68747
68834
|
enum: ["active", "verified", "outdated"],
|
|
68748
68835
|
description: "New status (optional)"
|
|
68749
68836
|
},
|
|
68750
|
-
tags: { type: "string", description: "
|
|
68837
|
+
tags: { type: "array", items: { type: "string" }, description: "Tags for this deliverable (optional)" }
|
|
68751
68838
|
},
|
|
68752
68839
|
required: ["id"]
|
|
68753
68840
|
},
|
|
68754
68841
|
async execute(args) {
|
|
68755
68842
|
try {
|
|
68843
|
+
const tagsCheck = checkTagsInput(args["tags"]);
|
|
68844
|
+
if (!tagsCheck.ok)
|
|
68845
|
+
return JSON.stringify({ status: "error", error: tagsCheck.error });
|
|
68756
68846
|
const result = await ctx.deliverableUpdate(args["id"] ?? args["deliverable_id"], {
|
|
68757
68847
|
title: args["title"],
|
|
68758
68848
|
summary: args["summary"],
|
|
68759
68849
|
reference: args["reference"],
|
|
68760
68850
|
status: args["status"],
|
|
68761
|
-
tags:
|
|
68851
|
+
tags: tagsCheck.tags
|
|
68762
68852
|
});
|
|
68763
68853
|
if (!result)
|
|
68764
68854
|
return JSON.stringify({ status: "error", error: "Deliverable not found" });
|
|
@@ -68909,6 +68999,7 @@ function createProjectTools(ctx) {
|
|
|
68909
68999
|
var init_project_tools = __esm({
|
|
68910
69000
|
"../core/dist/tools/project-tools.js"() {
|
|
68911
69001
|
"use strict";
|
|
69002
|
+
init_dist();
|
|
68912
69003
|
}
|
|
68913
69004
|
});
|
|
68914
69005
|
|
|
@@ -205507,8 +205598,8 @@ function createOfficeGenerateTool(ctx) {
|
|
|
205507
205598
|
if (ctx.deliverableCreate) {
|
|
205508
205599
|
try {
|
|
205509
205600
|
const projectId = (typeof args["project_id"] === "string" && args["project_id"] || typeof args["projectId"] === "string" && args["projectId"] || "").trim() || void 0;
|
|
205510
|
-
const
|
|
205511
|
-
const tags =
|
|
205601
|
+
const tagsCheck = checkTagsInput(args["tags"]);
|
|
205602
|
+
const tags = tagsCheck.ok ? tagsCheck.tags ?? ["office", result.format] : ["office", result.format];
|
|
205512
205603
|
const fallbackTitle = basename6(result.outputPath, extname2(result.outputPath)) || `office-${result.format}`;
|
|
205513
205604
|
const dv = await ctx.deliverableCreate({
|
|
205514
205605
|
type: "file",
|
|
@@ -205545,6 +205636,7 @@ var init_office_generate = __esm({
|
|
|
205545
205636
|
init_pptxgen_es();
|
|
205546
205637
|
import_pdf_lib = __toESM(require_cjs(), 1);
|
|
205547
205638
|
import_fontkit = __toESM(require_fontkit_umd(), 1);
|
|
205639
|
+
init_dist();
|
|
205548
205640
|
PptxGenJSClass = PptxGenJS;
|
|
205549
205641
|
OFFICE_FORMATS = ["docx", "xlsx", "pptx", "pdf"];
|
|
205550
205642
|
OfficeGenerateError = class extends Error {
|
|
@@ -325445,7 +325537,7 @@ var init_agent_manager = __esm({
|
|
|
325445
325537
|
const ds = this.deliverableService;
|
|
325446
325538
|
return {
|
|
325447
325539
|
deliverableCreate: async (opts) => {
|
|
325448
|
-
const tags = opts.tags
|
|
325540
|
+
const tags = opts.tags;
|
|
325449
325541
|
return ds.create({
|
|
325450
325542
|
type: opts.type,
|
|
325451
325543
|
title: opts.title,
|
|
@@ -325482,7 +325574,7 @@ var init_agent_manager = __esm({
|
|
|
325482
325574
|
}).results;
|
|
325483
325575
|
},
|
|
325484
325576
|
deliverableUpdate: async (id, data) => {
|
|
325485
|
-
const tags = data.tags
|
|
325577
|
+
const tags = data.tags;
|
|
325486
325578
|
return ds.update(id, {
|
|
325487
325579
|
title: data.title,
|
|
325488
325580
|
summary: data.summary,
|
|
@@ -375615,6 +375707,11 @@ You can now:
|
|
|
375615
375707
|
this.json(res, 400, { error: "Creator identity is required" });
|
|
375616
375708
|
return;
|
|
375617
375709
|
}
|
|
375710
|
+
const tagsCheck = checkTagsInput(body["tags"]);
|
|
375711
|
+
if (!tagsCheck.ok) {
|
|
375712
|
+
this.json(res, 400, { error: tagsCheck.error });
|
|
375713
|
+
return;
|
|
375714
|
+
}
|
|
375618
375715
|
try {
|
|
375619
375716
|
const requirement = this.requirementService.createRequirement({
|
|
375620
375717
|
orgId: body["orgId"] ?? "default",
|
|
@@ -375624,7 +375721,7 @@ You can now:
|
|
|
375624
375721
|
projectId,
|
|
375625
375722
|
source: "user",
|
|
375626
375723
|
createdBy: authUser.userId,
|
|
375627
|
-
tags:
|
|
375724
|
+
tags: tagsCheck.tags
|
|
375628
375725
|
});
|
|
375629
375726
|
this.json(res, 201, { requirement });
|
|
375630
375727
|
} catch (e) {
|
|
@@ -375639,12 +375736,17 @@ You can now:
|
|
|
375639
375736
|
return;
|
|
375640
375737
|
}
|
|
375641
375738
|
const body = await this.readBody(req);
|
|
375739
|
+
const tagsCheck = checkTagsInput(body["tags"]);
|
|
375740
|
+
if (!tagsCheck.ok) {
|
|
375741
|
+
this.json(res, 400, { error: tagsCheck.error });
|
|
375742
|
+
return;
|
|
375743
|
+
}
|
|
375642
375744
|
try {
|
|
375643
375745
|
const requirement = this.requirementService.updateRequirement(reqId, {
|
|
375644
375746
|
title: body["title"],
|
|
375645
375747
|
description: body["description"],
|
|
375646
375748
|
priority: body["priority"],
|
|
375647
|
-
tags:
|
|
375749
|
+
tags: tagsCheck.tags,
|
|
375648
375750
|
projectId: body["projectId"]
|
|
375649
375751
|
});
|
|
375650
375752
|
this.json(res, 200, { requirement });
|
|
@@ -381284,6 +381386,18 @@ function fromJson(v) {
|
|
|
381284
381386
|
return null;
|
|
381285
381387
|
return JSON.parse(resolveJson(v));
|
|
381286
381388
|
}
|
|
381389
|
+
function arrayFromJson(v) {
|
|
381390
|
+
if (!v)
|
|
381391
|
+
return [];
|
|
381392
|
+
try {
|
|
381393
|
+
return toStringArray(fromJson(v));
|
|
381394
|
+
} catch {
|
|
381395
|
+
return toStringArray(v);
|
|
381396
|
+
}
|
|
381397
|
+
}
|
|
381398
|
+
function arrayToJson(v) {
|
|
381399
|
+
return JSON.stringify(toStringArray(v));
|
|
381400
|
+
}
|
|
381287
381401
|
function toDate(v) {
|
|
381288
381402
|
return v ? new Date(v) : null;
|
|
381289
381403
|
}
|
|
@@ -382449,7 +382563,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
382449
382563
|
create(data) {
|
|
382450
382564
|
const ts = now2();
|
|
382451
382565
|
this.db.prepare(`INSERT INTO agents (id, name, org_id, team_id, role_id, role_name, agent_role, skills, llm_config, compute_config, heartbeat_interval_ms, created_at, updated_at)
|
|
382452
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(data.id, data.name, data.orgId, data.teamId ?? null, data.roleId, data.roleName, data.agentRole ?? "worker",
|
|
382566
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(data.id, data.name, data.orgId, data.teamId ?? null, data.roleId, data.roleName, data.agentRole ?? "worker", arrayToJson(data.skills), toJson2(data.llmConfig ?? {}), toJson2(data.computeConfig ?? {}), data.heartbeatIntervalMs ?? DEFAULT_HEARTBEAT_INTERVAL_MS, ts, ts);
|
|
382453
382567
|
return this.findById(data.id);
|
|
382454
382568
|
}
|
|
382455
382569
|
findById(id) {
|
|
@@ -382497,7 +382611,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
382497
382611
|
}
|
|
382498
382612
|
if (data.skills !== void 0) {
|
|
382499
382613
|
sets.push("skills = ?");
|
|
382500
|
-
vals.push(
|
|
382614
|
+
vals.push(arrayToJson(data.skills));
|
|
382501
382615
|
}
|
|
382502
382616
|
if (data.llmConfig !== void 0) {
|
|
382503
382617
|
sets.push("llm_config = ?");
|
|
@@ -382528,7 +382642,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
382528
382642
|
roleName: r["role_name"],
|
|
382529
382643
|
agentRole: r["agent_role"],
|
|
382530
382644
|
status: r["status"],
|
|
382531
|
-
skills:
|
|
382645
|
+
skills: arrayFromJson(r["skills"]),
|
|
382532
382646
|
llmConfig: fromJson(r["llm_config"]),
|
|
382533
382647
|
computeConfig: fromJson(r["compute_config"]),
|
|
382534
382648
|
channels: fromJson(r["channels"]),
|
|
@@ -382718,7 +382832,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
382718
382832
|
executionRound: r["execution_round"] ?? 1,
|
|
382719
382833
|
subtasks: fromJson(r["subtasks"]) ?? [],
|
|
382720
382834
|
requirementId: r["requirement_id"],
|
|
382721
|
-
blockedBy:
|
|
382835
|
+
blockedBy: arrayFromJson(r["blocked_by"]),
|
|
382722
382836
|
workflowRunId: r["workflow_run_id"] ?? void 0,
|
|
382723
382837
|
workflowStepId: r["workflow_step_id"] ?? void 0,
|
|
382724
382838
|
result: fromJson(r["result"]),
|
|
@@ -382746,7 +382860,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
382746
382860
|
async create(data) {
|
|
382747
382861
|
const ts = now2();
|
|
382748
382862
|
this.db.prepare(`INSERT INTO requirements (id, org_id, title, description, status, priority, source, created_by, project_id, approved_by, approved_at, rejected_reason, rejected_by, tags, created_at, updated_at)
|
|
382749
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(data.id, data.orgId, data.title, data.description ?? "", data.status ?? "pending", data.priority ?? "medium", data.source, data.createdBy, data.projectId ?? null, data.approvedBy ?? null, data.approvedAt?.toISOString() ?? null, null, null,
|
|
382863
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(data.id, data.orgId, data.title, data.description ?? "", data.status ?? "pending", data.priority ?? "medium", data.source, data.createdBy, data.projectId ?? null, data.approvedBy ?? null, data.approvedAt?.toISOString() ?? null, null, null, arrayToJson(data.tags), ts, ts);
|
|
382750
382864
|
return this.findById(data.id);
|
|
382751
382865
|
}
|
|
382752
382866
|
findById(id) {
|
|
@@ -382784,7 +382898,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
382784
382898
|
}
|
|
382785
382899
|
if (data.tags !== void 0) {
|
|
382786
382900
|
sets.push("tags = ?");
|
|
382787
|
-
vals.push(
|
|
382901
|
+
vals.push(arrayToJson(data.tags));
|
|
382788
382902
|
}
|
|
382789
382903
|
if (data.projectId !== void 0) {
|
|
382790
382904
|
sets.push("project_id = ?");
|
|
@@ -382841,7 +382955,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
382841
382955
|
approvedAt: toDate(r["approved_at"]),
|
|
382842
382956
|
rejectedReason: r["rejected_reason"],
|
|
382843
382957
|
rejectedBy: r["rejected_by"],
|
|
382844
|
-
tags:
|
|
382958
|
+
tags: arrayFromJson(r["tags"]),
|
|
382845
382959
|
goalConfig: gc ? {
|
|
382846
382960
|
loopEnabled: gc["loopEnabled"] === true,
|
|
382847
382961
|
completionCriteria: gc["completionCriteria"] ?? "",
|
|
@@ -382917,12 +383031,12 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
382917
383031
|
description: r["description"],
|
|
382918
383032
|
status: r["status"],
|
|
382919
383033
|
repositories: fromJson(r["repositories"]) ?? [],
|
|
382920
|
-
teamIds:
|
|
383034
|
+
teamIds: arrayFromJson(r["team_ids"]),
|
|
382921
383035
|
governancePolicy: fromJson(r["governance_policy"]),
|
|
382922
383036
|
archivePolicy: fromJson(r["archive_policy"]),
|
|
382923
383037
|
reportSchedule: fromJson(r["report_schedule"]),
|
|
382924
383038
|
onboardingConfig: fromJson(r["onboarding_config"]),
|
|
382925
|
-
knowledgeBasePaths:
|
|
383039
|
+
knowledgeBasePaths: arrayFromJson(r["knowledge_base_paths"]),
|
|
382926
383040
|
createdBy: r["created_by"],
|
|
382927
383041
|
createdAt: r["created_at"],
|
|
382928
383042
|
updatedAt: r["updated_at"]
|
|
@@ -383111,7 +383225,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
383111
383225
|
authorType: r["author_type"],
|
|
383112
383226
|
content: r["content"],
|
|
383113
383227
|
attachments: fromJson(r["attachments"]),
|
|
383114
|
-
mentions:
|
|
383228
|
+
mentions: arrayFromJson(r["mentions"]),
|
|
383115
383229
|
activityId: r["activity_id"],
|
|
383116
383230
|
replyToId: r["reply_to_id"] ?? void 0,
|
|
383117
383231
|
replyToAuthor: r["reply_to_author"] ?? void 0,
|
|
@@ -383157,7 +383271,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
383157
383271
|
authorType: r["author_type"],
|
|
383158
383272
|
content: r["content"],
|
|
383159
383273
|
attachments: fromJson(r["attachments"]),
|
|
383160
|
-
mentions:
|
|
383274
|
+
mentions: arrayFromJson(r["mentions"]),
|
|
383161
383275
|
activityId: r["activity_id"],
|
|
383162
383276
|
replyToId: r["reply_to_id"] ?? void 0,
|
|
383163
383277
|
replyToAuthor: r["reply_to_author"] ?? void 0,
|
|
@@ -383694,7 +383808,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
383694
383808
|
senderType: r["sender_type"],
|
|
383695
383809
|
senderName: r["sender_name"],
|
|
383696
383810
|
text: r["text"],
|
|
383697
|
-
mentions:
|
|
383811
|
+
mentions: arrayFromJson(r["mentions"]),
|
|
383698
383812
|
metadata: expandImageRefs(fromJson(r["metadata"])),
|
|
383699
383813
|
replyToId: r["reply_to_id"] ?? void 0,
|
|
383700
383814
|
replyToSender: r["reply_to_sender"] ?? void 0,
|
|
@@ -383956,7 +384070,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
383956
384070
|
const ts = now2();
|
|
383957
384071
|
const status = data.status ?? "draft";
|
|
383958
384072
|
this.db.prepare(`INSERT INTO marketplace_templates (id, name, description, source, status, version, author_id, author_name, role_id, agent_role, skills, llm_provider, tags, category, icon, heartbeat_interval_ms, starter_tasks, config, published_at, created_at, updated_at)
|
|
383959
|
-
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`).run(data.id, data.name, data.description, data.source ?? "community", status, data.version ?? "1.0.0", data.authorId ?? null, data.authorName, data.roleId, data.agentRole ?? "worker",
|
|
384073
|
+
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`).run(data.id, data.name, data.description, data.source ?? "community", status, data.version ?? "1.0.0", data.authorId ?? null, data.authorName, data.roleId, data.agentRole ?? "worker", arrayToJson(data.skills), data.llmProvider ?? null, arrayToJson(data.tags), data.category, data.icon ?? null, data.heartbeatIntervalMs ?? null, toJson2(data.starterTasks ?? []), toJson2(data.config ?? {}), status === "published" ? ts : null, ts, ts);
|
|
383960
384074
|
return this.findById(data.id);
|
|
383961
384075
|
}
|
|
383962
384076
|
findById(id) {
|
|
@@ -384024,11 +384138,11 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
384024
384138
|
}
|
|
384025
384139
|
if (data.skills !== void 0) {
|
|
384026
384140
|
sets.push("skills = ?");
|
|
384027
|
-
vals.push(
|
|
384141
|
+
vals.push(arrayToJson(data.skills));
|
|
384028
384142
|
}
|
|
384029
384143
|
if (data.tags !== void 0) {
|
|
384030
384144
|
sets.push("tags = ?");
|
|
384031
|
-
vals.push(
|
|
384145
|
+
vals.push(arrayToJson(data.tags));
|
|
384032
384146
|
}
|
|
384033
384147
|
if (data.category !== void 0) {
|
|
384034
384148
|
sets.push("category = ?");
|
|
@@ -384071,9 +384185,9 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
384071
384185
|
authorName: r["author_name"],
|
|
384072
384186
|
roleId: r["role_id"],
|
|
384073
384187
|
agentRole: r["agent_role"],
|
|
384074
|
-
skills:
|
|
384188
|
+
skills: arrayFromJson(r["skills"]),
|
|
384075
384189
|
llmProvider: r["llm_provider"],
|
|
384076
|
-
tags:
|
|
384190
|
+
tags: arrayFromJson(r["tags"]),
|
|
384077
384191
|
category: r["category"],
|
|
384078
384192
|
icon: r["icon"],
|
|
384079
384193
|
heartbeatIntervalMs: r["heartbeat_interval_ms"],
|
|
@@ -384097,7 +384211,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
384097
384211
|
const ts = now2();
|
|
384098
384212
|
const status = data.status ?? "draft";
|
|
384099
384213
|
this.db.prepare(`INSERT INTO marketplace_skills (id, name, description, source, status, version, author_id, author_name, category, tags, tools, readme, required_permissions, required_env, config, published_at, created_at, updated_at)
|
|
384100
|
-
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`).run(data.id, data.name, data.description, data.source ?? "community", status, data.version ?? "1.0.0", data.authorId ?? null, data.authorName, data.category,
|
|
384214
|
+
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`).run(data.id, data.name, data.description, data.source ?? "community", status, data.version ?? "1.0.0", data.authorId ?? null, data.authorName, data.category, arrayToJson(data.tags), toJson2(data.tools ?? []), data.readme ?? null, toJson2(data.requiredPermissions ?? []), toJson2(data.requiredEnv ?? []), toJson2(data.config ?? {}), status === "published" ? ts : null, ts, ts);
|
|
384101
384215
|
return this.findById(data.id);
|
|
384102
384216
|
}
|
|
384103
384217
|
findById(id) {
|
|
@@ -384162,11 +384276,11 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
384162
384276
|
authorId: r["author_id"],
|
|
384163
384277
|
authorName: r["author_name"],
|
|
384164
384278
|
category: r["category"],
|
|
384165
|
-
tags:
|
|
384279
|
+
tags: arrayFromJson(r["tags"]),
|
|
384166
384280
|
tools: fromJson(r["tools"]),
|
|
384167
384281
|
readme: r["readme"],
|
|
384168
|
-
requiredPermissions:
|
|
384169
|
-
requiredEnv:
|
|
384282
|
+
requiredPermissions: arrayFromJson(r["required_permissions"]),
|
|
384283
|
+
requiredEnv: arrayFromJson(r["required_env"]),
|
|
384170
384284
|
config: fromJson(r["config"]),
|
|
384171
384285
|
downloadCount: r["download_count"],
|
|
384172
384286
|
avgRating: r["avg_rating"],
|
|
@@ -384246,7 +384360,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
384246
384360
|
create(data) {
|
|
384247
384361
|
const ts = now2();
|
|
384248
384362
|
this.db.prepare(`INSERT INTO agent_knowledge (id, agent_id, org_id, category, title, content, tags, source, metadata, importance, created_at, updated_at)
|
|
384249
|
-
VALUES (?,?,?,?,?,?,?,?,?,?,?,?)`).run(data.id, data.agentId, data.orgId, data.category, data.title, data.content,
|
|
384363
|
+
VALUES (?,?,?,?,?,?,?,?,?,?,?,?)`).run(data.id, data.agentId, data.orgId, data.category, data.title, data.content, arrayToJson(data.tags), data.source ?? "agent", toJson2(data.metadata ?? {}), data.importance ?? 50, ts, ts);
|
|
384250
384364
|
return this.findById(data.id);
|
|
384251
384365
|
}
|
|
384252
384366
|
findById(id) {
|
|
@@ -384294,7 +384408,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
384294
384408
|
}
|
|
384295
384409
|
if (data.tags !== void 0) {
|
|
384296
384410
|
sets.push("tags = ?");
|
|
384297
|
-
vals.push(
|
|
384411
|
+
vals.push(arrayToJson(data.tags));
|
|
384298
384412
|
}
|
|
384299
384413
|
if (data.importance !== void 0) {
|
|
384300
384414
|
sets.push("importance = ?");
|
|
@@ -384329,7 +384443,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
384329
384443
|
category: r["category"],
|
|
384330
384444
|
title: r["title"],
|
|
384331
384445
|
content: r["content"],
|
|
384332
|
-
tags:
|
|
384446
|
+
tags: arrayFromJson(r["tags"]),
|
|
384333
384447
|
source: r["source"],
|
|
384334
384448
|
metadata: fromJson(r["metadata"]),
|
|
384335
384449
|
importance: r["importance"],
|
|
@@ -384378,7 +384492,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
384378
384492
|
externalAgentId: r["external_agent_id"],
|
|
384379
384493
|
agentName: r["agent_name"],
|
|
384380
384494
|
orgId: r["org_id"],
|
|
384381
|
-
capabilities:
|
|
384495
|
+
capabilities: arrayFromJson(r["capabilities"]),
|
|
384382
384496
|
platform: r["platform"],
|
|
384383
384497
|
platformConfig: r["platform_config"],
|
|
384384
384498
|
agentCardUrl: r["agent_card_url"],
|
|
@@ -384404,7 +384518,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
384404
384518
|
artifact_type, artifact_data, access_count, hub_share_id, share_status, share_url,
|
|
384405
384519
|
share_visibility, share_reason, created_at, updated_at)
|
|
384406
384520
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, ?, ?, ?, ?, ?, ?, ?)
|
|
384407
|
-
`).run(data.id, data.type, data.title ?? "", data.summary ?? "", data.reference ?? "", data.format ?? null,
|
|
384521
|
+
`).run(data.id, data.type, data.title ?? "", data.summary ?? "", data.reference ?? "", data.format ?? null, arrayToJson(data.tags), data.status ?? "active", data.source ?? "agent", data.knowledgeRoot ?? null, data.content ?? null, data.taskId ?? null, data.agentId ?? null, data.projectId ?? null, data.requirementId ?? null, data.diffStats ? toJson2(data.diffStats) : null, data.testResults ? toJson2(data.testResults) : null, data.artifactType ?? null, data.artifactData ? toJson2(data.artifactData) : null, data.hubShareId ?? null, data.shareStatus ?? null, data.shareUrl ?? null, data.shareVisibility ?? null, data.shareReason ?? null, n2, n2);
|
|
384408
384522
|
return this.findById(data.id);
|
|
384409
384523
|
}
|
|
384410
384524
|
async findById(id) {
|
|
@@ -384466,7 +384580,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
384466
384580
|
}
|
|
384467
384581
|
if (patch.tags !== void 0) {
|
|
384468
384582
|
sets.push("tags = ?");
|
|
384469
|
-
vals.push(
|
|
384583
|
+
vals.push(arrayToJson(patch.tags));
|
|
384470
384584
|
}
|
|
384471
384585
|
if (patch.reference !== void 0) {
|
|
384472
384586
|
sets.push("reference = ?");
|
|
@@ -384572,7 +384686,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
384572
384686
|
summary: r["summary"],
|
|
384573
384687
|
reference: r["reference"],
|
|
384574
384688
|
format: r["format"] ?? null,
|
|
384575
|
-
tags:
|
|
384689
|
+
tags: arrayFromJson(r["tags"]) ?? [],
|
|
384576
384690
|
status: r["status"],
|
|
384577
384691
|
source: r["source"] ?? "agent",
|
|
384578
384692
|
knowledgeRoot: r["knowledge_root"] ?? null,
|
|
@@ -385362,7 +385476,7 @@ CREATE INDEX IF NOT EXISTS idx_pending_callbacks_agent ON pending_callbacks(agen
|
|
|
385362
385476
|
selectedOption: r["selected_option"],
|
|
385363
385477
|
questions: fromJson(r["questions"]) ?? void 0,
|
|
385364
385478
|
answers: fromJson(r["answers"]) ?? void 0,
|
|
385365
|
-
approverUserIds:
|
|
385479
|
+
approverUserIds: arrayFromJson(r["approver_user_ids"]),
|
|
385366
385480
|
targetUserId: r["target_user_id"] ?? void 0,
|
|
385367
385481
|
appliedAt: r["applied_at"] ?? void 0,
|
|
385368
385482
|
appliedIntent: r["applied_intent"] ?? void 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as c,j as e}from"./index-
|
|
1
|
+
import{u as c,j as e}from"./index-CIrsLoqm.js";function a(...t){return t.filter(Boolean).join(" ")}function d({className:t}){return e.jsxs("svg",{className:a("animate-spin shrink-0",t??"w-3.5 h-3.5"),viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"2.5",opacity:"0.2"}),e.jsx("path",{d:"M21 12a9 9 0 0 0-9-9",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})]})}function u({label:t,className:r}){const{t:n}=c("common");return e.jsxs("div",{className:a("flex-1 flex flex-col items-center justify-center gap-2.5 py-10 text-fg-tertiary",r),role:"status","aria-live":"polite",children:[e.jsx(d,{className:"w-5 h-5 text-brand-400"}),e.jsx("span",{className:"text-xs",children:t??n("loading")})]})}function p({rows:t=3,label:r,variant:n="skeleton",className:s}){const{t:i}=c("common");return n==="text"?e.jsxs("div",{className:a("flex items-center gap-2 px-1 py-2 text-xs text-fg-tertiary",s),role:"status","aria-live":"polite",children:[e.jsx(d,{className:"w-3 h-3"}),e.jsx("span",{children:r??i("loading")})]}):e.jsx("div",{className:a("space-y-2.5 p-1",s),role:"status","aria-live":"polite","aria-label":r??i("loading"),children:Array.from({length:t}).map((o,l)=>e.jsxs("div",{className:"animate-pulse space-y-1.5",children:[e.jsx("div",{className:"h-3.5 bg-surface-elevated rounded w-2/3"}),e.jsx("div",{className:"h-2.5 bg-surface-elevated/70 rounded w-1/3"})]},l))})}function f({icon:t,title:r,hint:n,action:s,size:i="md",className:o}){const l=i==="sm"?"py-6":i==="lg"?"py-16":"py-10",x=i==="sm"?"text-xs":"text-sm";return e.jsxs("div",{className:a("flex flex-col items-center justify-center text-center px-4",l,o),children:[t&&e.jsx("div",{className:"mb-2.5 text-fg-muted",children:t}),e.jsx("div",{className:a("font-medium text-fg-secondary",x),children:r}),n&&e.jsx("div",{className:"mt-1 text-xs text-fg-tertiary max-w-xs leading-relaxed",children:n}),s&&e.jsx("button",{onClick:s.onClick,className:a("mt-3 px-3 py-1.5 rounded-md text-xs font-medium transition-colors",s.variant==="secondary"?"border border-border-default text-fg-secondary hover:bg-surface-elevated":"bg-brand-600 hover:bg-brand-500 text-white"),children:s.label})]})}export{f as E,p as L,u as P,d as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,u as T,r as a,k as ee}from"./index-BXWHxoXp.js";const te=1920,ne=10*1024*1024,W=5,se=.8;function re(l,u,i){return new Promise((b,f)=>{const w=new Image;w.onload=()=>{let{width:r,height:s}=w;if(r<=u&&s<=u){b(l);return}r>s?(s=Math.round(s*(u/r)),r=u):(r=Math.round(r*(u/s)),s=u);const h=document.createElement("canvas");h.width=r,h.height=s;const g=h.getContext("2d");if(!g){f(new Error("Failed to get canvas context"));return}g.drawImage(w,0,0,r,s),b(h.toDataURL("image/jpeg",i))},w.onerror=()=>f(new Error("Failed to load image")),w.src=l})}function ae({candidates:l,filter:u,anchorRef:i,onSelect:b,selectedIndex:f,onIndexChange:w}){const{t:r}=T("common"),[s,h]=a.useState(null),g=a.useRef(null),y=l.filter(d=>d.name.toLowerCase().includes(u));return a.useEffect(()=>{const d=i.current;if(!d)return;const x=d.getBoundingClientRect();h({top:x.top+window.scrollY-4,left:x.left+window.scrollX+8})},[i,u]),a.useEffect(()=>{if(!g.current||!s)return;if(g.current.getBoundingClientRect().top<8){const x=i.current;if(!x)return;const c=x.getBoundingClientRect();h({top:c.bottom+window.scrollY+4,left:s.left})}},[s,i]),a.useEffect(()=>{f>=y.length&&w(Math.max(0,y.length-1))},[y.length,f,w]),a.useEffect(()=>{if(!g.current)return;g.current.querySelector('[data-selected="true"]')?.scrollIntoView({block:"nearest"})},[f]),!s||y.length===0?null:ee.createPortal(t.jsxs("div",{ref:g,style:{position:"absolute",top:s.top,left:s.left,transform:"translateY(-100%)"},className:"w-60 bg-surface-overlay border border-border-default rounded-lg shadow-xl z-[9999] max-h-48 overflow-y-auto",children:[t.jsx("div",{className:"px-2.5 py-1.5 text-[10px] text-fg-tertiary font-medium uppercase tracking-wider border-b border-border-default",children:r("commentInput.mentionHeading")}),y.map((d,x)=>t.jsxs("button",{"data-selected":x===f,onMouseDown:c=>{c.preventDefault(),b(d)},onMouseEnter:()=>w(x),className:`w-full text-left px-3 py-2 text-xs flex items-center gap-2 transition-colors ${x===f?"bg-brand-500/15 text-brand-500":"hover:bg-surface-elevated"}`,children:[t.jsx("span",{className:`w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-bold shrink-0 ${d.type==="human"?"bg-green-500/20 text-green-500":"bg-brand-500/20 text-brand-500"}`,children:d.name.slice(0,2).toUpperCase()}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("span",{className:"text-fg-primary font-medium",children:d.name}),t.jsx("span",{className:"text-fg-tertiary text-[10px] ml-1.5",children:d.subtitle??d.type})]}),d.type==="agent"&&t.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${d.online?"bg-green-400":"bg-gray-500"}`})]},d.id))]}),document.body)}function oe(l){return/^\w+$/.test(l)?`@${l}`:`@[${l}]`}const K=/@\[([^\]]+)\]|@([\w\p{L}\p{N}]+)/gu;function ie(l){const u=[];let i;for(K.lastIndex=0;(i=K.exec(l))!==null;)u.push(i[1]??i[2]);return u}function ce(l,u,i){const b=[];let f=0;const w=u.map(s=>s.name).sort((s,h)=>h.length-s.length);let r=0;for(;r<l.length;){const s=l.indexOf("@",r);if(s<0){b.push(t.jsx("span",{children:l.slice(r)},f++));break}if(s>r&&b.push(t.jsx("span",{children:l.slice(r,s)},f++)),l[s+1]==="["){const c=l.indexOf("]",s+2);if(c>s+2){const m=l.slice(s+2,c),j=u.find(k=>k.name.toLowerCase()===m.toLowerCase());b.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&j?"cursor-pointer hover:underline":""}`,onClick:i&&j?k=>i(j,k):void 0,title:j?`${j.name} (${j.role})`:void 0,children:["@",m]},f++)),r=c+1;continue}}const h=l.slice(s+1),g=h.toLowerCase(),y=w.find(c=>g.startsWith(c.toLowerCase()));if(y){const c=u.find(m=>m.name.toLowerCase()===y.toLowerCase());b.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&c?"cursor-pointer hover:underline":""}`,onClick:i&&c?m=>i(c,m):void 0,title:c?`${c.name} (${c.role})`:void 0,children:["@",y]},f++)),r=s+1+y.length;continue}const d=/^([\w\p{L}\p{N}]+)/u,x=h.match(d);if(x){const c=x[1],m=u.find(j=>j.name.toLowerCase()===c.toLowerCase());b.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&m?"cursor-pointer hover:underline":""}`,onClick:i&&m?j=>i(m,j):void 0,title:m?`${m.name} (${m.role})`:void 0,children:["@",c]},f++)),r=s+1+c.length;continue}b.push(t.jsx("span",{children:"@"},f++)),r=s+1}return b.length>0?b:[t.jsx("span",{children:l},0)]}function de({agents:l,humans:u,onSubmit:i,placeholder:b,replyTo:f,onCancelReply:w}){const{t:r}=T("common"),[s,h]=a.useState(""),[g,y]=a.useState(!1),[d,x]=a.useState(null),[c,m]=a.useState(!1),[j,k]=a.useState(""),[C,S]=a.useState([]),[B,I]=a.useState(0),[N,M]=a.useState([]),[z,A]=a.useState(!1),F=a.useRef(null),U=a.useRef(null),L=a.useRef(null),$=a.useMemo(()=>{const e=(u??[]).map(n=>({id:n.id,name:n.name,type:"human",subtitle:n.role}));for(const n of l)e.push({id:n.id,name:n.name,type:"agent",subtitle:n.role,online:n.status==="idle"||n.status==="working"});return e},[l,u]),D=$.filter(e=>e.name.toLowerCase().includes(j)),E=a.useCallback(e=>{const n=Array.from(e).filter(o=>o.type.startsWith("image/"));if(n.length!==0)for(const o of n){if(o.size>ne)continue;const p=new FileReader;p.onload=()=>{const R=p.result;re(R,te,se).then(v=>{M(_=>_.length>=W?_:[..._,{id:`img_${Date.now()}_${Math.random().toString(36).slice(2,6)}`,dataUrl:v,name:o.name}])})},p.readAsDataURL(o)}},[]),X=a.useCallback(e=>{M(n=>n.filter(o=>o.id!==e))},[]),Y=a.useCallback(e=>{const n=e.clipboardData?.files;if(n&&n.length>0){const o=Array.from(n).filter(p=>p.type.startsWith("image/"));o.length>0&&(e.preventDefault(),E(o))}},[E]),q=a.useCallback(e=>{e.preventDefault(),A(!1);const n=e.dataTransfer?.files;n&&n.length>0&&E(Array.from(n).filter(o=>o.type.startsWith("image/")))},[E]),H=a.useCallback(e=>{e.preventDefault(),A(!0)},[]),G=a.useCallback(()=>{A(!1)},[]),O=async()=>{if(!(!s.trim()&&N.length===0)){y(!0),x(null),L.current={content:s,mentions:[...C],images:[...N]};try{await i(s,C,[...N],f?.id),h(""),S([]),M([]),L.current=null,w?.()}catch(e){x(String(e instanceof Error?e.message:e)||r("commentInput.sendFailed"))}y(!1)}},Q=async()=>{if(!L.current)return;const{content:e,mentions:n,images:o}=L.current;y(!0),x(null);try{await i(e,n,o),h(""),S([]),M([]),L.current=null}catch(p){x(String(p instanceof Error?p.message:p)||r("commentInput.sendFailed"))}y(!1)},P=a.useCallback(e=>{h(n=>{const o=n.lastIndexOf("@"),p=oe(e.name);return o>=0?n.slice(0,o)+p+" ":n+p+" "}),C.includes(e.id)||S(n=>[...n,e.id]),m(!1),k(""),I(0),F.current?.focus()},[C]),V=e=>{h(e),x(null);const n=e.lastIndexOf("@");if(n>=0&&(n===0||e[n-1]===" ")){const p=e.slice(n+1).toLowerCase();if($.some(v=>v.name.toLowerCase().includes(p))){k(p),m(!0),I(0);return}}m(!1)},Z=e=>{if(c&&D.length>0){const n=e.key==="ArrowUp"||e.ctrlKey&&e.key==="p",o=e.key==="ArrowDown"||e.ctrlKey&&e.key==="n",p=e.key==="Enter"||e.key==="Tab",R=e.key==="Escape";if(n){e.preventDefault(),I(v=>(v-1+D.length)%D.length);return}if(o){e.preventDefault(),I(v=>(v+1)%D.length);return}if(p){e.preventDefault();const v=D[B];v&&P(v);return}if(R){e.preventDefault(),m(!1);return}}e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),O())},J=a.useCallback(()=>{setTimeout(()=>m(!1),200)},[]);return t.jsxs("div",{className:"relative",onDragOver:H,onDragLeave:G,onDrop:q,children:[z&&t.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-brand-500/10 rounded-lg border-2 border-dashed border-brand-500",children:t.jsx("span",{className:"text-sm text-brand-500 font-medium",children:r("commentInput.dragDropHint")})}),c&&t.jsx(ae,{candidates:$,filter:j,anchorRef:F,onSelect:P,selectedIndex:B,onIndexChange:I}),t.jsxs("div",{className:"border border-border-default rounded-lg bg-surface-elevated",children:[f&&t.jsxs("div",{className:"flex items-center gap-2 px-2.5 pt-2 pb-1 border-b border-border-default/50",children:[t.jsxs("div",{className:"flex-1 min-w-0 pl-2 border-l-2 border-brand-500/50",children:[t.jsx("span",{className:"text-[10px] font-medium text-brand-500",children:f.authorName}),t.jsx("p",{className:"text-[10px] text-fg-tertiary truncate",children:f.content})]}),t.jsx("button",{onClick:w,className:"text-fg-tertiary hover:text-fg-secondary shrink-0 p-0.5",children:t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),C.length>0&&t.jsx("div",{className:"flex gap-1 px-2.5 pt-2 flex-wrap",children:C.map(e=>{const n=$.find(o=>o.id===e);return t.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded-full ${n?.type==="human"?"bg-green-500/15 text-green-500":"bg-brand-500/15 text-brand-500"}`,children:["@",n?.name??e,t.jsx("button",{onClick:()=>S(o=>o.filter(p=>p!==e)),className:"hover:text-red-400",children:"×"})]},e)})}),t.jsx("textarea",{ref:F,value:s,onChange:e=>V(e.target.value),onKeyDown:Z,onBlur:J,onPaste:Y,placeholder:b??r("commentInput.placeholder"),rows:2,className:"w-full px-2.5 py-2 text-xs bg-transparent text-fg-primary placeholder-fg-tertiary outline-none resize-none"}),N.length>0&&t.jsx("div",{className:"flex items-center gap-1.5 px-2.5 pb-1.5 overflow-x-auto",children:N.map(e=>t.jsxs("div",{className:"relative group/img shrink-0",children:[t.jsx("img",{src:e.dataUrl,alt:e.name,className:"w-12 h-12 rounded-lg object-cover border border-border-default"}),t.jsx("button",{onClick:()=>X(e.id),className:"absolute -top-1.5 -right-1.5 w-4 h-4 bg-surface-secondary border border-gray-600 rounded-full flex items-center justify-center text-fg-secondary hover:text-red-500 hover:border-red-500 text-[10px] opacity-0 group-hover/img:opacity-100 transition-opacity",title:r("commentInput.removeImage"),children:"×"})]},e.id))}),d&&t.jsxs("div",{className:"flex items-center gap-2 px-2.5 pb-1.5",children:[t.jsx("span",{className:"text-[11px] text-red-400 flex-1 truncate",children:d}),t.jsxs("button",{onClick:Q,disabled:g,className:"text-[11px] text-amber-500 hover:text-amber-400 font-medium transition-colors flex items-center gap-1",children:[t.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"23 4 23 10 17 10"}),t.jsx("path",{d:"M20.49 15a9 9 0 11-2.12-9.36L23 10"})]}),r("commentInput.retry")]})]}),t.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2",children:[t.jsx("button",{type:"button",onClick:()=>U.current?.click(),disabled:g||N.length>=W,className:"p-1 text-fg-tertiary hover:text-brand-500 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:r("commentInput.attachImage"),children:t.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),t.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),t.jsx("polyline",{points:"21 15 16 10 5 21"})]})}),t.jsx("input",{ref:U,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&E(e.target.files),e.target.value=""}}),t.jsx("button",{onClick:O,disabled:!s.trim()&&N.length===0||g,className:"px-3 py-1 text-[11px] font-medium bg-brand-500 text-white rounded-md hover:bg-brand-600 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:r(g?"commentInput.sending":"commentInput.submit")})]})]}),s.trim()&&!g&&t.jsx("div",{className:"mt-0.5 -mb-0.5 flex justify-end px-2.5 pointer-events-none select-none",children:t.jsx("span",{className:"text-[10px] text-fg-tertiary/80",children:r("common:shiftEnterHint")})}),t.jsx("p",{className:"mt-1 text-center text-[10px] text-fg-tertiary/80 select-none",children:r("aiDisclaimer")})]})}export{de as C,ie as p,ce as r};
|
|
1
|
+
import{j as t,u as T,r as a,k as ee}from"./index-CIrsLoqm.js";const te=1920,ne=10*1024*1024,W=5,se=.8;function re(l,u,i){return new Promise((b,f)=>{const w=new Image;w.onload=()=>{let{width:r,height:s}=w;if(r<=u&&s<=u){b(l);return}r>s?(s=Math.round(s*(u/r)),r=u):(r=Math.round(r*(u/s)),s=u);const h=document.createElement("canvas");h.width=r,h.height=s;const g=h.getContext("2d");if(!g){f(new Error("Failed to get canvas context"));return}g.drawImage(w,0,0,r,s),b(h.toDataURL("image/jpeg",i))},w.onerror=()=>f(new Error("Failed to load image")),w.src=l})}function ae({candidates:l,filter:u,anchorRef:i,onSelect:b,selectedIndex:f,onIndexChange:w}){const{t:r}=T("common"),[s,h]=a.useState(null),g=a.useRef(null),y=l.filter(d=>d.name.toLowerCase().includes(u));return a.useEffect(()=>{const d=i.current;if(!d)return;const x=d.getBoundingClientRect();h({top:x.top+window.scrollY-4,left:x.left+window.scrollX+8})},[i,u]),a.useEffect(()=>{if(!g.current||!s)return;if(g.current.getBoundingClientRect().top<8){const x=i.current;if(!x)return;const c=x.getBoundingClientRect();h({top:c.bottom+window.scrollY+4,left:s.left})}},[s,i]),a.useEffect(()=>{f>=y.length&&w(Math.max(0,y.length-1))},[y.length,f,w]),a.useEffect(()=>{if(!g.current)return;g.current.querySelector('[data-selected="true"]')?.scrollIntoView({block:"nearest"})},[f]),!s||y.length===0?null:ee.createPortal(t.jsxs("div",{ref:g,style:{position:"absolute",top:s.top,left:s.left,transform:"translateY(-100%)"},className:"w-60 bg-surface-overlay border border-border-default rounded-lg shadow-xl z-[9999] max-h-48 overflow-y-auto",children:[t.jsx("div",{className:"px-2.5 py-1.5 text-[10px] text-fg-tertiary font-medium uppercase tracking-wider border-b border-border-default",children:r("commentInput.mentionHeading")}),y.map((d,x)=>t.jsxs("button",{"data-selected":x===f,onMouseDown:c=>{c.preventDefault(),b(d)},onMouseEnter:()=>w(x),className:`w-full text-left px-3 py-2 text-xs flex items-center gap-2 transition-colors ${x===f?"bg-brand-500/15 text-brand-500":"hover:bg-surface-elevated"}`,children:[t.jsx("span",{className:`w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-bold shrink-0 ${d.type==="human"?"bg-green-500/20 text-green-500":"bg-brand-500/20 text-brand-500"}`,children:d.name.slice(0,2).toUpperCase()}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("span",{className:"text-fg-primary font-medium",children:d.name}),t.jsx("span",{className:"text-fg-tertiary text-[10px] ml-1.5",children:d.subtitle??d.type})]}),d.type==="agent"&&t.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${d.online?"bg-green-400":"bg-gray-500"}`})]},d.id))]}),document.body)}function oe(l){return/^\w+$/.test(l)?`@${l}`:`@[${l}]`}const K=/@\[([^\]]+)\]|@([\w\p{L}\p{N}]+)/gu;function ie(l){const u=[];let i;for(K.lastIndex=0;(i=K.exec(l))!==null;)u.push(i[1]??i[2]);return u}function ce(l,u,i){const b=[];let f=0;const w=u.map(s=>s.name).sort((s,h)=>h.length-s.length);let r=0;for(;r<l.length;){const s=l.indexOf("@",r);if(s<0){b.push(t.jsx("span",{children:l.slice(r)},f++));break}if(s>r&&b.push(t.jsx("span",{children:l.slice(r,s)},f++)),l[s+1]==="["){const c=l.indexOf("]",s+2);if(c>s+2){const m=l.slice(s+2,c),j=u.find(k=>k.name.toLowerCase()===m.toLowerCase());b.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&j?"cursor-pointer hover:underline":""}`,onClick:i&&j?k=>i(j,k):void 0,title:j?`${j.name} (${j.role})`:void 0,children:["@",m]},f++)),r=c+1;continue}}const h=l.slice(s+1),g=h.toLowerCase(),y=w.find(c=>g.startsWith(c.toLowerCase()));if(y){const c=u.find(m=>m.name.toLowerCase()===y.toLowerCase());b.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&c?"cursor-pointer hover:underline":""}`,onClick:i&&c?m=>i(c,m):void 0,title:c?`${c.name} (${c.role})`:void 0,children:["@",y]},f++)),r=s+1+y.length;continue}const d=/^([\w\p{L}\p{N}]+)/u,x=h.match(d);if(x){const c=x[1],m=u.find(j=>j.name.toLowerCase()===c.toLowerCase());b.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&m?"cursor-pointer hover:underline":""}`,onClick:i&&m?j=>i(m,j):void 0,title:m?`${m.name} (${m.role})`:void 0,children:["@",c]},f++)),r=s+1+c.length;continue}b.push(t.jsx("span",{children:"@"},f++)),r=s+1}return b.length>0?b:[t.jsx("span",{children:l},0)]}function de({agents:l,humans:u,onSubmit:i,placeholder:b,replyTo:f,onCancelReply:w}){const{t:r}=T("common"),[s,h]=a.useState(""),[g,y]=a.useState(!1),[d,x]=a.useState(null),[c,m]=a.useState(!1),[j,k]=a.useState(""),[C,S]=a.useState([]),[B,I]=a.useState(0),[N,M]=a.useState([]),[z,A]=a.useState(!1),F=a.useRef(null),U=a.useRef(null),L=a.useRef(null),$=a.useMemo(()=>{const e=(u??[]).map(n=>({id:n.id,name:n.name,type:"human",subtitle:n.role}));for(const n of l)e.push({id:n.id,name:n.name,type:"agent",subtitle:n.role,online:n.status==="idle"||n.status==="working"});return e},[l,u]),D=$.filter(e=>e.name.toLowerCase().includes(j)),E=a.useCallback(e=>{const n=Array.from(e).filter(o=>o.type.startsWith("image/"));if(n.length!==0)for(const o of n){if(o.size>ne)continue;const p=new FileReader;p.onload=()=>{const R=p.result;re(R,te,se).then(v=>{M(_=>_.length>=W?_:[..._,{id:`img_${Date.now()}_${Math.random().toString(36).slice(2,6)}`,dataUrl:v,name:o.name}])})},p.readAsDataURL(o)}},[]),X=a.useCallback(e=>{M(n=>n.filter(o=>o.id!==e))},[]),Y=a.useCallback(e=>{const n=e.clipboardData?.files;if(n&&n.length>0){const o=Array.from(n).filter(p=>p.type.startsWith("image/"));o.length>0&&(e.preventDefault(),E(o))}},[E]),q=a.useCallback(e=>{e.preventDefault(),A(!1);const n=e.dataTransfer?.files;n&&n.length>0&&E(Array.from(n).filter(o=>o.type.startsWith("image/")))},[E]),H=a.useCallback(e=>{e.preventDefault(),A(!0)},[]),G=a.useCallback(()=>{A(!1)},[]),O=async()=>{if(!(!s.trim()&&N.length===0)){y(!0),x(null),L.current={content:s,mentions:[...C],images:[...N]};try{await i(s,C,[...N],f?.id),h(""),S([]),M([]),L.current=null,w?.()}catch(e){x(String(e instanceof Error?e.message:e)||r("commentInput.sendFailed"))}y(!1)}},Q=async()=>{if(!L.current)return;const{content:e,mentions:n,images:o}=L.current;y(!0),x(null);try{await i(e,n,o),h(""),S([]),M([]),L.current=null}catch(p){x(String(p instanceof Error?p.message:p)||r("commentInput.sendFailed"))}y(!1)},P=a.useCallback(e=>{h(n=>{const o=n.lastIndexOf("@"),p=oe(e.name);return o>=0?n.slice(0,o)+p+" ":n+p+" "}),C.includes(e.id)||S(n=>[...n,e.id]),m(!1),k(""),I(0),F.current?.focus()},[C]),V=e=>{h(e),x(null);const n=e.lastIndexOf("@");if(n>=0&&(n===0||e[n-1]===" ")){const p=e.slice(n+1).toLowerCase();if($.some(v=>v.name.toLowerCase().includes(p))){k(p),m(!0),I(0);return}}m(!1)},Z=e=>{if(c&&D.length>0){const n=e.key==="ArrowUp"||e.ctrlKey&&e.key==="p",o=e.key==="ArrowDown"||e.ctrlKey&&e.key==="n",p=e.key==="Enter"||e.key==="Tab",R=e.key==="Escape";if(n){e.preventDefault(),I(v=>(v-1+D.length)%D.length);return}if(o){e.preventDefault(),I(v=>(v+1)%D.length);return}if(p){e.preventDefault();const v=D[B];v&&P(v);return}if(R){e.preventDefault(),m(!1);return}}e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),O())},J=a.useCallback(()=>{setTimeout(()=>m(!1),200)},[]);return t.jsxs("div",{className:"relative",onDragOver:H,onDragLeave:G,onDrop:q,children:[z&&t.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-brand-500/10 rounded-lg border-2 border-dashed border-brand-500",children:t.jsx("span",{className:"text-sm text-brand-500 font-medium",children:r("commentInput.dragDropHint")})}),c&&t.jsx(ae,{candidates:$,filter:j,anchorRef:F,onSelect:P,selectedIndex:B,onIndexChange:I}),t.jsxs("div",{className:"border border-border-default rounded-lg bg-surface-elevated",children:[f&&t.jsxs("div",{className:"flex items-center gap-2 px-2.5 pt-2 pb-1 border-b border-border-default/50",children:[t.jsxs("div",{className:"flex-1 min-w-0 pl-2 border-l-2 border-brand-500/50",children:[t.jsx("span",{className:"text-[10px] font-medium text-brand-500",children:f.authorName}),t.jsx("p",{className:"text-[10px] text-fg-tertiary truncate",children:f.content})]}),t.jsx("button",{onClick:w,className:"text-fg-tertiary hover:text-fg-secondary shrink-0 p-0.5",children:t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),C.length>0&&t.jsx("div",{className:"flex gap-1 px-2.5 pt-2 flex-wrap",children:C.map(e=>{const n=$.find(o=>o.id===e);return t.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded-full ${n?.type==="human"?"bg-green-500/15 text-green-500":"bg-brand-500/15 text-brand-500"}`,children:["@",n?.name??e,t.jsx("button",{onClick:()=>S(o=>o.filter(p=>p!==e)),className:"hover:text-red-400",children:"×"})]},e)})}),t.jsx("textarea",{ref:F,value:s,onChange:e=>V(e.target.value),onKeyDown:Z,onBlur:J,onPaste:Y,placeholder:b??r("commentInput.placeholder"),rows:2,className:"w-full px-2.5 py-2 text-xs bg-transparent text-fg-primary placeholder-fg-tertiary outline-none resize-none"}),N.length>0&&t.jsx("div",{className:"flex items-center gap-1.5 px-2.5 pb-1.5 overflow-x-auto",children:N.map(e=>t.jsxs("div",{className:"relative group/img shrink-0",children:[t.jsx("img",{src:e.dataUrl,alt:e.name,className:"w-12 h-12 rounded-lg object-cover border border-border-default"}),t.jsx("button",{onClick:()=>X(e.id),className:"absolute -top-1.5 -right-1.5 w-4 h-4 bg-surface-secondary border border-gray-600 rounded-full flex items-center justify-center text-fg-secondary hover:text-red-500 hover:border-red-500 text-[10px] opacity-0 group-hover/img:opacity-100 transition-opacity",title:r("commentInput.removeImage"),children:"×"})]},e.id))}),d&&t.jsxs("div",{className:"flex items-center gap-2 px-2.5 pb-1.5",children:[t.jsx("span",{className:"text-[11px] text-red-400 flex-1 truncate",children:d}),t.jsxs("button",{onClick:Q,disabled:g,className:"text-[11px] text-amber-500 hover:text-amber-400 font-medium transition-colors flex items-center gap-1",children:[t.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"23 4 23 10 17 10"}),t.jsx("path",{d:"M20.49 15a9 9 0 11-2.12-9.36L23 10"})]}),r("commentInput.retry")]})]}),t.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2",children:[t.jsx("button",{type:"button",onClick:()=>U.current?.click(),disabled:g||N.length>=W,className:"p-1 text-fg-tertiary hover:text-brand-500 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:r("commentInput.attachImage"),children:t.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),t.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),t.jsx("polyline",{points:"21 15 16 10 5 21"})]})}),t.jsx("input",{ref:U,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&E(e.target.files),e.target.value=""}}),t.jsx("button",{onClick:O,disabled:!s.trim()&&N.length===0||g,className:"px-3 py-1 text-[11px] font-medium bg-brand-500 text-white rounded-md hover:bg-brand-600 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:r(g?"commentInput.sending":"commentInput.submit")})]})]}),s.trim()&&!g&&t.jsx("div",{className:"mt-0.5 -mb-0.5 flex justify-end px-2.5 pointer-events-none select-none",children:t.jsx("span",{className:"text-[10px] text-fg-tertiary/80",children:r("common:shiftEnterHint")})}),t.jsx("p",{className:"mt-1 text-center text-[10px] text-fg-tertiary/80 select-none",children:r("aiDisclaimer")})]})}export{de as C,ie as p,ce as r};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{j as a,r as i,_ as f}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CIrsLoqm.js","assets/index-BEhLix2_.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as a,r as i,_ as f}from"./index-CIrsLoqm.js";const b=i.lazy(()=>f(()=>import("./index-CIrsLoqm.js").then(e=>e.bn),__vite__mapDeps([0,1])).then(e=>({default:e.MarkdownMessage}))),x=new Set(["ts","tsx","js","jsx","mjs","cjs","py","go","rs","java","kt","kts","c","cc","cpp","cxx","h","hpp","hxx","cs","rb","php","swift","scala","sh","bash","zsh","fish","ps1","sql","yaml","yml","toml","xml","css","scss","less","vue","svelte","graphql","gql","proto","dockerfile","makefile","cmake","rsx","r","lua","pl","pm","ex","exs","erl","hs","clj","zig","nim","dart","gradle","tf","hcl"]);function v(e){const t=e.split(/[/\\]/).pop()?.toLowerCase()||"";if(t==="dockerfile"||t==="makefile")return"code";const r=t.includes(".")?t.split(".").pop():"";switch(r){case"md":case"markdown":return"markdown";case"html":case"htm":return"html";case"json":case"jsonc":return"json";case"csv":case"tsv":return"csv";default:return r&&x.has(r)?"code":r?"text":void 0}}function w(e){const t=e.trimStart();if(/^<!doctype\s+html/i.test(t)||/^<html[\s>]/i.test(t))return"html";if(t.startsWith("{")||t.startsWith("["))try{return JSON.parse(e),"json"}catch{}}function S(e){if(e.format)return e.format;if(e.reference){const t=v(e.reference);if(t)return t}if(e.content){const t=w(e.content);if(t)return t}return e.reference?"text":"markdown"}function y({content:e,className:t,onSelection:r}){const c=i.useRef(null),[l,p]=i.useState(null);i.useEffect(()=>{const o=d=>{d.data?.type==="__htmlpreview_height"&&typeof d.data.height=="number"&&p(d.data.height),d.data?.type==="__htmlpreview_selection"&&r&&r(d.data)};return window.addEventListener("message",o),()=>window.removeEventListener("message",o)},[r]);const h=`<script>
|
|
3
3
|
(function(){
|
|
4
4
|
function getXPath(el){
|
|
5
5
|
if(!el||el.nodeType!==1)return'';
|