hanoman 0.8.0 → 0.9.1
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/build-info.json +3 -3
- package/dist/cli.js +7 -1
- package/dist/server.js +75 -19
- package/package.json +1 -1
- package/web/assets/{ChangelogScreen-_gDN94cU.js → ChangelogScreen-CqdDSvcM.js} +1 -1
- package/web/assets/{DalangHanomanScreen-DYgYsjHL.js → DalangHanomanScreen-BVl47PiI.js} +1 -1
- package/web/assets/{DocPreviewModal-BmiV6G97.js → DocPreviewModal-DQ3XMay1.js} +1 -1
- package/web/assets/{DocsWorkspace-B235YOee.js → DocsWorkspace-DVOUvpB5.js} +1 -1
- package/web/assets/{IdeScreen-CKtV6kQg.js → IdeScreen-rug2LVDr.js} +1 -1
- package/web/assets/{LeadScreen-CCbmOwDK.js → LeadScreen-DssA9M8m.js} +1 -1
- package/web/assets/{ReviewScreen-Cjn2UblA.js → ReviewScreen-C1IA0OXe.js} +1 -1
- package/web/assets/{SchedulerScreen-CgWbTZRW.js → SchedulerScreen-C3dr6FMf.js} +1 -1
- package/web/assets/{SettingsScreen-CgKsiBYb.js → SettingsScreen-C39ctLm1.js} +1 -1
- package/web/assets/{TeamScreen-BQaDdG1N.js → TeamScreen-CnLpgpL4.js} +1 -1
- package/web/assets/{TerminalScreen-XuGax_Pi.js → TerminalScreen-lw3pei-W.js} +1 -1
- package/web/assets/{TriageScreen-Dwb-RSdX.js → TriageScreen-QT5nAssi.js} +1 -1
- package/web/assets/{VpsScreen-B98EElUN.js → VpsScreen-C4Aw0EJB.js} +1 -1
- package/web/assets/{index-B5A1QnO4.js → index-Cl9u81Cr.js} +197 -197
- package/web/assets/{live-DanRrGMa.js → live-DSfDhu0-.js} +1 -1
- package/web/index.html +1 -1
package/dist/build-info.json
CHANGED
package/dist/cli.js
CHANGED
|
@@ -6162,7 +6162,7 @@ var init_session_admission = __esm({
|
|
|
6162
6162
|
});
|
|
6163
6163
|
|
|
6164
6164
|
// ../shared/src/dto.ts
|
|
6165
|
-
var zIssueDeviceToken, zSessionResult, zSessionHistory, zCreateProject, zProjectId, zRenameProject, zUpdateProject, zCreateSpec, zPatchSpec, zChangeSpecSource, zMarkSpecDone, zIntegrate, zSessionSummary, zProjectView, zSchedulerQueueItem, zSchedulerSourceView, zSchedulerSessionView, zSchedulerQueueCounts, zSchedulerState, zLeadDecisionView, zLeadFlowView, zLeadAnswer, zLeadProjectStatus, zLeadStatusView, zFlow, zPrdBrief, zPrdDoc, zBreakdownItem, zBreakdownDoc, zBatchCreateSpec, zEscalationTarget, zEscalationPrefill, zAuditEscalation, zAuditEscalationView, zTerminalSession, zDocFileContent, zDocIndexCat, zDocIndex, HOST_RE, USER_RE, zCreateVps, zPatchVps, USER_ROLES, zUserRole, zLogin, zSignup, zSetup, zSetupApply, zChangePassword, zCreateClientAccount, zUpdateClientAccount, zVpsCheck, zMarkNa, zMarkNaBulk, zAttest, zRemediate, PROVISION_PROFILES, COMPONENT_IDS, zProvision, UPDATE_RESTART_EXIT, CONFIG_RESTART_EXIT, zUpdateApplyBody, MAX_SUBS, zSubPage, zSubLimit, zTopicParams, zEventsClientMsg, zTicketView, zTicketAttachmentView, zSpecAttachmentView, zTicketDetail, zTicketEditInput, zHelpInfo, zPublicTicketStatus, zCronExpr, zCreateCron, zPatchCron, zSchedulerCron, zSchedulerCronRun;
|
|
6165
|
+
var zIssueDeviceToken, zSessionResult, zSessionHistory, zCreateProject, zProjectId, zRenameProject, zUpdateProject, zCreateSpec, zPatchSpec, zChangeSpecSource, zMarkSpecDone, zIntegrate, zSessionSummary, zProjectView, zSchedulerQueueItem, zSchedulerSourceView, zSchedulerSessionView, zSchedulerQueueCounts, zSchedulerState, zLeadDecisionView, zLeadFlowView, zLeadAnswer, zLeadProjectStatus, zLeadStatusView, zFlow, zPrdBrief, zPrdDoc, zBreakdownItem, zBreakdownDoc, zBatchCreateSpec, zEscalationTarget, zEscalationPrefill, zAuditEscalation, zAuditEscalationView, zTerminalSession, zDocFileContent, zDocIndexCat, zDocIndex, HOST_RE, USER_RE, zCreateVps, zPatchVps, USER_ROLES, zUserRole, zLogin, zSignup, zSetup, zSetupApply, zChangePassword, zCreateClientAccount, zUpdateClientAccount, zVpsCheck, zMarkNa, zMarkNaBulk, zAttest, zRemediate, PROVISION_PROFILES, COMPONENT_IDS, zProvision, UPDATE_RESTART_EXIT, CONFIG_RESTART_EXIT, MANUAL_RESTART_EXIT, zUpdateApplyBody, MAX_SUBS, zSubPage, zSubLimit, zTopicParams, zEventsClientMsg, zTicketView, zTicketAttachmentView, zSpecAttachmentView, zTicketDetail, zTicketEditInput, zHelpInfo, zPublicTicketStatus, zCronExpr, zCreateCron, zPatchCron, zSchedulerCron, zSchedulerCronRun;
|
|
6166
6166
|
var init_dto = __esm({
|
|
6167
6167
|
"../shared/src/dto.ts"() {
|
|
6168
6168
|
"use strict";
|
|
@@ -6683,6 +6683,7 @@ var init_dto = __esm({
|
|
|
6683
6683
|
});
|
|
6684
6684
|
UPDATE_RESTART_EXIT = 75;
|
|
6685
6685
|
CONFIG_RESTART_EXIT = 76;
|
|
6686
|
+
MANUAL_RESTART_EXIT = 77;
|
|
6686
6687
|
zUpdateApplyBody = external_exports.object({ confirm: external_exports.boolean().optional() });
|
|
6687
6688
|
MAX_SUBS = 16;
|
|
6688
6689
|
zSubPage = external_exports.number().int().min(1).max(1e4);
|
|
@@ -12904,6 +12905,7 @@ function repairSpawnHelperEarly(ctx) {
|
|
|
12904
12905
|
repairSpawnHelper(createRequire(import.meta.url).resolve, ctx.stdout);
|
|
12905
12906
|
}
|
|
12906
12907
|
function planSupervisorStep(code, restartsUsed, configRestartsUsed = 0) {
|
|
12908
|
+
if (code === MANUAL_RESTART_EXIT) return { action: "restart" };
|
|
12907
12909
|
if (code === CONFIG_RESTART_EXIT)
|
|
12908
12910
|
return configRestartsUsed >= MAX_CONFIG_RESTARTS ? { action: "exit", code } : { action: "restart" };
|
|
12909
12911
|
if (code !== UPDATE_RESTART_EXIT) return { action: "exit", code };
|
|
@@ -13013,6 +13015,10 @@ ${hint}
|
|
|
13013
13015
|
}
|
|
13014
13016
|
return step.code;
|
|
13015
13017
|
}
|
|
13018
|
+
if (step.action === "restart" && code === MANUAL_RESTART_EXIT) {
|
|
13019
|
+
ctx.stdout("hanoman \xB7 restart manual dari dashboard; menjalankan ulang\n");
|
|
13020
|
+
continue;
|
|
13021
|
+
}
|
|
13016
13022
|
if (step.action === "restart") {
|
|
13017
13023
|
configRestartsUsed++;
|
|
13018
13024
|
ctx.stdout(`hanoman \xB7 konfigurasi berubah; menjalankan ulang (${configRestartsUsed}/${MAX_CONFIG_RESTARTS})
|
package/dist/server.js
CHANGED
|
@@ -6792,7 +6792,7 @@ function subKey(topic, params) {
|
|
|
6792
6792
|
for (const k of Object.keys(params).sort()) if (params[k] !== void 0) canon[k] = params[k];
|
|
6793
6793
|
return `${topic}|${JSON.stringify(canon)}`;
|
|
6794
6794
|
}
|
|
6795
|
-
var zIssueDeviceToken, zSessionResult, zSessionHistory, zCreateProject, zProjectId, zRenameProject, zUpdateProject, zCreateSpec, zPatchSpec, zChangeSpecSource, zMarkSpecDone, zIntegrate, zSessionSummary, zProjectView, zSchedulerQueueItem, zSchedulerSourceView, zSchedulerSessionView, zSchedulerQueueCounts, zSchedulerState, zLeadDecisionView, zLeadFlowView, zLeadAnswer, zLeadProjectStatus, zLeadStatusView, zFlow, isGoalShapedFlow, zPrdBrief, zPrdDoc, zBreakdownItem, zBreakdownDoc, zBatchCreateSpec, zEscalationTarget, zEscalationPrefill, zAuditEscalation, zAuditEscalationView, zTerminalSession, zDocFileContent, zDocIndexCat, zDocIndex, HOST_RE, USER_RE, zCreateVps, zPatchVps, USER_ROLES, zUserRole, zLogin, zSignup, zSetup, zSetupApply, zChangePassword, zCreateClientAccount, zUpdateClientAccount, zVpsCheck, zMarkNa, zMarkNaBulk, zAttest, zRemediate, PROVISION_PROFILES, COMPONENT_IDS, zProvision, UPDATE_RESTART_EXIT, CONFIG_RESTART_EXIT, zUpdateApplyBody, MAX_SUBS, zSubPage, zSubLimit, zTopicParams, zEventsClientMsg, zTicketView, zTicketAttachmentView, zSpecAttachmentView, zTicketDetail, zTicketEditInput, zHelpInfo, zPublicTicketStatus, zCronExpr, zCreateCron, zPatchCron, zSchedulerCron, zSchedulerCronRun;
|
|
6795
|
+
var zIssueDeviceToken, zSessionResult, zSessionHistory, zCreateProject, zProjectId, zRenameProject, zUpdateProject, zCreateSpec, zPatchSpec, zChangeSpecSource, zMarkSpecDone, zIntegrate, zSessionSummary, zProjectView, zSchedulerQueueItem, zSchedulerSourceView, zSchedulerSessionView, zSchedulerQueueCounts, zSchedulerState, zLeadDecisionView, zLeadFlowView, zLeadAnswer, zLeadProjectStatus, zLeadStatusView, zFlow, isGoalShapedFlow, zPrdBrief, zPrdDoc, zBreakdownItem, zBreakdownDoc, zBatchCreateSpec, zEscalationTarget, zEscalationPrefill, zAuditEscalation, zAuditEscalationView, zTerminalSession, zDocFileContent, zDocIndexCat, zDocIndex, HOST_RE, USER_RE, zCreateVps, zPatchVps, USER_ROLES, zUserRole, zLogin, zSignup, zSetup, zSetupApply, zChangePassword, zCreateClientAccount, zUpdateClientAccount, zVpsCheck, zMarkNa, zMarkNaBulk, zAttest, zRemediate, PROVISION_PROFILES, COMPONENT_IDS, zProvision, UPDATE_RESTART_EXIT, CONFIG_RESTART_EXIT, MANUAL_RESTART_EXIT, zUpdateApplyBody, MAX_SUBS, zSubPage, zSubLimit, zTopicParams, zEventsClientMsg, zTicketView, zTicketAttachmentView, zSpecAttachmentView, zTicketDetail, zTicketEditInput, zHelpInfo, zPublicTicketStatus, zCronExpr, zCreateCron, zPatchCron, zSchedulerCron, zSchedulerCronRun;
|
|
6796
6796
|
var init_dto = __esm({
|
|
6797
6797
|
"../shared/src/dto.ts"() {
|
|
6798
6798
|
"use strict";
|
|
@@ -7314,6 +7314,7 @@ var init_dto = __esm({
|
|
|
7314
7314
|
});
|
|
7315
7315
|
UPDATE_RESTART_EXIT = 75;
|
|
7316
7316
|
CONFIG_RESTART_EXIT = 76;
|
|
7317
|
+
MANUAL_RESTART_EXIT = 77;
|
|
7317
7318
|
zUpdateApplyBody = external_exports.object({ confirm: external_exports.boolean().optional() });
|
|
7318
7319
|
MAX_SUBS = 16;
|
|
7319
7320
|
zSubPage = external_exports.number().int().min(1).max(1e4);
|
|
@@ -13645,6 +13646,20 @@ var init_settings2 = __esm({
|
|
|
13645
13646
|
}];
|
|
13646
13647
|
hooks2.SubagentStart = [{ hooks: [{ type: "command", command: EVENT_HOOK_COMMAND }] }];
|
|
13647
13648
|
hooks2.SubagentStop = [{ hooks: [{ type: "command", command: EVENT_HOOK_COMMAND }] }];
|
|
13649
|
+
if (decisionFile) {
|
|
13650
|
+
const sub = `'${decisionFile.split("'").join("'\\''")}.sub'`;
|
|
13651
|
+
const f = `'${decisionFile.split("'").join("'\\''")}'`;
|
|
13652
|
+
hooks2.SubagentStart.push({ hooks: [{ type: "command", command: `echo 1 >> ${sub}; exit 0` }] });
|
|
13653
|
+
hooks2.SubagentStop.push({ hooks: [{
|
|
13654
|
+
type: "command",
|
|
13655
|
+
command: `[ -s ${sub} ] && { sed '$d' ${sub} > ${sub}.t; mv ${sub}.t ${sub}; }; exit 0`
|
|
13656
|
+
}] });
|
|
13657
|
+
hooks2.Notification = [{ hooks: [{
|
|
13658
|
+
type: "command",
|
|
13659
|
+
command: `m=$(cat); if [ -s ${sub} ]; then echo "$m" | grep -qiE 'permission|needs.?input'; else echo "$m" | grep -qiE 'idle|permission|waiting for|needs.?input'; fi && { [ -s ${f} ] || date +%s > ${f}; } || true`
|
|
13660
|
+
}] }];
|
|
13661
|
+
hooks2.UserPromptSubmit = [{ hooks: [{ type: "command", command: `: > ${f}; : > ${sub}` }] }];
|
|
13662
|
+
}
|
|
13648
13663
|
}
|
|
13649
13664
|
if (goal) hooks2.Stop = [{ hooks: [{ type: "prompt", prompt: goal }] }];
|
|
13650
13665
|
return {
|
|
@@ -16278,7 +16293,8 @@ __export(config_exports, {
|
|
|
16278
16293
|
rawDbValue: () => rawDbValue,
|
|
16279
16294
|
setConfig: () => setConfig,
|
|
16280
16295
|
setConfigsAtomic: () => setConfigsAtomic,
|
|
16281
|
-
sourceOf: () => sourceOf
|
|
16296
|
+
sourceOf: () => sourceOf,
|
|
16297
|
+
suppressedInheritKeys: () => suppressedInheritKeys
|
|
16282
16298
|
});
|
|
16283
16299
|
async function loadConfig() {
|
|
16284
16300
|
const rows = await prisma.runtimeConfig.findMany();
|
|
@@ -16300,6 +16316,9 @@ async function loadConfig() {
|
|
|
16300
16316
|
function rawDbValue(key) {
|
|
16301
16317
|
return cache.get(key);
|
|
16302
16318
|
}
|
|
16319
|
+
function suppressedInheritKeys() {
|
|
16320
|
+
return CONFIG_REGISTRY.filter((e) => e.inheritEnv && cache.get(e.key) === "").map((e) => e.key);
|
|
16321
|
+
}
|
|
16303
16322
|
function effectiveStr(key) {
|
|
16304
16323
|
return cache.get(key) ?? process.env[key] ?? configEntry(key)?.default;
|
|
16305
16324
|
}
|
|
@@ -17429,7 +17448,8 @@ function createSession(projectId, cwd, opts = {}) {
|
|
|
17429
17448
|
}
|
|
17430
17449
|
if (opts.attachmentsDir) envPairs.push(`HANOMAN_ATTACHMENTS_DIR=${sq(opts.attachmentsDir)}`);
|
|
17431
17450
|
for (const [k, v] of Object.entries(opts.env ?? {})) envPairs.push(`${k}=${sq(v)}`);
|
|
17432
|
-
|
|
17451
|
+
const unsets = opts.command ? [] : suppressedInheritKeys().flatMap((k) => ["-u", k]);
|
|
17452
|
+
let cmd = unsets.length ? ["env", ...unsets, ...envPairs, argv].join(" ") : envPairs.length ? `${envPairs.join(" ")} ${argv}` : argv;
|
|
17433
17453
|
if (!opts.command) {
|
|
17434
17454
|
const wrapped = sandboxCommand({
|
|
17435
17455
|
command: cmd,
|
|
@@ -27625,7 +27645,7 @@ function ensureSnapshot(key) {
|
|
|
27625
27645
|
function mirrorInheritEnv(key) {
|
|
27626
27646
|
ensureSnapshot(key);
|
|
27627
27647
|
const v = rawDbValue(key) ?? ORIGINAL_ENV.get(key);
|
|
27628
|
-
if (v === void 0) delete process.env[key];
|
|
27648
|
+
if (v === void 0 || v === "") delete process.env[key];
|
|
27629
27649
|
else process.env[key] = v;
|
|
27630
27650
|
}
|
|
27631
27651
|
async function applyConfigSideEffect(key) {
|
|
@@ -44776,7 +44796,8 @@ async function terminal_default(app3, opts) {
|
|
|
44776
44796
|
return;
|
|
44777
44797
|
}
|
|
44778
44798
|
void refreshPhaseInvocations(id2);
|
|
44779
|
-
})().catch(() => {
|
|
44799
|
+
})().catch((err) => {
|
|
44800
|
+
req.log.error({ err, sessionId: id2 }, "attach terminal gagal");
|
|
44780
44801
|
socket2.close(1011, "attach failed");
|
|
44781
44802
|
});
|
|
44782
44803
|
const watch = isClientRemote ? null : createPrincipalWatch({
|
|
@@ -46368,6 +46389,17 @@ async function methods(app3) {
|
|
|
46368
46389
|
init_src();
|
|
46369
46390
|
init_update();
|
|
46370
46391
|
init_pty();
|
|
46392
|
+
|
|
46393
|
+
// src/services/restart.ts
|
|
46394
|
+
init_src();
|
|
46395
|
+
function requestConfigRestart(delayMs = 50) {
|
|
46396
|
+
setTimeout(() => process.exit(CONFIG_RESTART_EXIT), delayMs);
|
|
46397
|
+
}
|
|
46398
|
+
function requestManualRestart(delayMs = 250) {
|
|
46399
|
+
setTimeout(() => process.exit(MANUAL_RESTART_EXIT), delayMs);
|
|
46400
|
+
}
|
|
46401
|
+
|
|
46402
|
+
// src/routes/update.ts
|
|
46371
46403
|
async function update(app3) {
|
|
46372
46404
|
app3.get("/update", async () => getUpdateStatus());
|
|
46373
46405
|
app3.post("/update/apply", async (req, reply) => {
|
|
@@ -46383,6 +46415,15 @@ async function update(app3) {
|
|
|
46383
46415
|
requestRestartForUpdate();
|
|
46384
46416
|
return reply.code(202).send({ accepted: true, from, to, liveSessions });
|
|
46385
46417
|
});
|
|
46418
|
+
app3.post("/restart", async (req, reply) => {
|
|
46419
|
+
const parsed = zUpdateApplyBody.safeParse(req.body ?? {});
|
|
46420
|
+
if (!parsed.success) return reply.code(400).send({ error: "bad-body" });
|
|
46421
|
+
if (!supervised()) return reply.code(409).send({ error: "unsupervised" });
|
|
46422
|
+
const liveSessions = listSessions().filter((s2) => !s2.exited).length;
|
|
46423
|
+
if (!parsed.data.confirm) return reply.code(409).send({ error: "confirm-required", liveSessions });
|
|
46424
|
+
requestManualRestart();
|
|
46425
|
+
return reply.code(202).send({ accepted: true, liveSessions });
|
|
46426
|
+
});
|
|
46386
46427
|
}
|
|
46387
46428
|
|
|
46388
46429
|
// src/services/events.ts
|
|
@@ -48268,7 +48309,8 @@ async function config_default(app3) {
|
|
|
48268
48309
|
if (!entry) return reply.code(400).send({ error: "key tak dikenal" });
|
|
48269
48310
|
if (entry.category === "bootstrap") return reply.code(400).send({ error: "bootstrap read-only" });
|
|
48270
48311
|
if (agentBlocked(req, entry)) return reply.code(403).send({ error: "cookie session required" });
|
|
48271
|
-
await
|
|
48312
|
+
if (entry.inheritEnv) await setConfig(key, "");
|
|
48313
|
+
else await clearConfig(key);
|
|
48272
48314
|
await applyConfigSideEffect(key);
|
|
48273
48315
|
return reply.code(204).send();
|
|
48274
48316
|
});
|
|
@@ -52011,12 +52053,6 @@ function applySetup(home3, input) {
|
|
|
52011
52053
|
return next;
|
|
52012
52054
|
}
|
|
52013
52055
|
|
|
52014
|
-
// src/services/restart.ts
|
|
52015
|
-
init_src();
|
|
52016
|
-
function requestConfigRestart(delayMs = 50) {
|
|
52017
|
-
setTimeout(() => process.exit(CONFIG_RESTART_EXIT), delayMs);
|
|
52018
|
-
}
|
|
52019
|
-
|
|
52020
52056
|
// src/routes/setup.ts
|
|
52021
52057
|
async function setup_default(app3, opts) {
|
|
52022
52058
|
const attempts = new BoundedRateLimiter({ windowMs: 6e4, limit: 10, maxKeys: 4096 });
|
|
@@ -52733,6 +52769,28 @@ function buildApp({ requireAuth = true, agentDocFile, env = process.env } = {})
|
|
|
52733
52769
|
return app3;
|
|
52734
52770
|
}
|
|
52735
52771
|
|
|
52772
|
+
// src/services/graceful-shutdown.ts
|
|
52773
|
+
var DEFAULT_TIMEOUT_MS = 5e3;
|
|
52774
|
+
function createShutdown(o) {
|
|
52775
|
+
const log = o.log ?? ((m) => console.log(m));
|
|
52776
|
+
let running;
|
|
52777
|
+
return (sig) => running ??= (async () => {
|
|
52778
|
+
log(`${sig} \u2014 menutup`);
|
|
52779
|
+
const timer10 = setTimeout(() => {
|
|
52780
|
+
log(`penutupan melewati ${o.timeoutMs ?? DEFAULT_TIMEOUT_MS} ms \u2014 keluar paksa`);
|
|
52781
|
+
o.exit(1);
|
|
52782
|
+
}, o.timeoutMs ?? DEFAULT_TIMEOUT_MS);
|
|
52783
|
+
timer10.unref?.();
|
|
52784
|
+
try {
|
|
52785
|
+
await o.close();
|
|
52786
|
+
} catch (e) {
|
|
52787
|
+
log(`penutupan gagal: ${e.message}`);
|
|
52788
|
+
}
|
|
52789
|
+
clearTimeout(timer10);
|
|
52790
|
+
o.exit(0);
|
|
52791
|
+
})();
|
|
52792
|
+
}
|
|
52793
|
+
|
|
52736
52794
|
// src/server.ts
|
|
52737
52795
|
init_db();
|
|
52738
52796
|
|
|
@@ -53803,15 +53861,13 @@ app2.addHook("onClose", async () => {
|
|
|
53803
53861
|
});
|
|
53804
53862
|
process.on("unhandledRejection", (err) => console.error("unhandledRejection:", err));
|
|
53805
53863
|
process.on("uncaughtException", (err) => console.error("uncaughtException:", err));
|
|
53806
|
-
|
|
53807
|
-
|
|
53808
|
-
try {
|
|
53864
|
+
var shutdown = createShutdown({
|
|
53865
|
+
close: async () => {
|
|
53809
53866
|
await app2.close();
|
|
53810
53867
|
await prisma.$disconnect();
|
|
53811
|
-
}
|
|
53812
|
-
|
|
53813
|
-
|
|
53814
|
-
}
|
|
53868
|
+
},
|
|
53869
|
+
exit: (code) => process.exit(code)
|
|
53870
|
+
});
|
|
53815
53871
|
process.on("SIGTERM", () => void shutdown("SIGTERM"));
|
|
53816
53872
|
process.on("SIGINT", () => void shutdown("SIGINT"));
|
|
53817
53873
|
var home2 = resolveHome();
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as C,j as a,ao as P,a as y,c as b,d as w,S as H,N as V,ay as q,h as F,u as K,f as M,w as N,aw as O,A as _,aL as U,y as Q,x as Y,p as Z,B as G,D as J}from"./index-
|
|
1
|
+
import{e as C,j as a,ao as P,a as y,c as b,d as w,S as H,N as V,ay as q,h as F,u as K,f as M,w as N,aw as O,A as _,aL as U,y as Q,x as Y,p as Z,B as G,D as J}from"./index-Cl9u81Cr.js";import{R as n}from"./react-DfGhg7ZW.js";import"./markdown-CWEY34jk.js";import"./xterm-3VOAfa_q.js";const X=[{mode:"backlog",label:"Rentang tanggal",hint:"backlog yang selesai di rentang itu"},{mode:"commit",label:"Rentang commit",hint:"perubahan repo antara dua revisi"},{mode:"version",label:"Versi rilis",hint:"perubahan yang masuk ke sebuah versi"}];function ee({p:t,onToast:o,onGenerated:g}){const[i,D]=n.useState("backlog"),[s,I]=n.useState(null),[h,f]=n.useState(""),[p,d]=n.useState(""),[x,B]=n.useState(""),[v,c]=n.useState(""),[j,u]=n.useState(""),[S,l]=n.useState(""),[m,R]=n.useState(!1);n.useEffect(()=>{let e=!0;return(async()=>{try{const r=await C.changelogSources(t.id);if(!e)return;I(r),f(r.defaultRange.from),d(r.defaultRange.to),r.tags[0]&&l(r.tags[0]),r.head&&c(r.head)}catch{}})(),()=>{e=!1}},[t.id]);const T=()=>i==="backlog"?{mode:i,from:h||void 0,to:p||void 0}:i==="commit"?{mode:i,fromSha:x,toSha:v}:{mode:i,fromTag:j||void 0,toTag:S},k=i==="backlog"?!0:i==="commit"?x.trim().length>=4&&v.trim().length>=4:S.trim().length>0;async function L(){R(!0);try{const e=await C.generateChangelog(t.id,T());o(e.generator==="agent"?"Changelog dibangkitkan":"Changelog dibangkitkan (draf ringkas)",e.generator==="agent"?"ok":"warn","file-text"),g==null||g(e)}catch(e){o(e.message||"Gagal membangkitkan changelog","err","x-circle")}finally{R(!1)}}const E=i==="version"&&s!==null&&s.tags.length===0,z=i==="commit"&&s!==null&&!!s.reason&&s.tags.length===0;return a.jsxs(P,{eyebrow:"changelog",title:"Ringkasan perubahan untuk pemakai",children:[a.jsx("div",{style:{fontSize:12.5,color:"var(--text-muted)",marginBottom:12,lineHeight:1.5},children:"Teks pendek berorientasi pemakai — apa yang berubah bagi mereka, bukan apa yang disentuh di dalam kode."}),a.jsx("div",{style:{display:"flex",gap:6,marginBottom:12,flexWrap:"wrap"},children:X.map(e=>a.jsx(y,{size:"sm",variant:i===e.mode?"primary":"ghost",onClick:()=>D(e.mode),title:e.hint,children:e.label},e.mode))}),a.jsxs("div",{style:{display:"flex",gap:10,alignItems:"flex-end",flexWrap:"wrap",marginBottom:12},children:[i==="backlog"&&a.jsxs(a.Fragment,{children:[a.jsx(b,{label:"Dari tanggal",children:a.jsx(w,{"aria-label":"Dari tanggal",type:"date",value:h,onChange:e=>f(e.target.value)})}),a.jsx(b,{label:"Sampai tanggal",children:a.jsx(w,{"aria-label":"Sampai tanggal",type:"date",value:p,onChange:e=>d(e.target.value)})})]}),i==="commit"&&a.jsxs(a.Fragment,{children:[a.jsx(b,{label:"Dari revisi",children:a.jsx(w,{"aria-label":"Dari revisi",mono:!0,placeholder:"mis. v1.0.0 atau 4f2a1c9",value:x,onChange:e=>B(e.target.value)})}),a.jsx(b,{label:"Sampai revisi",children:a.jsx(w,{"aria-label":"Sampai revisi",mono:!0,placeholder:"mis. HEAD atau 9d3b77e",value:v,onChange:e=>c(e.target.value)})})]}),i==="version"&&a.jsxs(a.Fragment,{children:[a.jsx(b,{label:"Sejak versi",children:a.jsx(H,{"aria-label":"Sejak versi",value:j,onChange:e=>u(e.target.value),options:[{value:"",label:"versi sebelumnya"},...((s==null?void 0:s.tags)??[]).map(e=>({value:e,label:e}))]})}),a.jsx(b,{label:"Versi",children:a.jsx(H,{"aria-label":"Versi",value:S,onChange:e=>l(e.target.value),options:((s==null?void 0:s.tags)??[]).map(e=>({value:e,label:e}))})})]}),a.jsx(y,{leftIcon:"sparkles",onClick:()=>void L(),disabled:m||!k||E||z,children:m?"Membangkitkan…":"Bangkitkan"})]}),(E||z)&&a.jsx(V,{tone:"warn",children:s==null?void 0:s.reason})]})}const $=12,W={backlog:"rentang tanggal",commit:"rentang commit",version:"versi rilis"},ae=t=>new Date(t).toLocaleDateString("id-ID",{day:"numeric",month:"short",year:"numeric"});function te({c:t,active:o,onOpen:g}){return a.jsxs("div",{role:"button",tabIndex:0,onClick:g,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),g())},style:{display:"flex",alignItems:"center",gap:10,padding:"9px 10px",cursor:"pointer",borderRadius:"var(--radius-sm)",borderBottom:"1px solid var(--border-hair)",background:o?"var(--brass-100)":"transparent"},children:[a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsx("div",{style:{fontSize:13.5,fontWeight:500,color:"var(--text-strong)"},children:t.title}),a.jsxs("div",{style:{fontSize:11.5,color:"var(--text-subtle)",marginTop:2},children:[W[t.mode]??t.mode," · ",ae(t.createdAt)," · ",t.itemCount," perubahan"]})]}),a.jsx(G,{tone:t.generator==="agent"?"ok":"warn",size:"sm",children:t.generator==="agent"?"naratif":"draf ringkas"})]})}function re({p:t,onToast:o,initialChangelogId:g}){const[i,D]=n.useState([]),[s,I]=n.useState(0),h=q("changelog",t.id),[f,p]=F(h,"page",1,Y),[d,x]=F(h,"q","",Z),[B,v]=n.useState(!0),[c,j]=F(h,"selectedId",null,Q),[u,S]=n.useState(null),l=n.useMemo(()=>i.find(e=>e.id===c)??((u==null?void 0:u.id)===c?u:null),[i,c,u]),m=n.useCallback(e=>{j(e?e.id:null),S(e)},[j]),[R,T]=n.useState(0);n.useEffect(()=>{let e=!0;const r=setTimeout(()=>{v(!0),C.listChangelogs(t.id,{q:d,page:f,limit:$}).then(A=>{e&&(D(A.items),I(A.total))}).catch(()=>{e&&(D([]),I(0))}).finally(()=>{e&&v(!1)})},d?220:0);return()=>{e=!1,clearTimeout(r)}},[t.id,d,f,R]),n.useEffect(()=>{if(!g)return;let e=!0;return C.getChangelog(t.id,g).then(r=>{e&&m(r)}).catch(()=>{e&&o("Rilis yang ditautkan tak ditemukan","warn","link-2-off")}),()=>{e=!1}},[t.id,g,o]);const k=J(s,f,$),{confirm:L,dialog:E}=K();async function z(e){try{if(!await L({title:`Hapus changelog "${e.title}"?`,message:"Rilis ini hilang dari riwayat project.",confirmLabel:"Hapus rilis",run:()=>C.deleteChangelog(t.id,e.id)}))return;c===e.id&&m(null),T(r=>r+1),o("Changelog dihapus","ok","trash-2")}catch{o("Gagal menghapus changelog","err","x-circle")}}return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[a.jsx(ee,{p:t,onToast:o,onGenerated:e=>{m(e),p(1),T(r=>r+1)}}),a.jsxs(P,{eyebrow:"rilis",title:"Riwayat changelog",actions:a.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:11.5,color:"var(--text-subtle)"},children:[s," rilis"]}),children:[a.jsx(w,{"aria-label":"Cari rilis",leftIcon:"search",placeholder:"cari judul atau isi rilis…",value:d,style:{width:"100%"},onChange:e=>{p(1),x(e.target.value)}}),a.jsxs("div",{"data-testid":"changelog-list",style:{maxHeight:340,overflowY:"auto",marginTop:10},children:[B&&i.length===0&&a.jsx(M,{kind:"loading",compact:!0}),!B&&i.length===0&&(d.trim()?a.jsx(M,{kind:"empty",icon:"search",compact:!0,title:"Tak ada rilis yang cocok",hint:`Tak ada rilis yang memuat “${d.trim()}”.`,action:()=>x(""),actionLabel:"Bersihkan pencarian",actionIcon:"x"}):a.jsx(M,{kind:"empty",icon:"megaphone",compact:!0,title:"Belum ada rilis",hint:"Bangkitkan changelog pertama project ini lewat kartu di atas."})),i.map(e=>a.jsx(te,{c:e,active:(l==null?void 0:l.id)===e.id,onOpen:()=>m(e)},e.id))]}),a.jsx(N,{page:k.page,pageCount:k.pageCount,total:s,from:k.from,to:k.to,onPage:p,unit:"rilis"})]}),l&&a.jsxs(P,{eyebrow:`rilis · ${W[l.mode]??l.mode}`,title:l.title,actions:a.jsxs("div",{className:"hn-row-actions",style:{display:"flex",gap:6},children:[a.jsx(y,{size:"sm",variant:"ghost",leftIcon:"copy",onClick:()=>{var e;(e=navigator.clipboard)==null||e.writeText(l.body),o("Changelog disalin","ok","copy")},children:"Salin"}),a.jsx(y,{as:"a",size:"sm",variant:"ghost",leftIcon:"download",download:!0,href:`${_.changelogItem(t.id,l.id)}?download=md`,"aria-label":"Unduh .md",children:"Unduh .md"}),a.jsx(y,{size:"sm",variant:"ghost",leftIcon:"link",onClick:()=>{var e;(e=navigator.clipboard)==null||e.writeText(U(t.id,l.id)),o("Link changelog disalin","ok","link")},children:"Salin link"}),a.jsx(y,{size:"sm",variant:"ghost",leftIcon:"trash-2","aria-label":`Hapus ${l.title}`,onClick:()=>void z(l)})]}),children:[l.warning&&a.jsx(V,{tone:"warn",children:l.warning}),a.jsx(O,{text:l.body,name:"changelog.md"})]}),E]})}export{re as ChangelogScreen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as ie,j as e,b as re,I as E}from"./index-B5A1QnO4.js";import{R as g}from"./react-DfGhg7ZW.js";import"./markdown-CWEY34jk.js";import"./xterm-3VOAfa_q.js";const de="/assets/hnm-hero-rig-body-v01-DmbKJJHB.webp",ce="/assets/hnm-hero-rig-arm-ul-v01-CIAWAxFe.webp",he="/assets/hnm-hero-rig-arm-ur-v01-C0R0CZnp.webp",oe="/assets/hnm-hero-rig-arm-ml-v01-Kts3pjTf.webp",ge="/assets/hnm-hero-rig-arm-mr-v01-DQgnE6bD.webp",me="/assets/hnm-wayang-satria-alus-v01-CpfoXKTy.webp",ue="/assets/hnm-wayang-satria-gagah-v01-bLfIYAsv.webp",pe="/assets/hnm-wayang-putri-v01-F6p69kHq.webp",xe="/assets/hnm-wayang-panakawan-v01-1LGv-V8N.webp",q=[me,ue,pe,xe],z=a=>q[[...a].reduce((t,o)=>t+o.charCodeAt(0),0)%q.length],V=["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],C=a=>String(a).padStart(2,"0");function je(){return g.useMemo(()=>typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function Ne(){const[a,t]=g.useState(()=>new Date);return g.useEffect(()=>{const o=setInterval(()=>t(new Date),1e3);return()=>clearInterval(o)},[]),a}function ye(a,t){const[o,m]=g.useState(""),p=a.join("|");return g.useEffect(()=>{if(t||a.length===0){m(a[0]??"");return}let x=0,h=0,r=null,d=null;const l=()=>{const y=a[x%a.length]??"";h=0,r=setInterval(()=>{h++,m(y.slice(0,h)),h>=y.length&&r&&(clearInterval(r),r=null,d=setTimeout(()=>{x++,l()},3200))},26)};return l(),()=>{r&&clearInterval(r),d&&clearTimeout(d)}},[p,t]),o}function S(a,t){const[o,m]=g.useState(t?a:0);return g.useEffect(()=>{if(t){m(a);return}const p=performance.now(),x=900;let h=0;const r=d=>{const l=Math.min(1,(d-p)/x);m(Math.round(a*(1-Math.pow(1-l,3)))),l<1&&(h=requestAnimationFrame(r))};return h=requestAnimationFrame(r),()=>cancelAnimationFrame(h)},[a,t]),o}function M({icon:a,tone:t,label:o,value:m,sub:p}){return e.jsxs("div",{className:"hn-dlg-kpi",children:[e.jsx("span",{className:`hn-dlg-kpi-ic hn-dlg-tone-${t}`,children:e.jsx(E,{name:a,size:17})}),e.jsxs("span",{style:{minWidth:0},children:[e.jsx("span",{className:"hn-dlg-kpi-l",children:o}),e.jsx("span",{className:"hn-dlg-kpi-v",children:m}),e.jsx("span",{className:"hn-dlg-kpi-s",children:p})]})]})}function ke({projects:a,backlog:t,sessions:o,onOpenSession:m,onOpenProject:p,onGoto:x,onExit:h}){const r=je(),d=Ne();g.useEffect(()=>{const n=s=>{s.key==="Escape"&&h()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[h]);const l=o.filter(n=>!n.exited).sort((n,s)=>n.id.localeCompare(s.id)),y=new Set(l.map(n=>n.projectId)),f=a.filter(n=>!y.has(n.id)),R=l.filter(n=>!!n.decision&&!n.deciding).length,F=t.filter(n=>ie(n.startedAt)).length,Q=S(a.length,r),X=S(F,r),Z=S(l.length,r),_=S(R,r),ee=ye([l.length>0?`HANOMAN ONLINE · ${l.length} SESI HIDUP`:"HANOMAN ONLINE · KELIR SUNYI",`${F} TASK DIKERJAKAN HARI INI`,R>0?`${R} SESI MENUNGGU JAWABANMU`:"SEMUA SISTEM NORMAL",`${a.length} PROYEK DALAM PANTAUAN`],r),j={done:0,executing:0,planned:0,spec:0};for(const n of t)n.stage==="done"?j.done++:n.stage==="executing"?j.executing++:n.stage==="planned"?j.planned++:j.spec++;const D=t.length,ne=[{key:"executing",cls:"wind",label:"Execute"},{key:"done",cls:"leaf",label:"Done"},{key:"planned",cls:"amber",label:"Plan"},{key:"spec",cls:"brass",label:"Spec"}];let L=0;const O=ne.map(n=>{const s=D?j[n.key]/D*100:0,u={...n,n:j[n.key],frac:s,offset:25-L};return L+=s,u}),v=[];for(let n=6;n>=0;n--){const s=new Date(d.getFullYear(),d.getMonth(),d.getDate()-n),u=t.filter(i=>{if(!i.startedAt)return!1;const c=new Date(i.startedAt);return c.getFullYear()===s.getFullYear()&&c.getMonth()===s.getMonth()&&c.getDate()===s.getDate()}).length;v.push({label:`${s.getDate()} ${V[s.getMonth()]}`,n:u})}const $=Math.max(1,...v.map(n=>n.n)),se=v.map((n,s)=>`${32+s*35},${78-n.n/$*60}`).join(" "),ae=`${l.map(n=>n.id).join("|")}#${f.map(n=>n.id).join("|")}`,H=g.useRef(null),[P,W]=g.useState([]);g.useLayoutEffect(()=>{const n=H.current;if(!n||l.length===0&&f.length===0){W([]);return}const s=()=>{var J;const i=n.getBoundingClientRect();if(i.width<60)return;const c=(J=n.querySelector(".hn-dlg-hero-art"))==null?void 0:J.getBoundingClientRect(),b=c?c.left+c.width/2-i.left:i.width/2,w={};n.querySelectorAll("[data-hand]").forEach(N=>{const A=N.getBoundingClientRect();w[N.dataset.hand??""]={x:A.left+A.width/2-i.left,y:A.top+A.height/2-i.top}});const k={x:b,y:c?c.top-i.top+c.height*.36:i.height*.35},G=[];n.querySelectorAll(".hn-dlg-prj").forEach(N=>{const U=(N.querySelector(".hn-dlg-puppet img")??N).getBoundingClientRect(),T=U.left+U.width/2-i.left,K=U.top-i.top+1,B=!N.hasAttribute("data-puppet"),te=T<b?"l":"r",I=w[(B?"m":"u")+te]??k,le=B?Math.max(I.y,K)+26:Math.min(I.y,K)-16;G.push({d:`M ${I.x.toFixed(1)} ${I.y.toFixed(1)} Q ${((I.x+T)/2).toFixed(1)} ${le.toFixed(1)}, ${T.toFixed(1)} ${K.toFixed(1)}`,slack:B})}),W(G)};if(s(),typeof ResizeObserver>"u")return;const u=new ResizeObserver(s);return u.observe(n),()=>u.disconnect()},[ae,l.length,f.length]);const Y=a.slice(0,6).map(n=>({id:n.id,name:n.name,text:n.activity,commit:n.commit,live:y.has(n.id)}));return e.jsxs("div",{className:"hn-dlg",children:[e.jsxs("div",{className:"hn-dlg-top hn-wrap-mobile",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,minWidth:0},children:[e.jsx("img",{className:"hn-dlg-blencong",src:re,alt:"","aria-hidden":"true","data-lit":l.length>0||void 0}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("h2",{className:"hn-dlg-title",children:"Dalang Hanoman"}),e.jsx("p",{className:"hn-dlg-boot","aria-live":"off",children:ee})]})]}),e.jsxs("div",{className:"hn-dlg-chips",children:[e.jsxs("span",{className:"hn-dlg-chip",children:[e.jsx(E,{name:"calendar",size:13}),d.getDate()," ",V[d.getMonth()]," ",d.getFullYear()]}),e.jsxs("span",{className:"hn-dlg-chip",children:[e.jsx(E,{name:"clock",size:13}),C(d.getHours()),":",C(d.getMinutes()),":",C(d.getSeconds())]}),e.jsx("button",{type:"button",className:"hn-dlg-exit",onClick:h,"aria-label":"Keluar dari panggung (Esc)",children:e.jsx(E,{name:"x",size:14})})]})]}),e.jsxs("div",{className:"hn-dlg-kpis",children:[e.jsx(M,{icon:"layout-grid",tone:"wind",label:"TOTAL PROYEK",value:Q,sub:"dalam pantauan"}),e.jsx(M,{icon:"check-circle-2",tone:"leaf",label:"TASK HARI INI",value:X,sub:"mulai dikerjakan"}),e.jsx(M,{icon:"activity",tone:"brass",label:"SESI BERJALAN",value:Z,sub:"wayang dimainkan"}),e.jsx(M,{icon:"hand",tone:"amber",label:"MENUNGGU KAMU",value:_,sub:"butuh keputusan"})]}),e.jsxs("div",{className:"hn-dlg-grid hn-grid-mobile",children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{className:"hn-dlg-hero",ref:H,children:[e.jsxs("svg",{className:"hn-dlg-hud",viewBox:"0 0 330 330","aria-hidden":"true",children:[e.jsx("g",{className:"hn-dlg-hud-a",children:e.jsx("circle",{cx:"165",cy:"165",r:"150",strokeDasharray:"3 14"})}),e.jsx("g",{className:"hn-dlg-hud-b",children:e.jsx("circle",{cx:"165",cy:"165",r:"126",strokeDasharray:"40 22"})})]}),P.length>0&&e.jsx("svg",{className:"hn-dlg-threads","aria-hidden":"true",focusable:"false",children:P.map((n,s)=>e.jsx("path",{d:n.d,className:n.slack?"hn-dlg-thread--slack":void 0,style:n.slack?void 0:{animationDelay:`${s%6*.3}s`}},s))}),e.jsx("div",{className:"hn-dlg-scan","aria-hidden":"true"}),e.jsxs("div",{className:"hn-dlg-hero-art","aria-hidden":"true",children:[e.jsx("img",{className:"hn-dlg-rig-arm hn-dlg-rig-arm--ul",src:ce,alt:""}),e.jsx("img",{className:"hn-dlg-rig-arm hn-dlg-rig-arm--ur",src:he,alt:""}),e.jsx("img",{className:"hn-dlg-rig-arm hn-dlg-rig-arm--ml",src:oe,alt:""}),e.jsx("img",{className:"hn-dlg-rig-arm hn-dlg-rig-arm--mr",src:ge,alt:""}),e.jsx("img",{className:"hn-dlg-rig-body",src:de,alt:""}),e.jsx("span",{className:"hn-dlg-hand","data-hand":"ul"}),e.jsx("span",{className:"hn-dlg-hand","data-hand":"ur"}),e.jsx("span",{className:"hn-dlg-hand","data-hand":"ml"}),e.jsx("span",{className:"hn-dlg-hand","data-hand":"mr"})]}),l.length>0||f.length>0?e.jsxs("div",{className:"hn-dlg-cards",role:"list","aria-label":"Wayang project",children:[l.map((n,s)=>{var w;const u=((w=a.find(k=>k.id===n.projectId))==null?void 0:w.name)??n.projectId,i=n.specId?t.find(k=>k.id===n.specId):void 0,c=!!n.decision&&!n.deciding,b=c?"menunggu jawabanmu":i?`${i.id} · ${i.stage}`:n.flow??"sesi terminal";return e.jsxs("button",{type:"button",className:"hn-dlg-prj","data-puppet":!0,"data-waiting":c||void 0,onClick:()=>m(n.id),"aria-label":`Buka terminal — ${u}, ${b}`,children:[e.jsx("span",{className:c?"hn-dlg-puppet hn-dlg-puppet--still":"hn-dlg-puppet",style:{animationDelay:`${s%6*.6}s`},children:e.jsx("img",{src:z(n.projectId),alt:"","aria-hidden":"true"})}),e.jsx("span",{className:"hn-dlg-prj-name",children:u}),e.jsx("span",{className:c?"hn-dlg-prj-sub hn-dlg-prj-sub--amber":"hn-dlg-prj-sub",children:b})]},n.id)}),f.map(n=>e.jsxs("button",{type:"button",className:"hn-dlg-prj hn-dlg-prj--off",onClick:()=>p(n),"aria-label":`Buka project ${n.name}`,children:[e.jsx("span",{className:"hn-dlg-puppet hn-dlg-puppet--still",children:e.jsx("img",{src:z(n.id),alt:"","aria-hidden":"true"})}),e.jsx("span",{className:"hn-dlg-prj-name",children:n.name}),e.jsx("span",{className:"hn-dlg-prj-sub hn-dlg-prj-sub--off",children:"tersandar di debog"})]},n.id))]}):e.jsxs("div",{className:"hn-dlg-empty",children:[e.jsx("div",{children:"Panggung sunyi — belum ada project di workspace."}),e.jsx("div",{children:"Tambahkan project dan sang dalang mengangkat wayangnya."})]})]}),e.jsxs("button",{type:"button",className:"hn-dlg-cmd",onClick:()=>x("terminal"),"aria-label":"Buka terminal — pusat kendali sesi",children:[e.jsx("span",{className:"hn-dlg-mic","aria-hidden":"true"}),e.jsxs("span",{className:"hn-dlg-cmd-t",children:[e.jsx("b",{children:"Perintah dalang"})," — buka Terminal untuk mengarahkan sesi yang berjalan…"]}),e.jsx("span",{className:"hn-dlg-cmd-k",children:"Terminal"})]})]}),e.jsxs("aside",{className:"hn-dlg-rail",children:[e.jsxs("div",{className:"hn-dlg-card",children:[e.jsx("div",{className:"hn-dlg-rt",children:"AKTIVITAS TERAKHIR"}),Y.length===0?e.jsx("div",{className:"hn-dlg-mut",children:"Belum ada project."}):Y.map(n=>e.jsxs("div",{className:"hn-dlg-act",children:[e.jsx("span",{className:n.live?"hn-dlg-dot hn-dlg-dot--on":"hn-dlg-dot"}),e.jsxs("span",{className:"hn-dlg-act-x",children:[e.jsx("b",{children:n.name})," ",n.text]})]},n.id))]}),e.jsxs("div",{className:"hn-dlg-card",children:[e.jsx("div",{className:"hn-dlg-rt",children:"DISTRIBUSI BACKLOG"}),e.jsxs("div",{className:"hn-dlg-donut-wrap",children:[e.jsxs("div",{className:"hn-dlg-donut",children:[e.jsxs("svg",{viewBox:"0 0 42 42",width:"112",height:"112","aria-hidden":"true",children:[e.jsx("circle",{className:"hn-dlg-ring",cx:"21",cy:"21",r:"15.9",strokeWidth:"5"}),O.map(n=>n.frac>0&&e.jsx("circle",{className:`hn-dlg-seg hn-dlg-seg--${n.cls}`,cx:"21",cy:"21",r:"15.9",strokeWidth:"5",strokeDasharray:`${n.frac} ${100-n.frac}`,strokeDashoffset:n.offset},n.key))]}),e.jsxs("div",{className:"hn-dlg-donut-c",children:[e.jsx("b",{children:D}),e.jsx("span",{children:"backlog"})]})]}),e.jsx("div",{className:"hn-dlg-leg",children:O.map(n=>e.jsxs("span",{children:[e.jsx("i",{className:`hn-dlg-seg--${n.cls}`}),n.label," ",e.jsx("b",{children:n.n})]},n.key))})]})]}),e.jsxs("div",{className:"hn-dlg-card",children:[e.jsx("div",{className:"hn-dlg-rt",children:"DIMULAI · 7 HARI"}),e.jsxs("svg",{viewBox:"0 0 260 100",className:"hn-dlg-chart","aria-hidden":"true",children:[e.jsx("line",{x1:"24",y1:"18",x2:"252",y2:"18"}),e.jsx("line",{x1:"24",y1:"48",x2:"252",y2:"48"}),e.jsx("line",{x1:"24",y1:"78",x2:"252",y2:"78"}),e.jsx("text",{x:"8",y:"21",children:$}),e.jsx("text",{x:"10",y:"81",children:"0"}),e.jsx("polyline",{className:"hn-dlg-trend",points:se}),v.map((n,s)=>e.jsx("circle",{cx:32+s*35,cy:78-n.n/$*60,r:"2.4"},s)),v.map((n,s)=>s%2===0?e.jsx("text",{x:22+s*35,y:"94",children:n.label},`l${s}`):null)]})]})]})]}),e.jsx("div",{className:"hn-dlg-foot",children:"◈ HANOMAN · ORKESTRASI CERDAS · EKSEKUSI SEMPURNA ◈"})]})}export{ke as DalangHanomanScreen};
|
|
1
|
+
import{i as ie,j as e,b as re,I as E}from"./index-Cl9u81Cr.js";import{R as g}from"./react-DfGhg7ZW.js";import"./markdown-CWEY34jk.js";import"./xterm-3VOAfa_q.js";const de="/assets/hnm-hero-rig-body-v01-DmbKJJHB.webp",ce="/assets/hnm-hero-rig-arm-ul-v01-CIAWAxFe.webp",he="/assets/hnm-hero-rig-arm-ur-v01-C0R0CZnp.webp",oe="/assets/hnm-hero-rig-arm-ml-v01-Kts3pjTf.webp",ge="/assets/hnm-hero-rig-arm-mr-v01-DQgnE6bD.webp",me="/assets/hnm-wayang-satria-alus-v01-CpfoXKTy.webp",ue="/assets/hnm-wayang-satria-gagah-v01-bLfIYAsv.webp",pe="/assets/hnm-wayang-putri-v01-F6p69kHq.webp",xe="/assets/hnm-wayang-panakawan-v01-1LGv-V8N.webp",q=[me,ue,pe,xe],z=a=>q[[...a].reduce((t,o)=>t+o.charCodeAt(0),0)%q.length],V=["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],C=a=>String(a).padStart(2,"0");function je(){return g.useMemo(()=>typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function Ne(){const[a,t]=g.useState(()=>new Date);return g.useEffect(()=>{const o=setInterval(()=>t(new Date),1e3);return()=>clearInterval(o)},[]),a}function ye(a,t){const[o,m]=g.useState(""),p=a.join("|");return g.useEffect(()=>{if(t||a.length===0){m(a[0]??"");return}let x=0,h=0,r=null,d=null;const l=()=>{const y=a[x%a.length]??"";h=0,r=setInterval(()=>{h++,m(y.slice(0,h)),h>=y.length&&r&&(clearInterval(r),r=null,d=setTimeout(()=>{x++,l()},3200))},26)};return l(),()=>{r&&clearInterval(r),d&&clearTimeout(d)}},[p,t]),o}function S(a,t){const[o,m]=g.useState(t?a:0);return g.useEffect(()=>{if(t){m(a);return}const p=performance.now(),x=900;let h=0;const r=d=>{const l=Math.min(1,(d-p)/x);m(Math.round(a*(1-Math.pow(1-l,3)))),l<1&&(h=requestAnimationFrame(r))};return h=requestAnimationFrame(r),()=>cancelAnimationFrame(h)},[a,t]),o}function M({icon:a,tone:t,label:o,value:m,sub:p}){return e.jsxs("div",{className:"hn-dlg-kpi",children:[e.jsx("span",{className:`hn-dlg-kpi-ic hn-dlg-tone-${t}`,children:e.jsx(E,{name:a,size:17})}),e.jsxs("span",{style:{minWidth:0},children:[e.jsx("span",{className:"hn-dlg-kpi-l",children:o}),e.jsx("span",{className:"hn-dlg-kpi-v",children:m}),e.jsx("span",{className:"hn-dlg-kpi-s",children:p})]})]})}function ke({projects:a,backlog:t,sessions:o,onOpenSession:m,onOpenProject:p,onGoto:x,onExit:h}){const r=je(),d=Ne();g.useEffect(()=>{const n=s=>{s.key==="Escape"&&h()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[h]);const l=o.filter(n=>!n.exited).sort((n,s)=>n.id.localeCompare(s.id)),y=new Set(l.map(n=>n.projectId)),f=a.filter(n=>!y.has(n.id)),R=l.filter(n=>!!n.decision&&!n.deciding).length,F=t.filter(n=>ie(n.startedAt)).length,Q=S(a.length,r),X=S(F,r),Z=S(l.length,r),_=S(R,r),ee=ye([l.length>0?`HANOMAN ONLINE · ${l.length} SESI HIDUP`:"HANOMAN ONLINE · KELIR SUNYI",`${F} TASK DIKERJAKAN HARI INI`,R>0?`${R} SESI MENUNGGU JAWABANMU`:"SEMUA SISTEM NORMAL",`${a.length} PROYEK DALAM PANTAUAN`],r),j={done:0,executing:0,planned:0,spec:0};for(const n of t)n.stage==="done"?j.done++:n.stage==="executing"?j.executing++:n.stage==="planned"?j.planned++:j.spec++;const D=t.length,ne=[{key:"executing",cls:"wind",label:"Execute"},{key:"done",cls:"leaf",label:"Done"},{key:"planned",cls:"amber",label:"Plan"},{key:"spec",cls:"brass",label:"Spec"}];let L=0;const O=ne.map(n=>{const s=D?j[n.key]/D*100:0,u={...n,n:j[n.key],frac:s,offset:25-L};return L+=s,u}),v=[];for(let n=6;n>=0;n--){const s=new Date(d.getFullYear(),d.getMonth(),d.getDate()-n),u=t.filter(i=>{if(!i.startedAt)return!1;const c=new Date(i.startedAt);return c.getFullYear()===s.getFullYear()&&c.getMonth()===s.getMonth()&&c.getDate()===s.getDate()}).length;v.push({label:`${s.getDate()} ${V[s.getMonth()]}`,n:u})}const $=Math.max(1,...v.map(n=>n.n)),se=v.map((n,s)=>`${32+s*35},${78-n.n/$*60}`).join(" "),ae=`${l.map(n=>n.id).join("|")}#${f.map(n=>n.id).join("|")}`,H=g.useRef(null),[P,W]=g.useState([]);g.useLayoutEffect(()=>{const n=H.current;if(!n||l.length===0&&f.length===0){W([]);return}const s=()=>{var J;const i=n.getBoundingClientRect();if(i.width<60)return;const c=(J=n.querySelector(".hn-dlg-hero-art"))==null?void 0:J.getBoundingClientRect(),b=c?c.left+c.width/2-i.left:i.width/2,w={};n.querySelectorAll("[data-hand]").forEach(N=>{const A=N.getBoundingClientRect();w[N.dataset.hand??""]={x:A.left+A.width/2-i.left,y:A.top+A.height/2-i.top}});const k={x:b,y:c?c.top-i.top+c.height*.36:i.height*.35},G=[];n.querySelectorAll(".hn-dlg-prj").forEach(N=>{const U=(N.querySelector(".hn-dlg-puppet img")??N).getBoundingClientRect(),T=U.left+U.width/2-i.left,K=U.top-i.top+1,B=!N.hasAttribute("data-puppet"),te=T<b?"l":"r",I=w[(B?"m":"u")+te]??k,le=B?Math.max(I.y,K)+26:Math.min(I.y,K)-16;G.push({d:`M ${I.x.toFixed(1)} ${I.y.toFixed(1)} Q ${((I.x+T)/2).toFixed(1)} ${le.toFixed(1)}, ${T.toFixed(1)} ${K.toFixed(1)}`,slack:B})}),W(G)};if(s(),typeof ResizeObserver>"u")return;const u=new ResizeObserver(s);return u.observe(n),()=>u.disconnect()},[ae,l.length,f.length]);const Y=a.slice(0,6).map(n=>({id:n.id,name:n.name,text:n.activity,commit:n.commit,live:y.has(n.id)}));return e.jsxs("div",{className:"hn-dlg",children:[e.jsxs("div",{className:"hn-dlg-top hn-wrap-mobile",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,minWidth:0},children:[e.jsx("img",{className:"hn-dlg-blencong",src:re,alt:"","aria-hidden":"true","data-lit":l.length>0||void 0}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("h2",{className:"hn-dlg-title",children:"Dalang Hanoman"}),e.jsx("p",{className:"hn-dlg-boot","aria-live":"off",children:ee})]})]}),e.jsxs("div",{className:"hn-dlg-chips",children:[e.jsxs("span",{className:"hn-dlg-chip",children:[e.jsx(E,{name:"calendar",size:13}),d.getDate()," ",V[d.getMonth()]," ",d.getFullYear()]}),e.jsxs("span",{className:"hn-dlg-chip",children:[e.jsx(E,{name:"clock",size:13}),C(d.getHours()),":",C(d.getMinutes()),":",C(d.getSeconds())]}),e.jsx("button",{type:"button",className:"hn-dlg-exit",onClick:h,"aria-label":"Keluar dari panggung (Esc)",children:e.jsx(E,{name:"x",size:14})})]})]}),e.jsxs("div",{className:"hn-dlg-kpis",children:[e.jsx(M,{icon:"layout-grid",tone:"wind",label:"TOTAL PROYEK",value:Q,sub:"dalam pantauan"}),e.jsx(M,{icon:"check-circle-2",tone:"leaf",label:"TASK HARI INI",value:X,sub:"mulai dikerjakan"}),e.jsx(M,{icon:"activity",tone:"brass",label:"SESI BERJALAN",value:Z,sub:"wayang dimainkan"}),e.jsx(M,{icon:"hand",tone:"amber",label:"MENUNGGU KAMU",value:_,sub:"butuh keputusan"})]}),e.jsxs("div",{className:"hn-dlg-grid hn-grid-mobile",children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{className:"hn-dlg-hero",ref:H,children:[e.jsxs("svg",{className:"hn-dlg-hud",viewBox:"0 0 330 330","aria-hidden":"true",children:[e.jsx("g",{className:"hn-dlg-hud-a",children:e.jsx("circle",{cx:"165",cy:"165",r:"150",strokeDasharray:"3 14"})}),e.jsx("g",{className:"hn-dlg-hud-b",children:e.jsx("circle",{cx:"165",cy:"165",r:"126",strokeDasharray:"40 22"})})]}),P.length>0&&e.jsx("svg",{className:"hn-dlg-threads","aria-hidden":"true",focusable:"false",children:P.map((n,s)=>e.jsx("path",{d:n.d,className:n.slack?"hn-dlg-thread--slack":void 0,style:n.slack?void 0:{animationDelay:`${s%6*.3}s`}},s))}),e.jsx("div",{className:"hn-dlg-scan","aria-hidden":"true"}),e.jsxs("div",{className:"hn-dlg-hero-art","aria-hidden":"true",children:[e.jsx("img",{className:"hn-dlg-rig-arm hn-dlg-rig-arm--ul",src:ce,alt:""}),e.jsx("img",{className:"hn-dlg-rig-arm hn-dlg-rig-arm--ur",src:he,alt:""}),e.jsx("img",{className:"hn-dlg-rig-arm hn-dlg-rig-arm--ml",src:oe,alt:""}),e.jsx("img",{className:"hn-dlg-rig-arm hn-dlg-rig-arm--mr",src:ge,alt:""}),e.jsx("img",{className:"hn-dlg-rig-body",src:de,alt:""}),e.jsx("span",{className:"hn-dlg-hand","data-hand":"ul"}),e.jsx("span",{className:"hn-dlg-hand","data-hand":"ur"}),e.jsx("span",{className:"hn-dlg-hand","data-hand":"ml"}),e.jsx("span",{className:"hn-dlg-hand","data-hand":"mr"})]}),l.length>0||f.length>0?e.jsxs("div",{className:"hn-dlg-cards",role:"list","aria-label":"Wayang project",children:[l.map((n,s)=>{var w;const u=((w=a.find(k=>k.id===n.projectId))==null?void 0:w.name)??n.projectId,i=n.specId?t.find(k=>k.id===n.specId):void 0,c=!!n.decision&&!n.deciding,b=c?"menunggu jawabanmu":i?`${i.id} · ${i.stage}`:n.flow??"sesi terminal";return e.jsxs("button",{type:"button",className:"hn-dlg-prj","data-puppet":!0,"data-waiting":c||void 0,onClick:()=>m(n.id),"aria-label":`Buka terminal — ${u}, ${b}`,children:[e.jsx("span",{className:c?"hn-dlg-puppet hn-dlg-puppet--still":"hn-dlg-puppet",style:{animationDelay:`${s%6*.6}s`},children:e.jsx("img",{src:z(n.projectId),alt:"","aria-hidden":"true"})}),e.jsx("span",{className:"hn-dlg-prj-name",children:u}),e.jsx("span",{className:c?"hn-dlg-prj-sub hn-dlg-prj-sub--amber":"hn-dlg-prj-sub",children:b})]},n.id)}),f.map(n=>e.jsxs("button",{type:"button",className:"hn-dlg-prj hn-dlg-prj--off",onClick:()=>p(n),"aria-label":`Buka project ${n.name}`,children:[e.jsx("span",{className:"hn-dlg-puppet hn-dlg-puppet--still",children:e.jsx("img",{src:z(n.id),alt:"","aria-hidden":"true"})}),e.jsx("span",{className:"hn-dlg-prj-name",children:n.name}),e.jsx("span",{className:"hn-dlg-prj-sub hn-dlg-prj-sub--off",children:"tersandar di debog"})]},n.id))]}):e.jsxs("div",{className:"hn-dlg-empty",children:[e.jsx("div",{children:"Panggung sunyi — belum ada project di workspace."}),e.jsx("div",{children:"Tambahkan project dan sang dalang mengangkat wayangnya."})]})]}),e.jsxs("button",{type:"button",className:"hn-dlg-cmd",onClick:()=>x("terminal"),"aria-label":"Buka terminal — pusat kendali sesi",children:[e.jsx("span",{className:"hn-dlg-mic","aria-hidden":"true"}),e.jsxs("span",{className:"hn-dlg-cmd-t",children:[e.jsx("b",{children:"Perintah dalang"})," — buka Terminal untuk mengarahkan sesi yang berjalan…"]}),e.jsx("span",{className:"hn-dlg-cmd-k",children:"Terminal"})]})]}),e.jsxs("aside",{className:"hn-dlg-rail",children:[e.jsxs("div",{className:"hn-dlg-card",children:[e.jsx("div",{className:"hn-dlg-rt",children:"AKTIVITAS TERAKHIR"}),Y.length===0?e.jsx("div",{className:"hn-dlg-mut",children:"Belum ada project."}):Y.map(n=>e.jsxs("div",{className:"hn-dlg-act",children:[e.jsx("span",{className:n.live?"hn-dlg-dot hn-dlg-dot--on":"hn-dlg-dot"}),e.jsxs("span",{className:"hn-dlg-act-x",children:[e.jsx("b",{children:n.name})," ",n.text]})]},n.id))]}),e.jsxs("div",{className:"hn-dlg-card",children:[e.jsx("div",{className:"hn-dlg-rt",children:"DISTRIBUSI BACKLOG"}),e.jsxs("div",{className:"hn-dlg-donut-wrap",children:[e.jsxs("div",{className:"hn-dlg-donut",children:[e.jsxs("svg",{viewBox:"0 0 42 42",width:"112",height:"112","aria-hidden":"true",children:[e.jsx("circle",{className:"hn-dlg-ring",cx:"21",cy:"21",r:"15.9",strokeWidth:"5"}),O.map(n=>n.frac>0&&e.jsx("circle",{className:`hn-dlg-seg hn-dlg-seg--${n.cls}`,cx:"21",cy:"21",r:"15.9",strokeWidth:"5",strokeDasharray:`${n.frac} ${100-n.frac}`,strokeDashoffset:n.offset},n.key))]}),e.jsxs("div",{className:"hn-dlg-donut-c",children:[e.jsx("b",{children:D}),e.jsx("span",{children:"backlog"})]})]}),e.jsx("div",{className:"hn-dlg-leg",children:O.map(n=>e.jsxs("span",{children:[e.jsx("i",{className:`hn-dlg-seg--${n.cls}`}),n.label," ",e.jsx("b",{children:n.n})]},n.key))})]})]}),e.jsxs("div",{className:"hn-dlg-card",children:[e.jsx("div",{className:"hn-dlg-rt",children:"DIMULAI · 7 HARI"}),e.jsxs("svg",{viewBox:"0 0 260 100",className:"hn-dlg-chart","aria-hidden":"true",children:[e.jsx("line",{x1:"24",y1:"18",x2:"252",y2:"18"}),e.jsx("line",{x1:"24",y1:"48",x2:"252",y2:"48"}),e.jsx("line",{x1:"24",y1:"78",x2:"252",y2:"78"}),e.jsx("text",{x:"8",y:"21",children:$}),e.jsx("text",{x:"10",y:"81",children:"0"}),e.jsx("polyline",{className:"hn-dlg-trend",points:se}),v.map((n,s)=>e.jsx("circle",{cx:32+s*35,cy:78-n.n/$*60,r:"2.4"},s)),v.map((n,s)=>s%2===0?e.jsx("text",{x:22+s*35,y:"94",children:n.label},`l${s}`):null)]})]})]})]}),e.jsx("div",{className:"hn-dlg-foot",children:"◈ HANOMAN · ORKESTRASI CERDAS · EKSEKUSI SEMPURNA ◈"})]})}export{ke as DalangHanomanScreen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,M as r,au as d,aw as a,f as x}from"./index-
|
|
1
|
+
import{j as e,M as r,au as d,aw as a,f as x}from"./index-Cl9u81Cr.js";import"./react-DfGhg7ZW.js";function m({path:i,text:o,eyebrow:n,download:t,onClose:s}){const l=i.slice(i.lastIndexOf("/")+1)||i;return e.jsx(r,{open:!0,title:l,eyebrow:n??i,icon:"book-open",onClose:s,width:980,fillHeight:!0,children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[t&&e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",paddingBottom:6,borderBottom:"1px solid var(--border-hair)",marginBottom:8},children:e.jsx(d,{href:t})}),e.jsx("div",{"data-testid":"doc-preview-scroll",style:{flex:"1 1 0",minHeight:0,overflow:"auto",padding:"0 4px 8px"},children:o?e.jsx(a,{text:o,name:i}):e.jsx(x,{kind:"empty",icon:"file-text",title:"Berkas kosong",hint:i})})]})})}export{m as D};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{h as re,u as oe,e as y,j as e,v as le,ao as T,ak as de,a as j,f as b,aK as ce,I as k,B as $,au as xe,aw as A,p as pe,ay as ue}from"./index-
|
|
1
|
+
import{h as re,u as oe,e as y,j as e,v as le,ao as T,ak as de,a as j,f as b,aK as ce,I as k,B as $,au as xe,aw as A,p as pe,ay as ue}from"./index-Cl9u81Cr.js";import{R as l}from"./react-DfGhg7ZW.js";import"./markdown-CWEY34jk.js";import"./xterm-3VOAfa_q.js";function O(s){let a={...s,kids:s.kids.map(O)};for(;!a.cat&&a.kids.length===1;){const i=a.kids[0];a={...i,label:a.label+"/"+i.label}}return a}function G(s){const a={path:"",kids:[]};for(const i of s){if(i.cat==="."){a.kids.push({path:".",label:".",cat:i,kids:[]});continue}let r=a;for(const x of i.cat.split("/")){const g=r.path?r.path+"/"+x:x;let d=r.kids.find(t=>t.path===g);d||(d={path:g,label:x,kids:[]},r.kids.push(d)),r=d}r.cat=i}return a.kids.map(O)}function K(s){const a=s.find(i=>i.scored&&i.linked)??s.find(i=>i.scored)??s[0];return a&&a.files[0]?`${a.cat}/${a.files[0]}`:""}function I({node:s,selected:a,onSelect:i,depth:r=0}){var h,u,p;const[x,g]=l.useState(!1),d=((h=s.cat)==null?void 0:h.scored)??!0,t=((u=s.cat)==null?void 0:u.linked)??!0;return e.jsxs("div",{style:r===0?{borderBottom:"1px solid var(--border-hair)"}:void 0,children:[e.jsxs("button",{onClick:()=>g(c=>!c),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"9px 6px",paddingLeft:6+r*12,border:"none",background:"transparent",cursor:"pointer",textAlign:"left"},children:[e.jsx(k,{name:x?"chevron-down":"chevron-right",size:14,color:"var(--text-subtle)"}),e.jsx(k,{name:"folder",size:15,color:d?t?"var(--brass-500)":"var(--clay-500)":"var(--text-subtle)"}),e.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:12.5,color:"var(--text-strong)",fontWeight:500},children:[s.label,"/"]}),e.jsx("span",{style:{flex:1}}),s.cat&&d&&(s.cat.linked?e.jsx(k,{name:"link",size:13,color:"var(--leaf-600)"}):e.jsx(k,{name:"unlink",size:13,color:"var(--clay-500)"}))]}),x&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1,paddingBottom:4},children:[s.kids.map(c=>e.jsx(I,{node:c,selected:a,onSelect:i,depth:r+1},c.path)),(p=s.cat)==null?void 0:p.files.map(c=>{const f=s.path+"/"+c,v=f===a;return e.jsxs("button",{onClick:()=>i(f),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 8px",paddingLeft:18+r*12,borderRadius:"var(--radius-sm)",border:"none",cursor:"pointer",textAlign:"left",background:v?"var(--brass-100)":"transparent"},children:[e.jsx(k,{name:"file-text",size:13,color:v?"var(--brass-700)":"var(--text-subtle)"}),e.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:v?"var(--brass-700)":!d||t?"var(--text-body)":"var(--text-muted)",fontWeight:v?600:400},children:c})]},c)})]})]})}function ve({projectId:s,projectName:a,docStatus:i}){const[r,x]=l.useState([]),[g,d]=l.useState(0),[t,h]=re(ue("docs",s),"selected","",pe),[u,p]=l.useState({}),[c,f]=l.useState("preview"),[v,F]=l.useState("tree"),[w,M]=l.useState(""),[S,P]=l.useState(!1),{confirm:J,dialog:U}=oe(),[H,z]=l.useState("loading"),[V,q]=l.useState(0);l.useEffect(()=>{let n=!0;return z("loading"),y.getDocs(s).then(o=>{if(!n)return;const m=o.tree;x(m),d(o.coverage),p({}),f("preview"),z("ready"),h(K(m))}).catch(()=>{n&&(x([]),h(""),z("error"))}),()=>{n=!1}},[s,V]),l.useEffect(()=>{if(!t||t in u)return;let n=!0;return y.getDoc(s,t).then(o=>{n&&p(m=>({...m,[t]:o.content}))}).catch(()=>{n&&p(o=>({...o,[t]:null}))}),()=>{n=!1}},[t,s,u]);const D=!!t&&!(t in u),C=t?u[t]===null:!1,Q=()=>p(n=>{const o={...n};return delete o[t],o}),X=l.useMemo(()=>G(r.filter(n=>n.scored)),[r]),L=l.useMemo(()=>G(r.filter(n=>!n.scored)),[r]),N=u[t]??"",Y=t.includes("/")?t.slice(0,t.lastIndexOf("/")):".",B=r.find(n=>n.cat===Y),Z=t,_=i==="broken"?"err":i==="drift"?"warn":"ok",ee=i==="broken"?"broken":i==="drift"?"drift":"ok";function te(){M(N),f("edit")}function ne(){f("preview")}async function se(){await y.putDoc(s,t,w),p(n=>({...n,[t]:w})),f("preview")}function E(n){h(n),f("preview"),F("viewer")}async function R(){const n=await y.getDocs(s),o=n.tree;x(o),d(n.coverage),o.some(m=>m.files.some(ie=>`${m.cat}/${ie}`===t))||h(K(o))}async function W(){if(!S){P(!0);try{await R()}finally{P(!1)}}}async function ae(){t&&await J({title:`Hapus ${t}?`,message:"Berkas aslinya di disk ikut dihapus — dokumen ini adalah Source of Truth project.",confirmLabel:"Hapus dokumen",run:()=>y.deleteDoc(s,t)})&&(p(n=>{const o={...n};return delete o[t],o}),await R())}return e.jsxs(e.Fragment,{children:[e.jsx(le,{ariaLabel:"Panel Docs",active:v,onActiveChange:n=>F(n),masterWidth:288,className:"hn-workspace-panels",panels:[{id:"tree",label:"Files",className:"hn-panel-flex",content:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,minHeight:0,overflow:"auto"},children:[e.jsxs(T,{padding:0,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"12px 14px",borderBottom:"1px solid var(--border-hair)"},children:[e.jsxs("span",{className:"hn-eyebrow",children:["docs · ",a]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(de,{status:ee,size:"sm"}),e.jsx(j,{size:"sm",variant:"ghost",leftIcon:S?"loader":"radar",onClick:W,disabled:S,children:S?"…":"Muat ulang"})]})]}),e.jsx("div",{style:{padding:"4px 8px"},children:H==="loading"?e.jsx(b,{kind:"loading",compact:!0,title:"Memuat index…"}):H==="error"?e.jsx(b,{kind:"error",compact:!0,title:"Gagal memuat index docs",hint:a,action:()=>q(n=>n+1)}):r.length===0?e.jsx(b,{kind:"empty",compact:!0,icon:"folder-open",title:"Belum ada docs",hint:"Belum ada Markdown di repo ini.",action:W,actionLabel:"Muat ulang",actionIcon:"radar"}):e.jsxs(e.Fragment,{children:[X.map(n=>e.jsx(I,{node:n,selected:t,onSelect:E},n.path)),L.length>0&&e.jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:"1px solid var(--border-hair)"},children:[e.jsx("div",{className:"hn-eyebrow",style:{padding:"4px 6px",color:"var(--text-subtle)"},children:"Lainnya (tidak dinilai)"}),L.map(n=>e.jsx(I,{node:n,selected:t,onSelect:E},n.path))]})]})})]}),e.jsxs(T,{padding:16,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("span",{className:"hn-eyebrow",children:"SoT coverage"}),e.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-muted)"},children:a})]}),e.jsx(ce,{value:g,showLabel:!0,label:"Kategori ter-index",tone:_})]})]})},{id:"viewer",label:"Dokumen",className:"hn-panel-flex",content:e.jsxs(T,{padding:0,fill:!0,children:[e.jsxs("div",{style:{flex:"0 0 auto",display:"flex",alignItems:"center",gap:12,padding:"12px 16px",borderBottom:"1px solid var(--border-hair)",flexWrap:"wrap"},children:[e.jsx(k,{name:"file-text",size:15,color:"var(--text-muted)"}),e.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:13,color:"var(--text-strong)",fontWeight:500},children:Z}),B&&B.scored&&(B.linked?e.jsx($,{tone:"ok",size:"sm",icon:"link",children:"indexed"}):e.jsx($,{tone:"err",size:"sm",icon:"unlink",children:"unlinked"})),e.jsx("span",{style:{flex:1}}),c==="preview"?e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsx(xe,{href:n=>y.docDownloadUrl(s,t,n),disabled:!t||D||C}),e.jsx(j,{size:"sm",variant:"ghost",leftIcon:"trash-2",onClick:ae,disabled:!t,children:"Hapus"}),e.jsx(j,{size:"sm",variant:"secondary",leftIcon:"pencil",onClick:te,disabled:!t||D||C,children:"Edit"})]}):e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(j,{size:"sm",variant:"ghost",onClick:ne,children:"Batal"}),e.jsx(j,{size:"sm",leftIcon:"check",onClick:se,children:"Simpan"})]})]}),c==="preview"?e.jsx("div",{"data-testid":"doc-preview-scroll",style:{padding:"8px 30px 34px",flex:"1 1 auto",minHeight:0,overflow:"auto"},children:t?D?e.jsx(b,{kind:"loading",title:"Memuat dokumen…",hint:t}):C?e.jsx(b,{kind:"error",title:"Gagal memuat dokumen",hint:t,action:Q}):e.jsx(A,{text:N,name:t}):e.jsx(b,{kind:"empty",icon:"file-text",title:"Tidak ada dokumen dipilih",hint:"Pilih file dari pohon docs di kiri."})}):e.jsxs("div",{className:"hn-grid-mobile",style:{display:"grid",gridTemplateColumns:"1fr 1fr",flex:"1 1 auto",minHeight:0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-hair)",minHeight:0},children:[e.jsx("div",{style:{padding:"8px 14px",borderBottom:"1px solid var(--border-hair)",background:"var(--bone-100)"},children:e.jsx("span",{className:"hn-eyebrow",children:"Markdown"})}),e.jsx("textarea",{value:w,onChange:n=>M(n.target.value),spellCheck:!1,placeholder:`# Judul dokumen
|
|
2
2
|
|
|
3
3
|
Paragraf pembuka…`,style:{flex:1,width:"100%",boxSizing:"border-box",resize:"none",border:"none",outline:"none",padding:"16px 18px",fontFamily:"var(--font-mono)",fontSize:12.5,lineHeight:1.7,color:"var(--text-body)",background:"var(--surface-card)"}})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",minHeight:0},children:[e.jsx("div",{style:{padding:"8px 14px",borderBottom:"1px solid var(--border-hair)",background:"var(--bone-100)"},children:e.jsx("span",{className:"hn-eyebrow",children:"Preview langsung"})}),e.jsx("div",{style:{flex:1,overflow:"auto",padding:"4px 24px 24px"},children:e.jsx(A,{text:w,name:t})})]})]})]})}]}),U]})}export{ve as DocsWorkspace,G as buildTree,K as firstDoc};
|